models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataItem

type DataItem struct {
	DataKey   string `json:"dataKey"` // 数据key
	DataValue string `json:"dataVal"` // 数据内容
	Clock     int64  `json:"clock"`   // 时间戳
}

DataItem 数据项

type DeviceData

type DeviceData struct {
	IotBase
	DeviceId string `json:"deviceId"` // 设备编号
	//Content   string     `json:"content"`   // 运行信息内容
	DataItems []DataItem `json:"dataItems"` // 运行内容
}

设备运行信息

type DeviceRegistrationReply

type DeviceRegistrationReply struct {
	Message string `json:"message"` // 运行信息内容
	IotBase2
}

设备注册回复

type DeviceRegistrationReq

type DeviceRegistrationReq struct {
	DeviceId        string `json:"deviceId"`        // 设备编号
	DeviceIp        string `json:"deviceIp"`        // 设备IP
	ProductKey      string `json:"productKey"`      // 产品标识
	DeviceType      string `json:"deviceType"`      // 设备类型
	ProtocolVersion string `json:"protocolVersion"` // 协议版本
	DeveloperId     string `json:"developerId"`     // 开发者Id
	ModelId         string `json:"modelId"`         // 模型Id
	GlobalId        string `json:"globalId"`        // 全局Id
	IotBase
}

设备注册

type DeviceStat

type DeviceStat struct {
	DeviceId string `json:"deviceId"`   // 设备编号
	Stat     int    `json:"deviceStat"` // 设备状态
	IotBase
}

设备状态

type DeviceStorage

type DeviceStorage struct {
	S3Endpoint           string // s3 地址
	S3Bucket             string // s3 bucket
	S3AccessId           string // s3 access id
	S3AccessSecret       string // s3 秘钥
	LocalStoragePath     string // 本地存储路径
	LocalStorageUserName string // 本地存储用户名
	LocalStoragePass     string // 本地存储密码
}

设备存储信息

type EnumCommand

type EnumCommand int32

命令枚举

const (
	RegistrationCMD      EnumCommand = 0x00010000 // 设备注册 65536
	RegistrationReplyCMD EnumCommand = 0x00010001 // 设备注册响应 65537
	DeviceStatCMD        EnumCommand = 0x00010002 // 设备状态 65538
	DeviceStatReplyCMD   EnumCommand = 0x00010003 // 设备状态回复 65539
	DeviceDataCMD        EnumCommand = 0x00010004 // 设备运行信息 65540
	DeviceDataReplyCMD   EnumCommand = 0x00010005 // 设备运行信息回复 65541
	UploadCMD            EnumCommand = 0x00010006 // 上传请求 65542
	UploadReplyCMD       EnumCommand = 0x00010007 // 上传请求回复 65543
	FileInfoCMD          EnumCommand = 0x00010008 // 文件信息 65544
	FileInfoReplyCMD     EnumCommand = 0x00010009 // 文件信息响应 65545
	InternalHeartbeatCMD EnumCommand = 0x00000003 // 内部心跳 3
	OfflineCMD           EnumCommand = 0x00000002 // 下线遗嘱 2
	DeserializeErrorCMD  EnumCommand = 0x00000001 // 反序列化错误 1
	PropertyCMD          EnumCommand = 0x00030001 // 上报属性
	PropertyReplyCMD     EnumCommand = 0x00030002 // 属性回复
	EventCMD             EnumCommand = 0x00030003 // 事件上报
	EventReplyCMD        EnumCommand = 0x00030004 // 事件回复
	ServiceCallCMD       EnumCommand = 0x00030005 // 服务调用
	ServiceReplyCMD      EnumCommand = 0x00030006 // 服务应答
	PropertySetCMD       EnumCommand = 0x00030007 // 参数设置
	PropertySetReplyCMD  EnumCommand = 0x00030008 // 参数设置回复
)

type EnumErrorType

type EnumErrorType int

错误类型

const (
	SubscribeError    EnumErrorType = 1000 // 消息订阅错误
	RegistrationError EnumErrorType = 1001 // 注册错误
	AesError          EnumErrorType = 1002 // AES处理错误
	S3Error           EnumErrorType = 1003 // S3处理错误
	UnConnected       EnumErrorType = 1004 // 未连接错误
	SetupContentError EnumErrorType = 1005 // 组装消息错误
	DeserializeError  EnumErrorType = 1006 // 反序列化错误
	QueueError        EnumErrorType = 1007 // 队列处理错误
	LocalStorageError EnumErrorType = 1008 // 本地存储错误
	DataValidityError EnumErrorType = 1009 // 数据合法性错误
)

type EnumEvent

type EnumEvent string

事件枚举类型

const (
	ErrorEvent          EnumEvent = "ErrorEvent"     // 错误事件
	UploadRequestEvent  EnumEvent = "UploadRequest"  // 上传请求
	UploadCompleteEvent EnumEvent = "UploadComplete" // 上传完成
	ServiceCallEvent    EnumEvent = "ServiceCall"    // 服务调用
	PropertySetEvent    EnumEvent = "PropertySet"    // 参数设置
)

