Documentation
¶
Index ¶
- Constants
- Variables
- type DeviceDecodeRequest
- type DeviceDecodeResult
- type DeviceDriver
- type DeviceEncodeRequest
- type DeviceEncodeResult
- type DeviceModel
- type MirrorTemplate
- type ProtocolDriver
- func (device *ProtocolDriver) Decode(protocolKey string, req any) ([]plugin.DeviceData, error)
- func (device *ProtocolDriver) Encode(protocolKey string, req ProtocolEncodeRequest) (string, error)
- func (device *ProtocolDriver) Execute(protocolKey string, luaMethod string, param string) (string, error)
- func (device *ProtocolDriver) LoadLibrary(protocolKey string) error
- func (device *ProtocolDriver) UnloadDeviceDrivers()
- type ProtocolEncodeRequest
- type Tag
- type Type
Constants ¶
View Source
const ( ProtocolConfigKey = "protocolKey" DriverConfigKey = "driverKey" )
Variables ¶
View Source
var UsageTag = &usageTag{
language: "zh-CN",
}
Functions ¶
This section is empty.
Types ¶
type DeviceDecodeRequest ¶
type DeviceDecodeRequest struct { DeviceId string `json:"id"` // 设备ID Points []plugin.PointData `json:"points"` }
设备驱动解码请求
type DeviceDecodeResult ¶
type DeviceDecodeResult struct { //解码结果 Points []plugin.PointData `json:"points"` //解码错误信息 Error error `json:"error"` }
设备驱动解码结果
type DeviceDriver ¶
type DeviceDriver struct {
// contains filtered or unexported fields
}
func (*DeviceDriver) DeviceDecode ¶
func (device *DeviceDriver) DeviceDecode(driverKey string, req DeviceDecodeRequest) *DeviceDecodeResult
设备上行数据解码,该接口主要功能如下: 1. 对读到的数据进行点位值加工 2. 将读到的点位值,同步到本设备的另外一个点位上
func (*DeviceDriver) DeviceEncode ¶
func (device *DeviceDriver) DeviceEncode(driverKey string, req DeviceEncodeRequest) *DeviceEncodeResult
设备下行指令编码,该接口试下如下功能: 1. 写操作时,对点位值进行加工 2. 针对点位A发起的读写操作,通过编码可变更为点位B 3. 对单点位发起的读写请求,通过编码可扩展为多点位。例如:执行空开的开关操作,会先触发解锁,再执行开关行为。
type DeviceEncodeRequest ¶
type DeviceEncodeRequest struct { DeviceId string // 设备ID Mode plugin.EncodeMode Points []plugin.PointData }
设备驱动编码请求
type DeviceEncodeResult ¶
设备驱动编码结果
type DeviceModel ¶
type DeviceModel struct { }
func (*DeviceModel) ListModels ¶ added in v1.2.2
func (device *DeviceModel) ListModels() []string
列出所有物模型
func (*DeviceModel) LoadLibrary ¶
func (device *DeviceModel) LoadLibrary(modelKey string) (config.DeviceModel, error)
加载指定key的驱动
type MirrorTemplate ¶
type MirrorTemplate struct { }
func (*MirrorTemplate) LoadLibrary ¶
func (device *MirrorTemplate) LoadLibrary(key string) (map[string]interface{}, error)
加载指定key的驱动
type ProtocolDriver ¶
type ProtocolDriver struct {
// contains filtered or unexported fields
}
func (*ProtocolDriver) Decode ¶
func (device *ProtocolDriver) Decode(protocolKey string, req any) ([]plugin.DeviceData, error)
设备上行数据解码,该接口主要功能如下: 1. 对读到的数据进行点位值加工 2. 将读到的点位值,同步到本设备的另外一个点位上
func (*ProtocolDriver) Encode ¶
func (device *ProtocolDriver) Encode(protocolKey string, req ProtocolEncodeRequest) (string, error)
设备下行指令编码,该接口试下如下功能: 1. 写操作时,对点位值进行加工 2. 针对点位A发起的读写操作,通过编码可变更为点位B 3. 对单点位发起的读写请求,通过编码可扩展为多点位。例如:执行空开的开关操作,会先触发解锁,再执行开关行为。
func (*ProtocolDriver) Execute ¶
func (device *ProtocolDriver) Execute(protocolKey string, luaMethod string, param string) (string, error)
执行制定的方法
func (*ProtocolDriver) LoadLibrary ¶
func (device *ProtocolDriver) LoadLibrary(protocolKey string) error
加载指定key的驱动
func (*ProtocolDriver) UnloadDeviceDrivers ¶
func (device *ProtocolDriver) UnloadDeviceDrivers()
卸载驱动
type ProtocolEncodeRequest ¶
type ProtocolEncodeRequest struct { DeviceId string // 设备ID Mode plugin.EncodeMode Points []plugin.PointData }
设备驱动编码请求
Click to show internal directories.
Click to hide internal directories.