From 3ef74070df44b03c2000ac9685b352fc99b575b2 Mon Sep 17 00:00:00 2001 From: "sean.zhou" Date: Mon, 11 Dec 2023 19:21:00 +0800 Subject: [PATCH] What's new? Added support for new Dock model: DJI Dock2 --- README.md | 5 +- src/components/GMap.vue | 17 ++++-- .../DeviceLogUploadRecordDrawer.vue | 4 +- src/components/task/CreatePlan.vue | 6 +- src/pages/page-web/projects/dock.vue | 2 +- src/pages/page-web/projects/wayline.vue | 6 +- src/types/device-firmware.ts | 5 +- src/types/device.ts | 55 +++++++++---------- 8 files changed, 53 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index faf73ce..d5030ec 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## What is the DJI Cloud API? -The launch of the Cloud API mainly solves the problem of developers reinventing the wheel. For developers who do not need in-depth customization of APP, they can directly use DJI Pilot2 to communicate with the third cloud platform, and developers can focus on the development and implementation of cloud service interfaces. +The launch of the Cloud API mainly solves the problem of developers reinventing the wheel. For developers who do not need in-depth customization of APP, they can directly use DJI Pilot2 to communicate with the third cloud platform, and developers can focus on the development and implementation of cloud service interfaces. ## Docker @@ -14,9 +14,8 @@ For more documentation, please visit the [DJI Developer Documentation](https://d ## Latest Release -Cloud API 1.1.0 was released on 22 July 2022. For more information, please visit the [Release Note](https://developer.dji.com/doc/cloud-api-tutorial/cn/). +Cloud API 1.8.0 was released on 11 Dec 2023. For more information, please visit the [Release Note](https://developer.dji.com/doc/cloud-api-tutorial/cn/). ## License Cloud API is MIT-licensed. Please refer to the LICENSE file for more information. - diff --git a/src/components/GMap.vue b/src/components/GMap.vue index 25485ff..621d377 100644 --- a/src/components/GMap.vue +++ b/src/components/GMap.vue @@ -185,8 +185,7 @@ - + @@ -558,7 +557,16 @@ export default defineComponent({ const osdVisible = computed(() => { return store.state.osdVisible }) - + const qualityStyle = computed(() => { + if (deviceInfo.dock.basic_osd?.network_state?.type === NetworkStateTypeEnum.ETHERNET || + (deviceInfo.dock.basic_osd?.network_state?.quality || 0) > NetworkStateQualityEnum.FAIR) { + return 'color: #00ee8b' + } + if ((deviceInfo.dock.basic_osd?.network_state?.quality || 0) === NetworkStateQualityEnum.FAIR) { + return 'color: yellow' + } + return 'color: red' + }) watch(() => store.state.deviceStatusEvent, data => { if (Object.keys(data.deviceOnline).length !== 0) { @@ -872,7 +880,8 @@ export default defineComponent({ RainfallEnum, DroneInDockEnum, closeLivestreamOthers, - closeLivestreamAgora + closeLivestreamAgora, + qualityStyle, } } }) diff --git a/src/components/devices/device-log/DeviceLogUploadRecordDrawer.vue b/src/components/devices/device-log/DeviceLogUploadRecordDrawer.vue index 1d1b2a4..c609638 100644 --- a/src/components/devices/device-log/DeviceLogUploadRecordDrawer.vue +++ b/src/components/devices/device-log/DeviceLogUploadRecordDrawer.vue @@ -21,8 +21,8 @@ diff --git a/src/components/task/CreatePlan.vue b/src/components/task/CreatePlan.vue index 446e982..ad4732e 100644 --- a/src/components/task/CreatePlan.vue +++ b/src/components/task/CreatePlan.vue @@ -30,10 +30,10 @@
- {{ Object.keys(EDeviceType)[Object.values(EDeviceType).indexOf(wayline.drone_model_key)] }} + {{ DEVICE_NAME[wayline.drone_model_key] }} - {{ Object.keys(EDeviceType)[Object.values(EDeviceType).indexOf(payload)] }} + {{ DEVICE_NAME[payload] }}
@@ -162,7 +162,7 @@ import { CloseOutlined, RocketOutlined, CameraFilled, UserOutlined, PlusCircleOu import { ELocalStorageKey, ERouterName } from '/@/types' import { useMyStore } from '/@/store' import { WaylineType, WaylineFile } from '/@/types/wayline' -import { Device, EDeviceType } from '/@/types/device' +import { Device, DEVICE_NAME } from '/@/types/device' import { createPlan, CreatePlan } from '/@/api/wayline' import { getRoot } from '/@/root' import { TaskType, OutOfControlActionOptions, OutOfControlAction, TaskTypeOptions } from '/@/types/task' diff --git a/src/pages/page-web/projects/dock.vue b/src/pages/page-web/projects/dock.vue index e31c88c..88cb77b 100644 --- a/src/pages/page-web/projects/dock.vue +++ b/src/pages/page-web/projects/dock.vue @@ -37,7 +37,7 @@ import { onMounted, ref } from 'vue' import { deleteWaylineFile, downloadWaylineFile, getWaylineFiles } from '/@/api/wayline' import { EDeviceTypeName, ELocalStorageKey } from '/@/types' import { EllipsisOutlined, RocketOutlined, CameraFilled, UserOutlined } from '@ant-design/icons-vue' -import { Device, EDeviceType } from '/@/types/device' +import { Device } from '/@/types/device' import { useMyStore } from '/@/store' import { getBindingDevices } from '/@/api/manage' import { IPage } from '/@/api/http/type' diff --git a/src/pages/page-web/projects/wayline.vue b/src/pages/page-web/projects/wayline.vue index a9a7bc5..dffbc1a 100644 --- a/src/pages/page-web/projects/wayline.vue +++ b/src/pages/page-web/projects/wayline.vue @@ -52,10 +52,10 @@
- {{ Object.keys(EDeviceType)[Object.values(EDeviceType).indexOf(wayline.drone_model_key)] }} + {{ DEVICE_NAME[wayline.drone_model_key] }} - {{ Object.keys(EDeviceType)[Object.values(EDeviceType).indexOf(payload)] }} + {{ DEVICE_NAME[payload] }}
@@ -87,7 +87,7 @@ import { onMounted, onUpdated, ref } from 'vue' import { deleteWaylineFile, downloadWaylineFile, getWaylineFiles, importKmzFile } from '/@/api/wayline' import { ELocalStorageKey, ERouterName } from '/@/types' import { EllipsisOutlined, RocketOutlined, CameraFilled, UserOutlined, SelectOutlined } from '@ant-design/icons-vue' -import { EDeviceType } from '/@/types/device' +import { DEVICE_NAME } from '/@/types/device' import { useMyStore } from '/@/store' import { WaylineFile } from '/@/types/wayline' import { downloadFile } from '/@/utils/common' diff --git a/src/types/device-firmware.ts b/src/types/device-firmware.ts index 3857b1f..5ab300f 100644 --- a/src/types/device-firmware.ts +++ b/src/types/device-firmware.ts @@ -30,6 +30,9 @@ export interface FirmwareUploadParam { export enum DeviceNameEnum { DJI_DOCK = 'DJI Dock', + DJI_DOCK2 = 'DJI Dock2', MATRICE_30 = 'Matrice 30', - MATRICE_30T = 'Matrice 30T' + MATRICE_30T = 'Matrice 30T', + M3D = 'M3D', + M3TD = 'M3TD', } diff --git a/src/types/device.ts b/src/types/device.ts index 20f3cec..d4291a5 100644 --- a/src/types/device.ts +++ b/src/types/device.ts @@ -22,8 +22,9 @@ export enum DOMAIN { export enum DRONE_TYPE { M30 = 67, M300 = 60, - Mavic3EnterpriseAdvanced= 77, + Mavic3EnterpriseAdvanced = 77, M350 = 89, + M3D = 91, } // DJI负载类型枚举值 @@ -43,6 +44,8 @@ export enum PAYLOAD_TYPE { M3E = 66, M3T = 67, + M3D = 80, + M3TD = 81, // UNKNOWN = 65535 } @@ -56,6 +59,7 @@ export enum RC_TYPE { // DOCK type export enum DOCK_TYPE { Dock = 1, + Dock2 = 2, } // 设备sub_type 从0升序 @@ -77,6 +81,9 @@ export const DEVICE_MODEL_KEY = { M300: `${DOMAIN.DRONE}-${DRONE_TYPE.M300}-${DEVICE_SUB_TYPE.ZERO}`, M350: `${DOMAIN.DRONE}-${DRONE_TYPE.M350}-${DEVICE_SUB_TYPE.ZERO}`, + M3D: `${DOMAIN.DRONE}-${DRONE_TYPE.M3D}-${DEVICE_SUB_TYPE.ZERO}`, + M3TD: `${DOMAIN.DRONE}-${DRONE_TYPE.M3D}-${DEVICE_SUB_TYPE.ONE}`, + FPV: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.FPV}-${DEVICE_SUB_TYPE.ZERO}`, H20: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.H20}-${DEVICE_SUB_TYPE.ZERO}`, H20T: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.H20T}-${DEVICE_SUB_TYPE.ZERO}`, @@ -88,6 +95,8 @@ export const DEVICE_MODEL_KEY = { M3ECamera: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.M3E}-${DEVICE_SUB_TYPE.ZERO}`, M3TCamera: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.M3T}-${DEVICE_SUB_TYPE.ZERO}`, + M3DCamera: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.M3D}-${DEVICE_SUB_TYPE.ZERO}`, + M3TDCamera: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.M3TD}-${DEVICE_SUB_TYPE.ZERO}`, // M3MCamera: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.M3M}-${DEVICE_SUB_TYPE.ZERO}`, XT2: `${DOMAIN.PAYLOAD}-${PAYLOAD_TYPE.XT2}-${DEVICE_SUB_TYPE.ZERO}`, @@ -99,6 +108,7 @@ export const DEVICE_MODEL_KEY = { RCPlus: `${DOMAIN.RC}-${RC_TYPE.RCPlus}-${DEVICE_SUB_TYPE.ZERO}`, Dock: `${DOMAIN.DOCK}-${DOCK_TYPE.Dock}-${DEVICE_SUB_TYPE.ZERO}`, + Dock2: `${DOMAIN.DOCK}-${DOCK_TYPE.Dock2}-${DEVICE_SUB_TYPE.ZERO}`, } export const DEVICE_NAME = { @@ -110,6 +120,8 @@ export const DEVICE_NAME = { // [DEVICE_MODEL_KEY.M3M]: 'Mavic 3M', [DEVICE_MODEL_KEY.M300]: 'M300 RTK', [DEVICE_MODEL_KEY.M350]: 'M350 RTK', + [DEVICE_MODEL_KEY.M3D]: 'M3D', + [DEVICE_MODEL_KEY.M3TD]: 'M3TD', // payload [DEVICE_MODEL_KEY.FPV]: 'FPV', @@ -127,6 +139,8 @@ export const DEVICE_NAME = { [DEVICE_MODEL_KEY.XTS]: 'XTS', [DEVICE_MODEL_KEY.Z30]: 'Z30', [DEVICE_MODEL_KEY.DockTopCamera]: 'Dock Camera', + [DEVICE_MODEL_KEY.M3DCamera]: 'M3D Camera', + [DEVICE_MODEL_KEY.M3TDCamera]: 'M3TD Camera', // rc [DEVICE_MODEL_KEY.RC]: 'RC', @@ -134,6 +148,7 @@ export const DEVICE_NAME = { // dock [DEVICE_MODEL_KEY.Dock]: 'Dock', + [DEVICE_MODEL_KEY.Dock2]: 'Dock2', } // 控制权 @@ -169,7 +184,7 @@ export interface OnlineDevice { // 固件升级类型 export enum DeviceFirmwareTypeEnum { ToUpgraded = 3, // 普通升级 - ConsistencyUpgrade =2, // 一致性升级 + ConsistencyUpgrade = 2, // 一致性升级 } // 固件升级状态 @@ -230,7 +245,7 @@ export interface OSDVisible { is_dock: boolean, gateway_sn: string, gateway_callsign: string, - payloads: null | PayloadInfo [], + payloads: null | PayloadInfo[], } export interface GatewayOsd { @@ -293,9 +308,12 @@ export enum NetworkStateTypeEnum { } export enum NetworkStateQualityEnum { - BAD = 0, - MEDIUM = 1, - GOOD = 2 + NO_SIGNAL = 0, + BAD = 1, + POOR = 2, + FAIR = 3, + GOOD = 4, + EXCELLENT = 5, } export enum RainfallEnum { @@ -384,7 +402,7 @@ export interface DockLinkOsd { down_quality: string, frequency_band: number, }, - wireless_link?:{ // 图传链路<会包括4G和sdr信息 + wireless_link?: { // 图传链路<会包括4G和sdr信息 dongle_number: number, // dongle 数量 ['4g_link_state']: FourGLinkStateEnum, // 4g_link_state sdr_link_state: SdrLinkStateEnum, // sdr链路连接状态 @@ -463,29 +481,6 @@ export enum EGear { T } -export enum EDeviceType { - M30 = '0-67-0' as any, - M30T = '0-67-1' as any, - M300 = '0-60-0' as any, - M350 = DEVICE_MODEL_KEY.M350 as any, - Z30 = '1-20-0' as any, - XT2 = '1-26-0' as any, - FPV = '1-39-0' as any, - XTS = '1-41-0' as any, - H20 = '1-42-0' as any, - H20T = '1-43-0' as any, - P1 = '1-50-65535' as any, - M30_Camera = '1-52-0' as any, - M30T_Camera = '1-53-0' as any, - H20N = '1-61-0' as any, - DJI_Dock_Camera = '1-165-0' as any, - L1 = '1-90742-0' as any, - M3E = '0-77-0' as any, - M3D = '0-77-1' as any, - M3E_Camera = '1-66-0' as any, - M3T_Camera = '1-67-0' as any, -} - export enum EDockModeCode { Disconnected = -1, Idle,