type EnumFileType

type EnumFileType int

文件类型

const (
	Log   EnumFileType = iota // 日志 0
	Img                       // 图像 1
	Video                     // 视频 2
	Other                     // 其他 3
)

type EnumMqttQos

type EnumMqttQos int

qos枚举类型

const (
	Qos0 EnumMqttQos = 0 // Qos0
	Qos1 EnumMqttQos = 1 // Qos1
	Qos2 EnumMqttQos = 2 // Qos2
)

type FileInfo

type FileInfo struct {
	DeviceId string       `json:"deviceId"` // 设备编号
	FileName string       `json:"fileName"` // 文件名称
	FileType EnumFileType `json:"fileType"` // 文件类型
	FilePath string       `json:"filePath"` // 文件路径
	FileSize int          `json:"fileSize"` // 文件大小
	UserData string       `json:"userData"` // 用户扩展字段
	IotBase
}

FileInfo 文件信息

type IotBase

type IotBase struct {
	TimeStamp int64  `json:"timestamp"` // 时间戳
	SessionId string `json:"sessionId"` // 会话Id
}

Iot基类

type IotBase2

type IotBase2 struct {
	Code int `json:"code"` // 平台返回code
	IotBase
}

Iot基类

type IotErrorInfo

type IotErrorInfo struct {
	Code    int    `json:"code"`    // 错误码
	Message string `json:"message"` // 错误消息
}

文件错误信息

type IotFileInfo

type IotFileInfo struct {
	DeviceId string       `json:"deviceId"` // 设备编号
	FileName string       `json:"fileName"` // 文件名称
	Url      string       `json:"url"`      // 文件存储url
	FileSize int          `json:"fileSize"` // 文件大小
	FileType EnumFileType `json:"fileType"` // 文件类型
}

文件信息

type MqttBrokerInfo

type MqttBrokerInfo struct {
	BrokerUrl    string // mqtt broker 信息
	Qos          byte   // qos
	Port         int    // 端口
	MqttUsername string // mqtt用户名
	MqttPass     string // mqtt密码
	IsCert       bool   // 是否开启证书
}

MQTT Broker 信息

type RegItem

type RegItem struct {
	SubDeviceIp   string `json:"subDeviceIp"`   // 子设备IP
	SubDeviceType string `json:"subDeviceType"` // 子设备类型
	SubDeviceId   string `json:"subDeviceId"`   // 子设备编号
}

子设备注册项

type ThingDataItem added in v1.1.2

type ThingDataItem struct {
	DataKey   string      `json:"dataKey"` // 数据key
	DataValue interface{} `json:"dataVal"` // 数据内容
	Clock     int64       `json:"clock"`   // 时间戳
}

数据项

type ThingEvent added in v1.1.2

type ThingEvent struct {
	DeviceId string      `json:"deviceId"` // 设备编号
	Params   interface{} `json:"params"`   // 运行参数
	Method   string      `json:"method"`   // 方法
	IotBase
}

物模型事件

type ThingProperty added in v1.1.2

type ThingProperty struct {
	DeviceId string      `json:"deviceId"` // 设备编号
	Params   interface{} `json:"params"`   // 运行参数
	Method   string      `json:"method"`   // 方法
	IotBase
}

物模型属性

type ThingPropertySet added in v1.2.0

type ThingPropertySet struct {
	DeviceId string      `json:"deviceId"` // 设备编号
	Params   interface{} `json:"params"`   // 设置参数
	Method   string      `json:"method"`   // 方法
	IotBase
}

物模型参数设置

type ThingPropertySetReply added in v1.2.0

type ThingPropertySetReply struct {
	DeviceId string      `json:"deviceId"` // 设备编号
	Params   interface{} `json:"params"`   // 设置参
	Message  string      `json:"message"`  // 响应结果
	Method   string      `json:"method"`   // 方法
	IotBase2
}

物模型参数设置

type ThingServiceCall added in v1.2.0

type ThingServiceCall struct {
	DeviceId string      `json:"deviceId"` // 设备编号
	Params   interface{} `json:"params"`   // 参数
	Method   string      `json:"method"`   // 方法
	IotBase
}

物模型服务调用

type ThingServiceCallReply added in v1.2.0

type ThingServiceCallReply struct {
	DeviceId string      `json:"deviceId"` // 设备编号
	Params   interface{} `json:"params"`   // 回复参数
	Message  string      `json:"message"`  // 响应结果
	Method   string      `json:"method"`   // 方法
	IotBase2
}

物模型服务响应

type UploadReq

type UploadReq struct {
	FileType  EnumFileType `json:"fileType"`  // 文件类型
	DeviceId  string       `json:"deviceId"`  // 设备编号
	StartTime int64        `json:"startTime"` // 开始时间
	EndTime   int64        `json:"endTime"`   // 结束时间
	IotBase
}

UploadReq 上传请求

Jump to

Keyboard shortcuts

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