Documentation
¶
Index ¶
Constants ¶
View Source
const ( TypeTopo = "topo" //拓扑关系管理 TypeStatus = "status" //代理子设备上下线 TypeThing = "thing" //物模型操作 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
ProductID string `json:"productID"` //产品id
DeviceName string `json:"deviceName"` //设备id
DeviceAlias string `json:"deviceAlias"` //设备名称
DeviceSecret string `json:"deviceSecret,omitempty"` //设备秘钥
Register
Code int64 `json:"code,omitempty"` //子设备绑定结果
Msg string `json:"msg,omitempty"` //错误原因
}
type GatewayPayload ¶
type GatewayPayload struct {
Status def.GatewayStatus `json:"status,omitempty"`
Devices Devices `json:"devices,omitempty"`
Identifiers []string `json:"identifiers,omitempty"` //内为希望设备上报的属性列表,不填为获取全部
ProductID string `json:"productID,omitempty"` //产品ID
DeviceName string `json:"deviceName,omitempty"`
Schema *schema.ModelSimple `json:"schema,omitempty"` //物模型
}
type Msg ¶
type Msg struct {
deviceMsg.CommonMsg
Payload *GatewayPayload `json:"payload,omitempty"`
}
Msg 请求和回复结构体
type Register ¶
type Register struct {
/*
子设备绑定签名串。 签名算法:
1. 签名原串,将产品 GroupIDs 设备名称,随机数,时间戳拼接:text=${product_id};${device_name};${random};${expiration_time}
2. 使用设备 Psk 密钥,或者证书的 Sha1 摘要,进行签名:hmac_sha1(device_secret, text)
*/
Signature string `json:"signature,omitempty"`
Random int64 `json:"random,omitempty"` //随机数。
Timestamp int64 `json:"timestamp,omitempty"` //时间戳,单位:秒。
SignMethod string `json:"signMethod,omitempty"` //签名算法。支持 hmacsha1、hmacsha256
}
Click to show internal directories.
Click to hide internal directories.