You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
package models
|
|
|
|
import "encoding/json"
|
|
|
|
type DeviceInfo struct {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Structure Structure `json:"structure"`
|
|
DeviceMeta DeviceMeta `json:"device_meta"`
|
|
}
|
|
|
|
type DeviceMeta struct {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Model string `json:"model"`
|
|
Properties []IotaProperty `json:"properties"`
|
|
Capabilities []IotaCapability `json:"capabilities"`
|
|
}
|
|
|
|
// redis序列化
|
|
func (m *DeviceMeta) MarshalBinary() (data []byte, err error) {
|
|
return json.Marshal(m)
|
|
}
|
|
|
|
// redis序列化
|
|
func (m *DeviceMeta) UnmarshalBinary(data []byte) error {
|
|
return json.Unmarshal(data, m)
|
|
|
|
}
|
|
|
|
type IotaCapability struct {
|
|
CapabilityCategoryId int `json:"capabilityCategoryId"`
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Properties []IotaProperty `json:"properties"`
|
|
}
|
|
|
|
type IotaProperty struct {
|
|
Category string `json:"category"`
|
|
Name string `json:"name"`
|
|
ShowName string `json:"showName"`
|
|
Unit string `json:"unit"`
|
|
}
|
|
|