device ready handling.
This commit is contained in:
+5
-20
@@ -29,11 +29,12 @@ type HardwareState struct {
|
||||
ColorFlags device.ColorFlag `json:"colorFlags"`
|
||||
Buttons []string `json:"buttons"`
|
||||
State device.State `json:"state"`
|
||||
Unreachable bool `json:"unreachable"`
|
||||
}
|
||||
|
||||
func (e HardwareState) EventDescription() string {
|
||||
return fmt.Sprintf("HardwareState(id:%s, iname:%#+v, sflags:%s, cflags:%s, buttons:%v, state:%s)",
|
||||
e.ID, e.InternalName, e.SupportFlags, e.ColorFlags, e.Buttons, e.State,
|
||||
return fmt.Sprintf("HardwareState(id:%s, iname:%#+v, sflags:%s, cflags:%s, buttons:%v, state:%s, unreachable:%t)",
|
||||
e.ID, e.InternalName, e.SupportFlags, e.ColorFlags, e.Buttons, e.State, e.Unreachable,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -52,7 +53,8 @@ func (e HardwareMetadata) EventDescription() string {
|
||||
return fmt.Sprintf("HardwareMetadata(id:%s, icon:%s, ...)", e.ID, e.Icon)
|
||||
}
|
||||
|
||||
// DeviceReady is triggered to indicate that all hardware states have been pushed to the bus ahead of this event.
|
||||
// DeviceReady is triggered to indicate that set-state commands will be heeded for the device
|
||||
// by this ID. It may be unavailable, however.
|
||||
type DeviceReady struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
@@ -61,14 +63,6 @@ func (d DeviceReady) EventDescription() string {
|
||||
return fmt.Sprintf("DeviceReady(id:%s)", d.ID)
|
||||
}
|
||||
|
||||
type DevicesUnreachable struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
func (d DevicesUnreachable) EventDescription() string {
|
||||
return fmt.Sprintf("DevicesUnreachable(id:%s)", d.ID)
|
||||
}
|
||||
|
||||
type DeviceFailed struct {
|
||||
ID string `json:"id"`
|
||||
Error string `json:"error"`
|
||||
@@ -78,15 +72,6 @@ func (e DeviceFailed) EventDescription() string {
|
||||
return fmt.Sprintf("DeviceFailed(id:%s, err:%s)", e.ID, e.Error)
|
||||
}
|
||||
|
||||
type DeviceAvailable struct {
|
||||
ID string
|
||||
Name string
|
||||
}
|
||||
|
||||
func (e DeviceAvailable) EventDescription() string {
|
||||
return fmt.Sprintf("DeviceAvailable(id:%s, name:%s)")
|
||||
}
|
||||
|
||||
type DeviceAccepted struct {
|
||||
ID string `json:"id"`
|
||||
APIKey string `json:"apiKey"`
|
||||
|
||||
Reference in New Issue
Block a user