library

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolConfigKey = "protocolKey"
	DriverConfigKey   = "driverKey"
)

Variables

This section is empty.

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 Driver added in v1.0.0

func Driver() *DeviceDriver

设备驱动库

func (*DeviceDriver) DeviceDecode added in v1.0.0

func (device *DeviceDriver) DeviceDecode(driverKey string, req DeviceDecodeRequest) *DeviceDecodeResult

设备上行数据解码,该接口主要功能如下: 1. 对读到的数据进行点位值加工 2. 将读到的点位值,同步到本设备的另外一个点位上

func (*DeviceDriver) DeviceEncode added in v1.0.0

func (device *DeviceDriver) DeviceEncode(driverKey string, req DeviceEncodeRequest) *DeviceEncodeResult

设备下行指令编码,该接口试下如下功能: 1. 写操作时,对点位值进行加工 2. 针对点位A发起的读写操作,通过编码可变更为点位B 3. 对单点位发起的读写请求,通过编码可扩展为多点位。例如:执行空开的开关操作,会先触发解锁,再执行开关行为。

func (*DeviceDriver) LoadLibrary added in v1.0.0

func (device *DeviceDriver) LoadLibrary(driverKey string) error

加载指定key的驱动

func (*DeviceDriver) UnloadDeviceDrivers added in v1.0.0

func (device *DeviceDriver) UnloadDeviceDrivers()

卸载驱动

type DeviceEncodeRequest

type DeviceEncodeRequest struct {
	DeviceId string // 设备ID
	Mode     plugin.EncodeMode
	Points   []plugin.PointData
}

设备驱动编码请求

type DeviceEncodeResult

type DeviceEncodeResult struct {
	Points []plugin.PointData `json:"points"`
	Error  error
}

设备驱动编码结果

type DeviceModel

type DeviceModel struct {
}

func Model added in v1.0.0

func Model() *DeviceModel

设备模型库

func (*DeviceModel) LoadLibrary added in v1.0.0

func (device *DeviceModel) LoadLibrary(driverKey string) (config.DeviceModel, error)

加载指定key的驱动

type MirrorTemplate added in v1.0.0

type MirrorTemplate struct {
}

func Mirror added in v1.0.0

func Mirror() *MirrorTemplate

镜像模版库

func (*MirrorTemplate) LoadLibrary added in v1.0.0

func (device *MirrorTemplate) LoadLibrary(key string) (map[string]interface{}, error)

加载指定key的驱动

type ProtocolDriver

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

func Protocol added in v1.0.0

func Protocol() *ProtocolDriver

通信协议层驱动库

func (*ProtocolDriver) Decode added in v1.0.0

func (device *ProtocolDriver) Decode(protocolKey string, req any) ([]plugin.DeviceData, error)

设备上行数据解码,该接口主要功能如下: 1. 对读到的数据进行点位值加工 2. 将读到的点位值,同步到本设备的另外一个点位上

func (*ProtocolDriver) Encode added in v1.0.0

func (device *ProtocolDriver) Encode(protocolKey string, req ProtocolEncodeRequest) (string, error)

设备下行指令编码,该接口试下如下功能: 1. 写操作时,对点位值进行加工 2. 针对点位A发起的读写操作,通过编码可变更为点位B 3. 对单点位发起的读写请求,通过编码可扩展为多点位。例如:执行空开的开关操作,会先触发解锁,再执行开关行为。

func (*ProtocolDriver) Execute added in v1.0.0

func (device *ProtocolDriver) Execute(protocolKey string, luaMethod string, param string) (string, error)

执行制定的方法

func (*ProtocolDriver) LoadLibrary added in v1.0.0

func (device *ProtocolDriver) LoadLibrary(protocolKey string) error

加载指定key的驱动

func (*ProtocolDriver) UnloadDeviceDrivers added in v1.0.0

func (device *ProtocolDriver) UnloadDeviceDrivers()

卸载驱动

type ProtocolEncodeRequest added in v1.0.0

type ProtocolEncodeRequest struct {
	DeviceId string // 设备ID
	Mode     plugin.EncodeMode
	Points   []plugin.PointData
}

设备驱动编码请求

type Type

type Type string

Jump to

Keyboard shortcuts

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