driver

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonCustomizedValues

type CommonCustomizedValues struct {
	ProtocolID int `json:"protocolID"`
}

type ProtocolConfigData

type ProtocolConfigData struct {
	DeviceID int `json:"deviceID,omitempty"`
}

type VirtualDevice

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

VirtualDevice Realize the structure of random number

func (*VirtualDevice) GetDeviceStatus

func (vd *VirtualDevice) GetDeviceStatus(protocolCommon, visitor, protocol []byte) (status bool)

GetDeviceStatus is an interface to get the device status true is OK , false is DISCONNECTED

func (*VirtualDevice) InitDevice

func (vd *VirtualDevice) InitDevice(protocolCommon []byte) (err error)

InitDevice Sth that need to do in the first If you need mount a persistent connection, you should provIDe parameters in configmap's protocolCommon. and handle these parameters in the following function

func (*VirtualDevice) NewClient

func (vd *VirtualDevice) NewClient()

NewClient create device-instance, if device-instance exit, set the limit as 100. Control a group of devices through singleton pattern

func (*VirtualDevice) ReadDeviceData

func (vd *VirtualDevice) ReadDeviceData(protocolCommon, visitor, protocol []byte) (data interface{}, err error)

ReadDeviceData is an interface that reads data from a specific device, data's dataType is consistent with configmap

func (*VirtualDevice) SetConfig

func (vd *VirtualDevice) SetConfig(protocolCommon, visitor, protocol []byte) (dataType string, deviceID int, err error)

SetConfig Parse the configmap's raw json message

func (*VirtualDevice) StopDevice

func (vd *VirtualDevice) StopDevice() (err error)

StopDevice is an interface to disconnect a specific device This function is called when mapper stops serving

func (*VirtualDevice) WriteDeviceData

func (vd *VirtualDevice) WriteDeviceData(data interface{}, protocolCommon, visitor, protocol []byte) (err error)

WriteDeviceData is an interface that write data to a specific device, data's dataType is consistent with configmap

type VirtualDeviceProtocolCommonConfig

type VirtualDeviceProtocolCommonConfig struct {
	CommonCustomizedValues `json:"customizedValues"`
}

type VirtualDeviceProtocolConfig

type VirtualDeviceProtocolConfig struct {
	ProtocolName       string `json:"protocolName"`
	ProtocolConfigData `json:"configData"`
}

type VirtualDeviceVisitorConfig

type VirtualDeviceVisitorConfig struct {
	ProtocolName      string `json:"protocolName"`
	VisitorConfigData `json:"configData"`
}

type VisitorConfigData

type VisitorConfigData struct {
	DataType string `json:"dataType"`
}

Jump to

Keyboard shortcuts

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