driver

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Protocol = "mqtt"

	Schema   = "Schema"
	Host     = "Host"
	Port     = "Port"
	User     = "User"
	Password = "Password"
	ClientId = "ClientId"
	Topic    = "Topic"

	// Driver config
	IncomingSchema    = "IncomingSchema"
	IncomingHost      = "IncomingHost"
	IncomingPort      = "IncomingPort"
	IncomingUser      = "IncomingUser"
	IncomingPassword  = "IncomingPassword"
	IncomingQos       = "IncomingQos"
	IncomingKeepAlive = "IncomingKeepAlive"
	IncomingClientId  = "IncomingClientId"
	IncomingTopic     = "IncomingTopic"

	ResponseSchema    = "ResponseSchema"
	ResponseHost      = "ResponseHost"
	ResponsePort      = "ResponsePort"
	ResponseUser      = "ResponseUser"
	ResponsePassword  = "ResponsePassword"
	ResponseQos       = "ResponseQos"
	ResponseKeepAlive = "ResponseKeepAlive"
	ResponseClientId  = "ResponseClientId"
	ResponseTopic     = "ResponseTopic"

	ConnEstablishingRetry = "ConnEstablishingRetry"
	ConnRetryWaitTime     = "ConnRetryWaitTime"
)

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

Types

type Config

type Config struct {
	Incoming connectionInfo
	Response connectionInfo
}

type ConnectionInfo

type ConnectionInfo struct {
	Schema   string
	Host     string
	Port     string
	User     string
	Password string
	ClientId string
	Topic    string
}

func CreateConnectionInfo

func CreateConnectionInfo(protocols map[string]models.ProtocolProperties) (*ConnectionInfo, error)

CreateConnectionInfo use to load MQTT connectionInfo for read and write command

type Driver

type Driver struct {
	Logger           logger.LoggingClient
	AsyncCh          chan<- *sdkModel.AsyncValues
	CommandResponses sync.Map
	Config           *configuration
}

func (*Driver) AddDevice added in v1.1.0

func (d *Driver) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.AdminState) error

func (*Driver) DisconnectDevice

func (d *Driver) DisconnectDevice(deviceName string, protocols map[string]models.ProtocolProperties) error

func (*Driver) HandleReadCommands

func (d *Driver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModel.CommandRequest) ([]*sdkModel.CommandValue, error)

func (*Driver) HandleWriteCommands

func (d *Driver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModel.CommandRequest, params []*sdkModel.CommandValue) error

func (*Driver) Initialize

func (d *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModel.AsyncValues, deviceCh chan<- []sdkModel.DiscoveredDevice) error

func (*Driver) RemoveDevice added in v1.1.0

func (d *Driver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error

func (*Driver) Stop

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

func (*Driver) UpdateDevice added in v1.1.0

func (d *Driver) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.AdminState) error

Jump to

Keyboard shortcuts

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