driver

package
v1.2.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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RestDriver

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

func (*RestDriver) AddDevice

func (driver *RestDriver) AddDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error

AddDevice is a callback function that is invoked when a new Device associated with this Device Service is added

func (*RestDriver) HandleReadCommands

func (driver *RestDriver) HandleReadCommands(deviceName string, protocols map[string]contract.ProtocolProperties, reqs []dsModels.CommandRequest) ([]*dsModels.CommandValue, error)

HandleReadCommands triggers a protocol Read operation for the specified device.

func (*RestDriver) HandleWriteCommands

func (driver *RestDriver) HandleWriteCommands(deviceName string, protocols map[string]contract.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 (*RestDriver) Initialize

func (driver *RestDriver) Initialize(logger logger.LoggingClient, asyncValues chan<- *dsModels.AsyncValues, deviceCh chan<- []dsModels.DiscoveredDevice) error

Initialize performs protocol-specific initialization for the device service.

func (*RestDriver) RemoveDevice

func (driver *RestDriver) RemoveDevice(deviceName string, protocols map[string]contract.ProtocolProperties) error

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

func (*RestDriver) Stop

func (driver *RestDriver) 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 (*RestDriver) UpdateDevice

func (driver *RestDriver) UpdateDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error

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

type RestHandler

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

func NewRestHandler

func NewRestHandler(service *sdk.DeviceService, logger logger.LoggingClient, asyncValues chan<- *models.AsyncValues) *RestHandler

func (RestHandler) Start

func (handler RestHandler) Start() error

Jump to

Keyboard shortcuts

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