| "veyron.io/veyron/veyron2/ipc" |
| // Sprinkler status constants |
| sprinklerActive = "active" |
| // Sprinkler allows clients to control the virtual sprinkler. |
| // Status retrieves the Sprinkler's status (i.e., active, idle) |
| func (s *sprinkler) Status(ipc.ServerContext) (string, error) { |
| // Start causes the Sprinkler to emit water for the given duration (in seconds). |
| func (s *sprinkler) Start(_ ipc.ServerContext, duration uint16) error { |
| s.status = sprinklerActive |
| time.Duration(duration)*time.Second, |
| func() { s.status = sprinklerIdle }, |
| // Stop causes the Sprinkler to cease watering. |
| func (s *sprinkler) Stop(ipc.ServerContext) error { |
| // NewSprinkler creates a new sprinkler stub. |
| func NewSprinkler() *sprinkler { |