Documentation ¶
Overview ¶
This package provides an example implementation of S7 interface.
Index ¶
- Constants
- func NewProtocolDriver() interfaces.ProtocolDriver
- type CommandInfo
- type DBInfo
- type Driver
- func (s *Driver) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (d *Driver) Discover() error
- func (s *Driver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) (res []*sdkModel.CommandValue, err error)
- func (s *Driver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (s *Driver) Initialize(sdk interfaces.DeviceServiceSDK) error
- func (s *Driver) NewS7Client(deviceName string, protocol map[string]models.ProtocolProperties) *S7Client
- func (s *Driver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error
- func (d *Driver) Start() error
- func (s *Driver) Stop(force bool) error
- func (s *Driver) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (s *Driver) ValidateDevice(device models.Device) error
- type S7Client
- type S7Info
Constants ¶
const ( HOST = "Host" PORT = "Port" RACK = "Rack" SLOT = "Slot" ADDRESS_TYPE = "AddressType" DBADDRESS = "DBAddress" STARTING_ADDRESS = "StartingAddress" LENGTH = "Length" POS = "Pos" )
const (
Protocol = "s7"
)
Constants related to protocol properties
Variables ¶
This section is empty.
Functions ¶
func NewProtocolDriver ¶
func NewProtocolDriver() interfaces.ProtocolDriver
Types ¶
type CommandInfo ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) AddDevice ¶
func (s *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) HandleReadCommands ¶
func (s *Driver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModel.CommandRequest) (res []*sdkModel.CommandValue, err error)
HandleReadCommands triggers a protocol Read operation for the specified device.
func (*Driver) HandleWriteCommands ¶
func (s *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. Since the commands are actuation commands, params provide parameters for the individual command.
func (*Driver) Initialize ¶
func (s *Driver) Initialize(sdk interfaces.DeviceServiceSDK) error
Initialize performs protocol-specific initialization for the device service.
func (*Driver) NewS7Client ¶
func (s *Driver) NewS7Client(deviceName string, protocol map[string]models.ProtocolProperties) *S7Client
Create S7Client by 'Device' definition
func (*Driver) RemoveDevice ¶
func (s *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) Stop ¶
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 (s *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