Documentation
¶
Index ¶
- Constants
- type Command
- type ConnectionConfig
- type Connector
- func (c *Connector) Close()
- func (c *Connector) Decode(raw interface{}) (res []plugin.DeviceData, err error)
- func (c *Connector) Encode(deviceId string, mode plugin.EncodeMode, values ...plugin.PointData) (res interface{}, err error)
- func (c *Connector) Release() (err error)
- func (c *Connector) Send(data interface{}) error
- type Error
- type Plugin
- type ProtocolAdapter
- type TimerGroup
Constants ¶
View Source
const ProtocolName = "serial"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
plugin.BaseConnection
Address string `json:"address"` // 地址:例如:127.0.0.1:502
BaudRate uint `json:"baudRate"` // 波特率(仅串口模式)
DataBits uint `json:"dataBits"` // 数据位(仅串口模式)
StopBits uint `json:"stopBits"` // 停止位(仅串口模式)
Parity string `json:"parity"` // 奇偶性校验(仅串口模式)
MinInterval uint16 `json:"minInterval"` // 最小读取间隔
Timeout uint16 `json:"timeout"` // 请求超时
Retry int `json:"retry"` // 重试次数
}
type Connector ¶
type Connector struct {
Config *ConnectionConfig
Plugin *Plugin
Client serialPort
// contains filtered or unexported fields
}
Connector 连接器
func (*Connector) Decode ¶
func (c *Connector) Decode(raw interface{}) (res []plugin.DeviceData, err error)
Decode 解码数据
type Plugin ¶
Plugin 驱动插件
func NewPlugin ¶
func NewPlugin(adapter ProtocolAdapter) *Plugin
type ProtocolAdapter ¶
type ProtocolAdapter interface {
//初始化采集任务组
InitTimerGroup(connector *Connector) []TimerGroup
//执行采集任务
ExecuteTimerGroup(group *TimerGroup) error
SendCommand(cmd Command) error
DriverBoxEncode(deviceId string, mode plugin.EncodeMode, values ...plugin.PointData) (res []Command, err error)
}
Click to show internal directories.
Click to hide internal directories.