【feat】添加设备影子

This commit is contained in:
XM-GO
2023-09-21 15:30:19 +08:00
parent e4dd154e3f
commit 672f6361f1
4 changed files with 271 additions and 2199 deletions

22
pkg/shadow/device.go Normal file
View File

@@ -0,0 +1,22 @@
package shadow
import "time"
// Device 设备结构
type Device struct {
Name string // 设备名称
ProductName string // 设备模型名称
Points map[string]any // 设备点位列表 key参数名 value 值
online bool // 在线状态
disconnectTimes int // 断开连接次数60秒内超过3次判定离线
updatedAt time.Time // 更新时间
}
func NewDevice(deviceName string, productName string, points map[string]any) Device {
return Device{
Name: deviceName,
ProductName: productName,
Points: points,
online: true,
}
}