msgGateway

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeOperation = "operation" //拓扑关系管理
	TypeStatus    = "status"    //代理子设备上下线
)

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"`             //设备名称
	DeviceSecret string `json:"deviceSecret,omitempty"` //设备秘钥
	Register
	Result int64  `json:"result,omitempty"` //子设备绑定结果
	Status string `json:"status,omitempty"` //错误原因
}

type Devices added in v0.5.1

type Devices []*Device

func (Devices) GetCore added in v0.5.1

func (d Devices) GetCore() Devices

func (Devices) GetProductIDs added in v0.5.1

func (d Devices) GetProductIDs() []string

获取产品id列表(不重复的)

type GatewayPayload

type GatewayPayload struct {
	Status  int32   `json:"status,omitempty"`
	Devices Devices `json:"devices"`
}

type Msg

type Msg struct {
	*deviceMsg.CommonMsg
	Payload *GatewayPayload `json:"payload,omitempty"`
}

Msg 请求和回复结构体

type Register added in v0.5.1

type Register struct {
	/*
		子设备绑定签名串。 签名算法:
		1. 签名原串,将产品 ID 设备名称,随机数,时间戳拼接: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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL