Files
PandaX/pkg/shadow/device.go
2023-09-21 15:30:19 +08:00

23 lines
646 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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,
}
}