Documentation ¶
Overview ¶
This package provides a simple example implementation of ProtocolDriver interface.
Index ¶
- type SimpleDriver
- func (s *SimpleDriver) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (s *SimpleDriver) Discover()
- func (s *SimpleDriver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) (res []*sdkModels.CommandValue, err error)
- func (s *SimpleDriver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (s *SimpleDriver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModels.AsyncValues, ...) error
- func (s *SimpleDriver) ProcessCustomConfigChanges(rawWritableConfig interface{})
- func (s *SimpleDriver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error
- func (s *SimpleDriver) Stop(force bool) error
- func (s *SimpleDriver) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleDriver ¶
type SimpleDriver struct {
// contains filtered or unexported fields
}
func (*SimpleDriver) AddDevice ¶
func (s *SimpleDriver) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.AdminState) error
AddDevice is a callback function that is invoked when a new Device associated with this Device Service is added
func (*SimpleDriver) Discover ¶
func (s *SimpleDriver) Discover()
Discover triggers protocol specific device discovery, which is an asynchronous operation. Devices found as part of this discovery operation are written to the channel devices.
func (*SimpleDriver) HandleReadCommands ¶
func (s *SimpleDriver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModels.CommandRequest) (res []*sdkModels.CommandValue, err error)
HandleReadCommands triggers a protocol Read operation for the specified device.
func (*SimpleDriver) HandleWriteCommands ¶
func (s *SimpleDriver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModels.CommandRequest, params []*sdkModels.CommandValue) error
HandleWriteCommands passes a slice of CommandRequest struct each representing a ResourceOperation for a specific device resource. Since the commands are actuation commands, params provide parameters for the individual command.
func (*SimpleDriver) Initialize ¶
func (s *SimpleDriver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModels.AsyncValues, deviceCh chan<- []sdkModels.DiscoveredDevice) error
Initialize performs protocol-specific initialization for the device service.
func (*SimpleDriver) ProcessCustomConfigChanges ¶
func (s *SimpleDriver) ProcessCustomConfigChanges(rawWritableConfig interface{})
ProcessCustomConfigChanges ...
func (*SimpleDriver) RemoveDevice ¶
func (s *SimpleDriver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error
RemoveDevice is a callback function that is invoked when a Device associated with this Device Service is removed
func (*SimpleDriver) Stop ¶
func (s *SimpleDriver) Stop(force bool) error
Stop the protocol-specific DS code to shutdown gracefully, or if the force parameter is 'true', immediately. The driver is responsible for closing any in-use channels, including the channel used to send async readings (if supported).
func (*SimpleDriver) UpdateDevice ¶
func (s *SimpleDriver) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.AdminState) error
UpdateDevice is a callback function that is invoked when a Device associated with this Device Service is updated