mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-27 13:48:56 +08:00
37 lines
664 B
Go
37 lines
664 B
Go
package gobot
|
|
|
|
import "time"
|
|
|
|
type Driver struct {
|
|
Interval time.Duration `json:"interval"`
|
|
Pin string `json:"pin"`
|
|
Name string `json:"name"`
|
|
Commands []string `json:"commands"`
|
|
Events map[string]*Event `json:"-"`
|
|
}
|
|
|
|
type DriverInterface interface {
|
|
Start() bool
|
|
Halt() bool
|
|
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
|
|
}
|