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: 3 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 {
}

type ProtocolConfigData

type ProtocolConfigData struct {
}

type Template

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

Template Realize the structure

func (*Template) GetDeviceStatus

func (d *Template) GetDeviceStatus(protocolCommon, visitor, protocol []byte) (status bool)

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

func (*Template) InitDevice

func (d *Template) 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 (*Template) ReadDeviceData

func (d *Template) 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 (*Template) SetConfig

func (d *Template) SetConfig(protocolCommon, visitor, protocol []byte) (err error)

SetConfig Parse the configmap's raw json message In the case of high concurrency, d.mutex helps you get the correct value

func (*Template) StopDevice

func (d *Template) StopDevice() (err error)

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

func (*Template) WriteDeviceData

func (d *Template) 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 TemplateProtocolCommonConfig

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

type TemplateProtocolConfig

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

type TemplateVisitorConfig

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

type VisitorConfigData

type VisitorConfigData struct {
}

Jump to

Keyboard shortcuts

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