Ai
1 Star 0 Fork 0

siliworks/common-package

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
define.go 7.37 KB
一键复制 编辑 原始数据 按行查看 历史
545403892 提交于 2023-06-06 00:08 +08:00 . init
package tsl
type Item struct {
Id string `json:"id,omitempty"` //
FunctionType int `json:"functionType"` // 功能类型 1:属性 2:行为 3:事件
Name string `json:"name"` // 名称
Code string `json:"code"` // 标识符
PropertyDataType string `json:"propertyDataType,omitempty"` // 属性_数据类型
PropertyReadType int `json:"propertyReadType,omitempty"` // 属性_读写类型 1:读写 2:只读
PropertyDataDefinition map[string]interface{} `json:"propertyDataDefinition,omitempty"` // 属性_数据定义
PropertyExpand map[string]interface{} `json:"propertyExpand,omitempty"` // 属性_扩展描述
ActionCall []map[string]interface{} `json:"actionCall,omitempty"` // 行为_调用参数
ActionReturn []map[string]interface{} `json:"actionReturn,omitempty"` // 行为_返回参数
EventType int `json:"eventType,omitempty"` // 事件类型 1:告警 2:故障 3:信息
Events []map[string]interface{} `json:"events,omitempty"` // 事件参数
Original string `json:"original,omitempty"` // JSON报文
}
type (
Model struct {
//属性
Properties []Property `json:"properties,omitempty"`
//行为或功能
Functions []Function `json:"functions,omitempty"`
//事件
Events []Event `json:"events,omitempty"`
PropsReport Event `json:"-"` //属性上报事件
}
Property struct {
Id string `json:"id"`
Name string `json:"name"`
DataType string `json:"dataType,omitempty"`
ValueType map[string]interface{} `json:"valueType"`
Expands map[string]interface{} `json:"expands,omitempty"`
}
PropertyDataDefinition struct {
Expands struct {
ReadOnly bool
}
Type string
}
Function struct {
Id string `json:"id"`
Name string `json:"name"`
Inputs []map[string]interface{} `json:"inputs"`
Outputs []map[string]interface{} `json:"outputs,omitempty"`
}
Event struct {
Id string `json:"id"`
Name string `json:"name"`
DataType string `json:"dataType,omitempty"`
ValueType EveValueType `json:"valueType"`
PropertyReadType int `json:"propertyReadType,omitempty"` // 属性_读写类型 1:读写 2:只读
}
EveValueType struct {
Type string `json:"type"`
Properties []map[string]interface{} `json:"properties"`
}
Invoke struct {
Name string `json:"name"`
}
)
//配置数据结构
type (
Cycle struct {
//以下所有参数单位都是秒,特殊指定除外
Heartbeat int `json:"heartbeat,omitempty"`
GpsInfo int `json:"gpsInfo,omitempty"`
}
ConfigSystem struct {
TimeCycle Cycle `json:"timeCycle"`
}
)
//远程系统配置
type (
SystemCfg struct {
SystemStatusCollectInterval int `json:"systemStatusCollectInterval"`
SystemStatusReportInMiniMode bool `json:"systemStatusReportInMiniMode"`
TdengineKeep int `json:"tdengineKeep"`
OffdataRange int `json:"offdataRange"`
WorkMode WorkMode `json:"workMode"`
License string `json:"license"`
DeviceDescription string `json:"deviceDescription"`
Ntp Ntp `json:"ntp"`
NvControl NvControl `json:"nvControl"`
HostAlarm HostAlarm `json:"hostAlarm"`
DeviceHeartbeat int `json:"deviceHeartbeat"`
}
WorkMode struct {
WorkMode int `json:"workMode"`
}
Ntp struct {
Enabled bool `json:"enabled"`
Interval int `json:"interval"`
MainServer string `json:"mainServer"`
SecondServer string `json:"secondServer"`
}
NvControl struct {
NvpMode int `json:"nvpMode"`
JetsonClock bool `json:"jetsonClock"`
FanMode int `json:"fanMode"`
FanSpeed int `json:"fanSpeed"`
}
HostAlarm struct {
CpuPercent int `json:"cpuPercent"`
MemPercent int `json:"memPercent"`
DiskPercent int `json:"diskPercent"`
HostTemperature int `json:"hostTemperature"`
}
HardwarePower struct {
Name string `json:"name"`
Power struct {
Average string `json:"average"`
Current string `json:"current"`
} `json:"power"`
}
HardwareTemperature struct {
Name string `json:"name"`
Temperature string `json:"temperature"`
}
DiskPercent struct {
Mountpoint string `json:"mountpoint"`
DiskPercent int `json:"diskPercent"`
}
VideoRecordAlarm struct {
Total int `json:"total"`
Used int `json:"used"`
Free int `json:"free"`
UsedPercent float64 `json:"usedPercent"`
}
EdgexResourceAlarm struct {
Total int `json:"total"`
Used int `json:"used"`
Free int `json:"free"`
UsedPercent float64 `json:"usedPercent"`
}
)
const (
READ_WRITE = 1
READ_ONLEY = 2
EVENT_ALARM = 1
EVENT_FAULT = 2
EVENT_INFO = 3
MEDIA_PLAY = "PushStream"
MEDIA_CLOSE = "StopStream"
MEDIA_CHANNEL = "channel"
MEDIA_STREAM = "streamDestination"
PROPS_DEVICE_INFO = "deviceInfo"
PROPS_HARDWARE_INFO = "hardwareInfo"
PROPS_SOFTWARE_INFO = "softwareInfo"
PROPS_POSITION = "position"
PROPS_ENCLOSURE = "enclosure"
PROPS_GPSINFO = "gpsInfo"
TOPOCHANGED = "topoChanged"
//功能类的属性
PROPS_GPSSTORAGE = "GPSStorage"
FUNC_PTCCONTROL = "PTZControl" //云台控制
FUNC_SHUTDOWN = "shutdown" //关机
FUNC_REBOOT = "reboot" //重启
FUNC_REMOTEACCESS = "remoteAccess" //远程功能
FUNC_LOGREPORT = "logReport" //本地日志
EVENT_OUTOFBOUND = "outOfBoundAlert" //围栏报警
EVENT_INFEREVENT = "InferEvent" //edgex硬编码的设置的算法推理流数据
EVENT_CPU = "cpuPercentAlarm" //cpu报警
EVENT_MEM = "memPercentAlarm" //内存报警
EVENT_DISK = "diskPercentAlarm" //硬盘报警
EVENT_HOST_TEMPERATURE = "hostTemperatureAlarm" //温度报警
EVENT_VIDEO_RECORD = "videoRecordAlarm" //视频记录报警
EVENT_RESOURCE = "edgexResourceAlarm" //资源报警
EVENT_MODE_CHANGE = "modeChange" //模式改变
IS_OBJECT_POWERS = "powers"
IS_OBJECT_TEMPERATURES = "temperatures"
)
var HARDWARE_INFO = []string{"cpuPercent", "hostTemperature", "memPercent", "diskPercent", "powers", "temperatures"}
var EVENT_TYPES = []string{1: "alarm", 2: "fault", 3: "info"}
var PROPS_STATIC = []string{PROPS_DEVICE_INFO, PROPS_HARDWARE_INFO, PROPS_SOFTWARE_INFO}
var FUNCS_STATIC = []string{FUNC_PTCCONTROL, FUNC_SHUTDOWN, FUNC_REBOOT, FUNC_REMOTEACCESS, FUNC_LOGREPORT}
var EVENTS_STATIC = []string{EVENT_MODE_CHANGE, EVENT_CPU, EVENT_MEM, EVENT_DISK, EVENT_HOST_TEMPERATURE, EVENT_VIDEO_RECORD, EVENT_RESOURCE}
var CONFIG_QUERY = []string{1: "tsl", 2: "dp", 3: "algo", 4: "sys", 5: "ota.customfirmware", 6: "ota.image", 7: "ota.mcu", 8: "ota.ema", 9: "license", 10: "ota.edgex", 11: "ota.adapter"}
func init() {
PROPS_STATIC = append(PROPS_STATIC, HARDWARE_INFO...)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/siliworks/common-package.git
git@gitee.com:siliworks/common-package.git
siliworks
common-package
common-package
v1.0.3

搜索帮助