Documentation ¶
Index ¶
- type CommonCustomizedValues
- type ProtocolConfigData
- type Template
- func (d *Template) GetDeviceStatus(protocolCommon, visitor, protocol []byte) (status bool)
- func (d *Template) InitDevice(protocolCommon []byte) (err error)
- func (d *Template) ReadDeviceData(protocolCommon, visitor, protocol []byte) (data interface{}, err error)
- func (d *Template) SetConfig(protocolCommon, visitor, protocol []byte) (err error)
- func (d *Template) StopDevice() (err error)
- func (d *Template) WriteDeviceData(data interface{}, protocolCommon, visitor, protocol []byte) (err error)
- type TemplateProtocolCommonConfig
- type TemplateProtocolConfig
- type TemplateVisitorConfig
- type VisitorConfigData
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 ¶
GetDeviceStatus is an interface to get the device status true is OK , false is DISCONNECTED
func (*Template) InitDevice ¶
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 ¶
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 ¶
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 { }