114 lines
3.1 KiB
Go
114 lines
3.1 KiB
Go
package rpc
|
|
|
|
// 结果Code
|
|
type ResultCode uint16
|
|
|
|
const (
|
|
// 响应Code 正常
|
|
ResultCodeSuccess ResultCode = 0
|
|
// 响应Code 失败
|
|
ResultCodeError ResultCode = 10000
|
|
// 响应Code 参数异常
|
|
ResultCodeParamError ResultCode = 10001
|
|
// 响应Code 操作失败
|
|
ResultCodeActionFail ResultCode = 10002
|
|
// 响应Code 数据不存在
|
|
ResultCodeDataNotExist ResultCode = 10003
|
|
// 响应Code 签名错误
|
|
ResultCodeSignError ResultCode = 10105
|
|
|
|
// 服务通讯失败
|
|
ResultCodeServiceCommunicationFail ResultCode = 11000
|
|
// 数据解析失败
|
|
ResultCodeDataParseFail ResultCode = 11001
|
|
// 操作不存在
|
|
ResultCodeOperationNotExist ResultCode = 11002
|
|
// 设备不存在
|
|
ResultCodeDeviceNotExist ResultCode = 11003
|
|
// 设备信息不在线
|
|
ResultCodeDeviceOffline ResultCode = 11004
|
|
// 设备响应超时
|
|
ResultCodeDeviceResponseTimeout ResultCode = 11005
|
|
// 设备属性不可操作
|
|
ResultCodeDeviceAttributeCannotOperation ResultCode = 11006
|
|
// 设备属性不存在
|
|
ResultCodeDeviceAttributeNotExits ResultCode = 11007
|
|
)
|
|
|
|
// 响应结果
|
|
type Result[D any] struct {
|
|
Code ResultCode `json:"code"`
|
|
Message string `json:"message"`
|
|
Data D `json:"data"`
|
|
}
|
|
|
|
// 设备详情
|
|
type DeviceDetail struct {
|
|
Type uint8 `json:"type"`
|
|
ConnectType uint8 `json:"connect_type"`
|
|
Secret string `json:"secret"`
|
|
PId uint32 `json:"p_id"`
|
|
DataId uint32 `json:"data_id"`
|
|
}
|
|
|
|
// 设备属性参数
|
|
type DeviceAttributeOption struct {
|
|
Type uint8 `json:"type"`
|
|
ContentType uint8 `json:"content_type"`
|
|
Attribute []struct {
|
|
Type uint8 `json:"type"`
|
|
Name string `json:"name"`
|
|
Flag uint8 `json:"flag"`
|
|
Field string `json:"field"`
|
|
Readonly bool `json:"readonly"`
|
|
AllowItem *[]uint8 `json:"allow_item,omitempty"`
|
|
Min *uint32 `json:"min,omitempty"`
|
|
Max *uint32 `json:"max,omitempty"`
|
|
} `json:"attribute"`
|
|
}
|
|
|
|
// Websocket签名数据
|
|
type WebsocketSignData struct {
|
|
UserId uint32 `json:"user_id"`
|
|
Platform string `json:"platform"`
|
|
}
|
|
|
|
// 语音助手数据
|
|
type VoiceAssistant struct {
|
|
Id uint32 `json:"id"`
|
|
Type uint8 `json:"type"`
|
|
OnlineStatus uint8 `json:"online_status"`
|
|
BemFaEnable uint8 `json:"bem_fa_enable"`
|
|
BemFaName string `json:"bem_fa_name"`
|
|
}
|
|
|
|
// 设备操作日志平台
|
|
type DeviceOperationLogPlatform uint8
|
|
|
|
const (
|
|
// 设备操作日志平台 - 管理后台
|
|
DeviceOperationLogPlatformBackstage DeviceOperationLogPlatform = iota + 1
|
|
// 设备操作日志平台 - 语音助手
|
|
DeviceOperationLogPlatformAssistant
|
|
// 设备操作日志平台 - 设备
|
|
DeviceOperationLogPlatformDevice
|
|
// 设备操作日志平台 - APP
|
|
DeviceOperationLogPlatformApp
|
|
// 设备操作日志平台 - 自动化
|
|
DeviceOperationLogPlatformAutomation
|
|
// 设备操作日志平台 - 桌面端
|
|
DeviceOperationLogPlatformDesktop
|
|
// 设备操作日志平台 - API
|
|
DeviceOperationLogPlatformAPI
|
|
)
|
|
|
|
// 设备操作日志结果
|
|
type DeviceOperationLogResult uint8
|
|
|
|
const (
|
|
// 设备操作日志结果 - 成功
|
|
DeviceOperationLogResultSuccess DeviceOperationLogResult = iota + 1
|
|
// 设备操作日志结果 - 失败
|
|
DeviceOperationLogResultFail
|
|
)
|