driver

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 []dsModels.CommandRequest) (res []*dsModels.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 []dsModels.CommandRequest,
	params []*dsModels.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(lc logger.LoggingClient, asyncCh chan<- *dsModels.AsyncValues, deviceCh chan<- []dsModels.DiscoveredDevice) error

Initialize performs protocol-specific initialization for the device service.

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

func (s *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 (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

type UartGeneric

type UartGeneric struct {
	// contains filtered or unexported fields
}

UartGeneric is a structure config is a pointer to Config structure in github.com/tarm/serial package. Config contains the information needed to open a serial port. conn is a pointer to Port structure in github.com/tarm/serial package. rxbuf is byte array enable is set to true when new device is added portStatus is set to true when the autoevent is being executed

func NewUartGeneric

func NewUartGeneric(dev string, baud int, timeout int) *UartGeneric

NewUartGeneric is a function takes device name and baud rate as arguments and returns a pointer to UartGeneric structure

func (*UartGeneric) GenericUartRead

func (dev *UartGeneric) GenericUartRead(maxbytes int) error

GenericUartRead method

func (*UartGeneric) GenericUartWrite

func (dev *UartGeneric) GenericUartWrite(txbuf []byte) (int, error)

GenericUartWrite method

Jump to

Keyboard shortcuts

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