2014-04-30 08:10:44 -07:00
|
|
|
package gobot
|
2013-10-23 22:00:03 -07:00
|
|
|
|
2014-05-03 03:31:11 -07:00
|
|
|
import "time"
|
|
|
|
|
2013-10-23 22:00:03 -07:00
|
|
|
type Driver struct {
|
2014-06-11 11:37:20 -07:00
|
|
|
Interval time.Duration `json:"interval"`
|
|
|
|
Pin string `json:"pin"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Commands []string `json:"commands"`
|
|
|
|
Events map[string]*Event `json:"-"`
|
2013-10-23 22:00:03 -07:00
|
|
|
}
|
|
|
|
|
2013-12-18 15:25:07 -08:00
|
|
|
type DriverInterface interface {
|
|
|
|
Start() bool
|
2014-03-31 14:25:20 -07:00
|
|
|
Halt() bool
|
2014-06-06 14:44:16 -07:00
|
|
|
setInterval(time.Duration)
|
|
|
|
getInterval() time.Duration
|
|
|
|
setName(string)
|
|
|
|
getName() string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Driver) setInterval(t time.Duration) {
|
|
|
|
d.Interval = t
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Driver) getInterval() time.Duration {
|
|
|
|
return d.Interval
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Driver) setName(s string) {
|
|
|
|
d.Name = s
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Driver) getName() string {
|
|
|
|
return d.Name
|
2013-10-23 22:00:03 -07:00
|
|
|
}
|