Documentation ¶
Index ¶
- func NewProtocolDriver() dsModels.ProtocolDriver
- type Driver
- func (s *Driver) AddDevice(deviceName string, protocols map[string]contract.ProtocolProperties, ...) error
- func (s *Driver) Discover()
- func (s *Driver) HandleReadCommands(deviceName string, protocols map[string]contract.ProtocolProperties, ...) (res []*dsModels.CommandValue, err error)
- func (s *Driver) HandleWriteCommands(deviceName string, protocols map[string]contract.ProtocolProperties, ...) error
- func (s *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *dsModels.AsyncValues, ...) error
- func (s *Driver) RemoveDevice(deviceName string, protocols map[string]contract.ProtocolProperties) error
- func (s *Driver) Stop(force bool) error
- func (s *Driver) UpdateDevice(deviceName string, protocols map[string]contract.ProtocolProperties, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProtocolDriver ¶
func NewProtocolDriver() dsModels.ProtocolDriver
NewProtocolDriver initializes the singleton Driver and returns it to the caller
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) AddDevice ¶
func (s *Driver) AddDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error
AddDevice is a callback function that is invoked when a new Device associated with this Device Service is added
func (*Driver) Discover ¶
func (s *Driver) 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 (*Driver) HandleReadCommands ¶
func (s *Driver) HandleReadCommands(deviceName string, protocols map[string]contract.ProtocolProperties, reqs []dsModels.CommandRequest) (res []*dsModels.CommandValue, err error)
HandleReadCommands triggers a protocol Read operation for the specified device.
func (*Driver) HandleWriteCommands ¶
func (s *Driver) HandleWriteCommands(deviceName string, protocols map[string]contract.ProtocolProperties, reqs []dsModels.CommandRequest, params []*dsModels.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 (*Driver) Initialize ¶
func (s *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *dsModels.AsyncValues, deviceCh chan<- []dsModels.DiscoveredDevice) error
Initialize performs protocol-specific initialization for the device service.
func (*Driver) RemoveDevice ¶
func (s *Driver) RemoveDevice(deviceName string, protocols map[string]contract.ProtocolProperties) error
RemoveDevice is a callback function that is invoked when a Device associated with this Device Service is removed
func (*Driver) Stop ¶
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 (*Driver) UpdateDevice ¶
func (s *Driver) UpdateDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error
UpdateDevice is a callback function that is invoked when a Device associated with this Device Service is updated