Documentation ¶
Overview ¶
This package provides a simple example implementation of ProtocolDriver interface.
Index ¶
- type SimpleDriver
- func (s *SimpleDriver) HandleReadCommands(deviceName string, protocols map[string]contract.ProtocolProperties, ...) (res []*dsModels.CommandValue, err error)
- func (s *SimpleDriver) HandleWriteCommands(deviceName string, protocols map[string]contract.ProtocolProperties, ...) error
- func (s *SimpleDriver) Initialize(lc logger.LoggingClient, asyncCh chan<- *dsModels.AsyncValues) error
- func (s *SimpleDriver) Stop(force bool) 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) HandleReadCommands ¶
func (s *SimpleDriver) 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 (*SimpleDriver) HandleWriteCommands ¶
func (s *SimpleDriver) 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 (*SimpleDriver) Initialize ¶
func (s *SimpleDriver) Initialize(lc logger.LoggingClient, asyncCh chan<- *dsModels.AsyncValues) error
Initialize performs protocol-specific initialization for the device service.
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).