mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-06 20:11:27 +08:00
【feat】添加设备影子
This commit is contained in:
22
pkg/shadow/device.go
Normal file
22
pkg/shadow/device.go
Normal 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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user