Documentation ¶
Index ¶
- Constants
- type Dbus
- func (dc *Dbus) EmitDeviceAdded(devID string, alreadyAdded bool)
- func (dc *Dbus) EmitItemChanged(devID string, itemID string, data *Payload)
- func (dc *Dbus) ExportDeviceOnDbus(device *Device)
- func (dc *Dbus) ExportItemOnDbus(devID string, item *Item)
- func (dc *Dbus) ExportModuleObject(protocol string) (*Module, bool)
- func (dc *Dbus) InitDbus() bool
- func (dc *Dbus) Ready()
- type DbusInterface
- type Device
- func (device *Device) AddItem(itemID string, typeID string, typeVersion string, options map[string]string) (bool, *dbus.Error)
- func (device *Device) HeartBeat() bool
- func (device *Device) RemoveItem(itemID string) (bool, *dbus.Error)
- func (device *Device) SetOperabilityState(state OperabilityState)
- func (device *Device) SetOptions(options map[string]string) (bool, *dbus.Error)
- func (device *Device) SetPairingState(state PairingState)
- func (device *Device) SetReachabilityState(state ReachabilityState)
- func (device *Device) SetVersion(newVersion string)
- func (device *Device) UpdateFirmware(param string) (string, *dbus.Error)
- type DeviceInterface
- type Item
- type ItemInterface
- type Module
- type OperabilityState
- type PairingState
- type Payload
- type ReachabilityState
Constants ¶
const ( // OperabilityOk state 'ok' for OperabilityState OperabilityOk OperabilityState = 0 // OperabilityPartial state 'partial' for OperabilityState OperabilityPartial OperabilityState = 1 // OperabilityKo state 'Ko' for OperabilityState OperabilityKo OperabilityState = 2 // OperabilityUnknown state 'unknown' for OperabilityState OperabilityUnknown OperabilityState = 3 // PairingOk state 'ok' for PairingState PairingOk PairingState = 0 // PairingInProgres state 'in progres' for PairingState PairingInProgres PairingState = 1 // PairingKo state 'ko' for PairingState PairingKo PairingState = 2 // PairingUnknown state 'unknown' for PairingState PairingUnknown PairingState = 3 // PairingNotNeeded state 'not needed' for PairingState PairingNotNeeded PairingState = 4 // ReachabilityOk state 'ok' for ReachabilityState ReachabilityOk ReachabilityState = 0 // ReachabilityKo state 'ko' for ReachabilityState ReachabilityKo ReachabilityState = 1 // ReachabilityRescue state 'rescue' for ReachabilityState ReachabilityRescue ReachabilityState = 2 // ReachabilityUnknown state 'unknown' for ReachabilityState ReachabilityUnknown ReachabilityState = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dbus ¶
type Dbus struct { Callbacks DbusInterface Protocol string // contains filtered or unexported fields }
Dbus exported structure
func (*Dbus) EmitDeviceAdded ¶
EmitDeviceAdded to call when a device is added
func (*Dbus) EmitItemChanged ¶
EmitItemChanged to call when the value of an item has changed
func (*Dbus) ExportDeviceOnDbus ¶
ExportDeviceOnDbus export a device on dbus
func (*Dbus) ExportItemOnDbus ¶
ExportItemOnDbus export an item on dbus
func (*Dbus) ExportModuleObject ¶
ExportModuleObject Initializes and exports the Module object on DBus
type DbusInterface ¶
type DbusInterface interface { AddDevice(string, string, string, string, map[string]string) bool RemoveDevice(string) bool }
DbusInterface callback called from dbus events
type Device ¶
type Device struct { sync.Mutex DevID string Address string TypeID string TypeVersion string Options map[string]string FirmwareVersion string Items map[string]*Item Frequency *int // in ms // contains filtered or unexported fields }
Device sent over dbus
func InitDevice ¶
func InitDevice(devID string, address string, typeID string, typeVersion string, options map[string]string, deviceInterface DeviceInterface) *Device
InitDevice to init a Device struct
func (*Device) AddItem ¶
func (device *Device) AddItem(itemID string, typeID string, typeVersion string, options map[string]string) (bool, *dbus.Error)
AddItem called to add a new item to this device
func (*Device) RemoveItem ¶
RemoveItem called to remove an item to this device
func (*Device) SetOperabilityState ¶
func (device *Device) SetOperabilityState(state OperabilityState)
SetOperabilityState set the value of the property OperabilityState
func (*Device) SetOptions ¶
SetOptions called when a new options come from Hemis
func (*Device) SetPairingState ¶
func (device *Device) SetPairingState(state PairingState)
SetPairingState set the value of the property PairingState
func (*Device) SetReachabilityState ¶
func (device *Device) SetReachabilityState(state ReachabilityState)
SetReachabilityState set the value of the property ReachabilityState
func (*Device) SetVersion ¶
SetVersion set the value of the property Version
func (*Device) UpdateFirmware ¶
UpdateFirmware call firmware update
type DeviceInterface ¶
type DeviceInterface interface { SetItem(*Item, []byte) bool SetOptionsItem(*Item) bool SetOptionsDevice(*Device) bool AddItem(*Device, *Item) bool RemoveItem(*Device, *Item) UpdateFirmware(*Device, string) string }
DeviceInterface callback called from device dbus events
type Item ¶
type Item struct { ItemID string Mac string TypeID string TypeVersion string Options map[string]string // contains filtered or unexported fields }
Item struct
func InitItem ¶
func InitItem(itemID string, typeID string, typeVersion string, address string, options map[string]string, callbacks ItemInterface) *Item
InitItem to init an Item struct
type ItemInterface ¶
ItemInterface callback called from item events
type ReachabilityState ¶
type ReachabilityState int32
ReachabilityState informs if the device is reachable