driver

package
v0.0.0-...-78ec4fc Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CustomConfigSectionName is the name of the configuration options
	// section in /cmd/res/configuration.toml
	CustomConfigSectionName = "OPCUAServer"
	// WritableInfoSectionName is the Writable section key
	WritableInfoSectionName = CustomConfigSectionName + "/Writable"
)
View Source
const (
	// NODE id attribute
	NODE = "nodeId"
	// OBJECT node id attribute
	OBJECT = "objectId"
	// METHOD node id attribute
	METHOD = "methodId"
	// INPUTMAP attribute
	INPUTMAP = "inputMap"
)
View Source
const (
	// Protocol is the supported device protocol
	Protocol = "opcua"
	// Endpoint is a constant string
	Endpoint = "Endpoint"
)

Variables

This section is empty.

Functions

func FetchEndpoint

func FetchEndpoint(protocols map[string]models.ProtocolProperties) (string, errors.EdgeX)

FetchEndpoint returns the OPCUA endpoint defined in the configuration

func NewProtocolDriver

func NewProtocolDriver() interfaces.ProtocolDriver

NewProtocolDriver returns a new protocol driver object

Types

type Driver

type Driver struct {
	Logger  logger.LoggingClient
	AsyncCh chan<- *sdkModel.AsyncValues
	// contains filtered or unexported fields
}

Driver struct

func (*Driver) AddDevice

func (d *Driver) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.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 (d *Driver) Discover() error

func (*Driver) HandleReadCommands

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

HandleReadCommands triggers a protocol Read operation for the specified device.

func (*Driver) HandleWriteCommands

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

HandleWriteCommands passes a slice of CommandRequest struct each representing a ResourceOperation for a specific device resource (aka DeviceObject). Since the commands are actuation commands, params provide parameters for the individual command.

func (*Driver) Initialize

func (d *Driver) Initialize(sdk interfaces.DeviceServiceSDK) error

Initialize performs protocol-specific initialization for the device service

func (*Driver) RemoveDevice

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

RemoveDevice is a callback function that is invoked when a Device associated with this Device Service is removed

func (*Driver) Start

func (d *Driver) Start() error

func (*Driver) Stop

func (d *Driver) 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).

func (*Driver) UpdateDevice

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

UpdateDevice is a callback function that is invoked when a Device associated with this Device Service is updated

func (*Driver) ValidateDevice

func (d *Driver) ValidateDevice(device models.Device) error

type OPCUAServerConfig

type OPCUAServerConfig struct {
	DeviceName string
	Policy     string
	Mode       string
	CertFile   string
	KeyFile    string
	Writable   WritableInfo
}

OPCUAServerConfig server information defined by the device profile

func (*OPCUAServerConfig) Validate

func (info *OPCUAServerConfig) Validate() errors.EdgeX

Validate ensures your custom configuration has proper values.

type ServiceConfig

type ServiceConfig struct {
	OPCUAServer OPCUAServerConfig
}

ServiceConfig configuration struct

func (*ServiceConfig) UpdateFromRaw

func (sw *ServiceConfig) UpdateFromRaw(rawConfig interface{}) bool

UpdateFromRaw updates the service's full configuration from raw data received from the Service Provider.

type WritableInfo

type WritableInfo struct {
	Resources string
}

WritableInfo configuration data that can be written without restarting the service

Jump to

Keyboard shortcuts

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