From 84655ceebd73348e7b34155ad804da6356b6ce44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=81=92?= <2390904403@qq.com> Date: Tue, 10 Mar 2026 10:07:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=AF=A6=E6=83=85=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/rpc/device.go | 16 ++++++++++++++++ pkg/rpc/type.go | 13 +++++++++++++ 2 files changed, 29 insertions(+) diff --git a/pkg/rpc/device.go b/pkg/rpc/device.go index 9c6a73c..aca9fae 100644 --- a/pkg/rpc/device.go +++ b/pkg/rpc/device.go @@ -8,6 +8,22 @@ import ( // 设备相关RPC 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) { body := map[string]any{ diff --git a/pkg/rpc/type.go b/pkg/rpc/type.go index cc7afcc..42f8ac7 100644 --- a/pkg/rpc/type.go +++ b/pkg/rpc/type.go @@ -42,6 +42,19 @@ type Result[D any] struct { 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 uint8 `json:"type"` // 设备类型