driver

package
v0.0.0-...-7079ce8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	RSPPrefix = "RSP"
)

Variables

This section is empty.

Functions

func CreateDriverConfig

func CreateDriverConfig(configMap map[string]string) (*configuration, error)

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.

func (*Driver) Start

func (driver *Driver) Start()

func (*Driver) Stop

func (driver *Driver) Stop(force bool) error

Stop instructs 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).

type NamedDecoder

type NamedDecoder struct {
	Name string
	TagDecoder
}

type TagDecoder

type TagDecoder func(tagData []byte) (URI string, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL