增加设备类型详情方法
This commit is contained in:
@@ -8,6 +8,22 @@ import (
|
|||||||
// 设备相关RPC
|
// 设备相关RPC
|
||||||
type Device struct{}
|
type Device struct{}
|
||||||
|
|
||||||
|
// 获取设备类型详情
|
||||||
|
func (d *Device) GetTypeDetail(deviceTypeId uint32) (*DeviceTypeDetail, error) {
|
||||||
|
body := map[string]any{
|
||||||
|
"device_type_id": deviceTypeId,
|
||||||
|
"field_list": []string{},
|
||||||
|
}
|
||||||
|
result := &Result[DeviceTypeDetail]{}
|
||||||
|
if err := GetRequest().Send("device.get_type_detail", body, result); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if result.Code != 0 {
|
||||||
|
return nil, fmt.Errorf("%s", result.Message)
|
||||||
|
}
|
||||||
|
return &result.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
// 获取设备详情
|
// 获取设备详情
|
||||||
func (d *Device) GetDetail(deviceId uint32) (*DeviceDetail, error) {
|
func (d *Device) GetDetail(deviceId uint32) (*DeviceDetail, error) {
|
||||||
body := map[string]any{
|
body := map[string]any{
|
||||||
|
|||||||
@@ -42,6 +42,19 @@ type Result[D any] struct {
|
|||||||
Data D `json:"data"` // 数据
|
Data D `json:"data"` // 数据
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设备类型详情
|
||||||
|
type DeviceTypeDetail struct {
|
||||||
|
Id uint32 `json:"id"` // ID
|
||||||
|
Name string `json:"name"` // 名称
|
||||||
|
Img string `json:"img"` // 图片地址
|
||||||
|
ConnectType uint8 `json:"connect_type"` // 连接类型
|
||||||
|
AppMaxSize uint32 `json:"app_max_size"` // 应用包最大大小
|
||||||
|
HeartbeatCheckInterval uint32 `json:"heartbeat_check_interval"` // 心跳检测间隔
|
||||||
|
HeartbeatIdleTime uint32 `json:"heartbeat_idle_time"` // 心跳最大空闲时间
|
||||||
|
AllowOnlineUpgrade uint8 `json:"allow_online_upgrade"` // 是否允许在线升级
|
||||||
|
AllowVoiceAssistant uint8 `json:"allow_voice_assistant"` // 是否允许使用语言助手
|
||||||
|
}
|
||||||
|
|
||||||
// 设备详情
|
// 设备详情
|
||||||
type DeviceDetail struct {
|
type DeviceDetail struct {
|
||||||
Type uint8 `json:"type"` // 设备类型
|
Type uint8 `json:"type"` // 设备类型
|
||||||
|
|||||||
Reference in New Issue
Block a user