Documentation ¶
Index ¶
- Constants
- func CreateDriverConfig(configMap map[string]string) (*configuration, error)
- func NewProtocolDriver() sdkModel.ProtocolDriver
- type DecoderRing
- type Driver
- func (driver *Driver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) ([]*sdkModel.CommandValue, error)
- func (driver *Driver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (driver *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModel.AsyncValues) error
- func (driver *Driver) Start()
- func (driver *Driver) Stop(force bool) error
- type NamedDecoder
- type TagDecoder
Constants ¶
const ( ControllerName = "ControllerName" MaxWaitTimeForReq = "MaxWaitTimeForReq" MaxReconnectWaitSeconds = "MaxReconnectWaitSeconds" TlsInsecureSkipVerify = "TlsInsecureSkipVerify" // IncomingTopics provide reads to be sent to EdgeX. IncomingTopics = "IncomingTopics" CommandTopic = "CommandTopic" ResponseTopic = "ResponseTopic" SchemasDir = "SchemasDir" // RspControllerNotifications a slice of the notification types we want to receive from the rsp controller RspControllerNotifications = "RspControllerNotifications" MqttScheme = "MqttScheme" MqttHost = "MqttHost" MqttPort = "MqttPort" MqttUser = "MqttUser" MqttPassword = "MqttPassword" MqttKeepAlive = "MqttKeepAlive" MqttClientId = "MqttClientId" CommandQos = "CommandQos" ResponseQos = "ResponseQos" IncomingQos = "IncomingQos" TagFormats = "TagFormats" TagBitBoundary = "TagBitBoundary" TagURIAuthorityName = "TagURIAuthorityName" TagURIAuthorityDate = "TagURIAuthorityDate" SGTINStrictDecoding = "SGTINStrictDecoding" )
const (
RSPPrefix = "RSP"
)
Variables ¶
This section is empty.
Functions ¶
func CreateDriverConfig ¶
CreateDriverConfig use to load driver config for incoming listener and response listener
func NewProtocolDriver ¶
func NewProtocolDriver() sdkModel.ProtocolDriver
NewProtocolDriver returns the package-level driver instance.
Types ¶
type DecoderRing ¶
type DecoderRing struct {
Decoders []NamedDecoder
}
func (*DecoderRing) AddBitTagDecoder ¶
func (dr *DecoderRing) AddBitTagDecoder(authority, date string, widths []int) error
func (*DecoderRing) AddSGTINDecoder ¶
func (dr *DecoderRing) AddSGTINDecoder(strict bool)
func (*DecoderRing) TagDataToURI ¶
func (dr *DecoderRing) TagDataToURI(tagData string) (string, error)
type Driver ¶
type Driver struct { Logger logger.LoggingClient AsyncCh chan<- *sdkModel.AsyncValues Config *configuration Client mqtt.Client DecoderRing *DecoderRing // contains filtered or unexported fields }
func (*Driver) HandleReadCommands ¶
func (driver *Driver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModel.CommandRequest) ([]*sdkModel.CommandValue, error)
HandleReadCommands is the entrypoint for a command from EdgeX command service The commands will be sent via mqtt to the rsp controller and response will be given back to EdgeX for returning to the caller
func (*Driver) HandleWriteCommands ¶
func (driver *Driver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModel.CommandRequest, params []*sdkModel.CommandValue) error
HandleWriteCommands ignores all requests; write commands (PUT requests) are not currently supported.
func (*Driver) Initialize ¶
func (driver *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModel.AsyncValues) error
Initialize an MQTT driver.
Once initialized, the driver listens on the configured MQTT topics. When a message comes in on a data topic, the driver formats the message appropriately and forwards it to EdgeX. When a message comes in on a command response topic, the driver checks for a corresponding command it sent previously. Assuming it finds one, it formats the response appropriately for EdgeX and forwards it on.
type NamedDecoder ¶
type NamedDecoder struct { Name string TagDecoder }