Documentation
¶
Index ¶
- Constants
- func GetDevicePath(id string) string
- type BaseQuery
- type Device
- func (d *Device) Connect() (err *dbus.Error)
- func (d *Device) Disconnect() (err *dbus.Error)
- func (d *Device) Execute(op string, payload string) (result ExecuteResult, err *dbus.Error)
- func (d *Device) GetInterface() string
- func (d *Device) GetLogger() *log.Logger
- func (d *Device) GetPath() string
- func (d *Device) GetProperties() map[string]map[string]*prop.Prop
- func (d *Device) Read(componentId string) (record *RecordObject, err *dbus.Error)
- func (d *Device) SetInterface(s string)
- func (d *Device) SetLogger(logger *log.Logger)
- func (d *Device) SetPath(s string)
- func (d *Device) Subscribe(componentId string, params map[string]string) (result bool, err *dbus.Error)
- func (d *Device) Unsubscribe(componentId string) (result bool, err *dbus.Error)
- func (d *Device) Write(componentId string, record *RecordObject) (result bool, err *dbus.Error)
- type DeviceComponent
- type DeviceDefinition
- type DeviceManager
- func (d *DeviceManager) Create(dev DeviceDefinition) (DeviceDefinition, *dbus.Error)
- func (d *DeviceManager) Delete(id string) (res bool, err *dbus.Error)
- func (d *DeviceManager) Find(q *BaseQuery) (devices []dbus.ObjectPath, err *dbus.Error)
- func (d *DeviceManager) GetInterface() string
- func (d *DeviceManager) GetLogger() *log.Logger
- func (d *DeviceManager) GetPath() string
- func (d *DeviceManager) GetProperties() map[string]map[string]*prop.Prop
- func (d *DeviceManager) Read(id string) (dev DeviceDefinition, err *dbus.Error)
- func (d *DeviceManager) SetInterface(s string)
- func (d *DeviceManager) SetLogger(logger *log.Logger)
- func (d *DeviceManager) SetPath(s string)
- func (d *DeviceManager) Update(id string, dev DeviceDefinition) (res bool, err *dbus.Error)
- type ExecuteResult
- type RecordObject
- type StatusType
Constants ¶
const ( // DeviceManagerPath object path for DeviceManager DeviceManagerPath = "/iot/agile/DeviceManager" // DeviceManagerInterface interface for DeviceManager DeviceManagerInterface = "iot.agile.Device" // DevicePath partial path for Device DevicePath = "/iot/agile/Device" // DeviceInterface interface for Device DeviceInterface = "iot.agile.Device" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseQuery ¶
type BaseQuery struct { Criteria map[string]string OrderBy map[string]string Limit int32 Offset int32 }
BaseQuery base query for devices record
type Device ¶
type Device struct { api.Proxy Id string Name string Status StatusType Configuration map[string]string Profile map[string]DeviceComponent LastUpdate int32 Data *RecordObject Protocol *dbus.ObjectPath // contains filtered or unexported fields }
Device a device implementation
func NewDevice ¶
func NewDevice(def DeviceDefinition) *Device
NewDevice create a new Device instance
func (*Device) GetProperties ¶
GetProperties return properties
func (*Device) Read ¶
func (d *Device) Read(componentId string) (record *RecordObject, err *dbus.Error)
Read data from a component
func (*Device) Subscribe ¶
func (d *Device) Subscribe(componentId string, params map[string]string) (result bool, err *dbus.Error)
Subscribe for data updates to a component
func (*Device) Unsubscribe ¶
Unsubscribe from data updates of a component
type DeviceComponent ¶
DeviceComponent A device component
type DeviceDefinition ¶
type DeviceDefinition struct { Id string Name string Description string Path dbus.ObjectPath Protocol dbus.ObjectPath Properties map[string]string Streams []DeviceComponent }
DeviceDefinition A device details list
type DeviceManager ¶
type DeviceManager struct { api.Proxy Devices []dbus.ObjectPath // contains filtered or unexported fields }
DeviceManager manages devices in the gateway
func NewDeviceManager ¶
func NewDeviceManager() *DeviceManager
NewDeviceManager initialize a new DeviceManager object
func (*DeviceManager) Create ¶
func (d *DeviceManager) Create(dev DeviceDefinition) (DeviceDefinition, *dbus.Error)
Create add a device
func (*DeviceManager) Delete ¶
func (d *DeviceManager) Delete(id string) (res bool, err *dbus.Error)
Delete a device definition
func (*DeviceManager) Find ¶
func (d *DeviceManager) Find(q *BaseQuery) (devices []dbus.ObjectPath, err *dbus.Error)
Find search for devices
func (*DeviceManager) GetInterface ¶
func (d *DeviceManager) GetInterface() string
GetInterface return interface
func (*DeviceManager) GetLogger ¶
func (d *DeviceManager) GetLogger() *log.Logger
GetLogger return default logger
func (*DeviceManager) GetProperties ¶
func (d *DeviceManager) GetProperties() map[string]map[string]*prop.Prop
GetProperties return properties
func (*DeviceManager) Read ¶
func (d *DeviceManager) Read(id string) (dev DeviceDefinition, err *dbus.Error)
Read a device definition
func (*DeviceManager) SetInterface ¶
func (d *DeviceManager) SetInterface(s string)
SetInterface return interface
func (*DeviceManager) SetLogger ¶
func (d *DeviceManager) SetLogger(logger *log.Logger)
SetLogger set default logger
func (*DeviceManager) Update ¶
func (d *DeviceManager) Update(id string, dev DeviceDefinition) (res bool, err *dbus.Error)
Update a device definition
type ExecuteResult ¶
ExecuteResult response object for Execute
type RecordObject ¶
type RecordObject struct { Format string Value string Unit string ComponentId string DeviceId string LastUpdate int32 }
RecordObject A record of a device sensor
type StatusType ¶
type StatusType int
StatusType the status of a device
const ( //StatusConnected Device is connected StatusConnected StatusType = iota //StatusDisconnected Device is not connected StatusDisconnected )