library

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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 Driver

func Driver() *DeviceDriver

设备驱动库

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. 对单点位发起的读写请求,通过编码可扩展为多点位。例如:执行空开的开关操作,会先触发解锁,再执行开关行为。

func (*DeviceDriver) UnloadDeviceDrivers

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

func Model() *DeviceModel

设备模型库

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 Mirror

func Mirror() *MirrorTemplate

镜像模版库

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 Protocol

func Protocol() *ProtocolDriver

通信协议层驱动库

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
}

设备驱动编码请求

type Tag added in v1.1.4

type Tag struct {
	// Key 唯一标识
	Key string `json:"key"`
	// Desc 标签描述(国际化)
	Desc map[string]string `json:"desc"`
}

func (Tag) GetDesc added in v1.1.4

func (t Tag) GetDesc(lang ...string) string

type Type

type Type string

Jump to

Keyboard shortcuts

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