| "veyron.io/veyron/veyron2/ipc" |
| // Alarm status constants |
| alarmPanicking = "panicking" |
| // Alarm allows clients to manipulate an alarm and query its status. |
| // Status returns the current status of the Alarm (i.e., armed, unarmed, panicking). |
| func (a *alarm) Status(ipc.ServerContext) (string, error) { |
| // Arm sets the Alarm to the armed state |
| func (a *alarm) Arm(ipc.ServerContext) error { |
| // DelayArm sets the Alarm to the armed state after the given delay in seconds. |
| func (a *alarm) DelayArm(_ ipc.ServerContext, delay float32) error { |
| time.Duration(delay)*time.Second, |
| // Unarm sets the Alarm to the unarmed state. |
| func (a *alarm) Unarm(ipc.ServerContext) error { |
| // Panic sets the Alarm to the panicking state. |
| func (a *alarm) Panic(ipc.ServerContext) error { |
| a.status = alarmPanicking |
| // NewAlarm creates a new alarm stub. |
| return &alarm{status: alarmUnarmed} |