Helps write Java code for DJI Cloud API 2 map domain SDK: manage flight zones (NFZ/dfence/noland), terrain obstacle offline maps, Flysafe unlock licenses, signal maps, and map elements (points/lines/polygons/groups). Handles sync semantics where changes require explicit sync + polling SyncStatus.
Ships in cloudapi2. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
帮集成商开发者正确编写调用 DJI Cloud API 2 Java SDK 地图域模块的集成代码:SafetyServiceModule 与 ElementModule。
两者的共同点是都挂在 Workspace 上、都是纯 HTTP 业务接口为主(各带少量 WebSocket 订阅:SafetyService 1 个、Element 3 个), 与飞控/遥测(Drone/Dock 级、事件驱动)完全不同,容易在"该挂哪、要不要抢控制权、改完怎么生效"上写错。
核心价值:地图域最大的坑不是 API 签名,而是状态同步语义 —— 飞行区和离线地图改的是云端定义,
必须再 sync 下发到机场才生效,且 sync 的返回不代表同步完成,还要轮询 *SyncStatus。
nfz 限飞区 / dfence 作业区 / noland 禁降区)reason 码、几何校验不过、回调参数写错、模块取到 null不触发:
fh_flysafe / fh_unlock_license / fh_offline_map 等做运维操作)→ cloudapi2-mcp-guidecloudapi2-sdk-corecloudapi2-device-managementcloudapi2-sei-osd// ✅ 地图域模块在 Workspace 上
SafetyServiceModule safety = workspace.getSafetyServiceModule();
ElementModule element = workspace.getElementModule();
// ❌ 不在 drone / dock 上
// drone.getSafetyServiceModule() —— 不存在
// dock.getElementModule() —— 不存在
两个 getter 都可能返回 null(设备/套餐不支持),调用前必须判空。
| 模块 | 方法数(源码核实) | 能力 | 详细文档 |
|---|---|---|---|
SafetyServiceModule | 22 | 信号地图、自定义飞行区、地形障碍物离线地图、Flysafe 解锁证书 | references/safety-service.md |
ElementModule | 11 | 地图元素(点/线/面/圆)增删改查 + 可见性 + 分组层级 + 3 组 WS 订阅 | references/element.md |
(error, result),但有一批方法只有 (error)本域没有 getDeviceList 那种 data-first 例外,但这不意味着所有回调都是两个参数:
| 形态 | 安全服务中的方法 |
|---|---|
onResult(error, result) | 查询类 + 创建/更新/同步类 |
onResult(error) 仅 error | deleteCustomizedFlightAreas、updateOfflineMapsModelInfo、cancelOfflineMapsModelInfo、setOfflineMaps、switchUnlockLicense、submitUnlockLicense、clearDeviceUnlockLicense |
onResult(message) 无 error | listenDroneOfflineMapEnable(订阅推送) |
不要按"查询/命令"推断参数个数——命令类里 createCustomizedFlightAreas 有 result,deleteCustomizedFlightAreas 没有。
写错时编译器会报错,但用 lambda 时容易把 error 当 result 用,务必对照 references/ 里的方法表。
sync 是必经步骤创建/更新/删除飞行区 → 只改了云端
↓
syncCustomizedFlightAreas(网关 SN 列表) → 提交下发
↓
getFlightAreasSyncStatus(网关 SN 列表) → 轮询直到 synchronized / fail
syncXxx 返回的 code 只是提交结果,不代表已同步完成syncOfflineMaps → getOfflineMapsSyncStatusDeviceSyncStatusResults.reason 码给出可读原因(0–13 / 255,见 reference)updateOfflineMapsModelInfo 触发的是模型生成,不是即时完成。必须轮询 getOfflineMapsModelInfo
直到 percent == 100 或 status 落终态,再考虑 syncOfflineMaps。中途可用 cancelOfflineMapsModelInfo 取消。
uploadUnlockLicenseFile(本地路径) → 得到 fileStoreDir,拼出 fileKey
↓
checkUnlockLicense(fileKey, sn) → errFileNames / errCertMismatch 非空即中止
↓
submitUnlockLicense(sn, certUrl) → 提交解锁(仅 error)
check 通过 ≠ submit 成功;submit 前必须确认 check 无错误项。
ContentsGeometryData 的约束写死在服务端校验里:
| 类型 | 必填 | 约束 |
|---|---|---|
Circle | center + radius | radius > 0,单位米 |
Polygon | coordinates | ≥3 点、顶点数 < 255、首尾必须闭合 |
Polyline | coordinates | 仅禁降区(noland)可用 |
坐标格式一律 [经度, 纬度](经度在前)。飞行区数量上限:nfz ≤ 100,noland ≤ 50。
listenDroneOfflineMapEnable 返回 int listenId,< 0 表示失败;@PreDestroy 中必须调用
cancelListenDroneOfflineMapEnable(listenId)。ElementModule 的 listenElementCreate/Update/Delete
同样各返回一个 listenId,需分别保存并配对 cancelListenElementXxx。(其余方法均为一次性回调,不需要 cancel。)
⚠️
SafetyServiceModule飞行区几何用ContentsGeometryData.type = Circle/Polygon/Polyline;ElementModule几何用ElementGeometry.type = Point/LineString/Polygon,圆形复用Point + radius, 没有Circle枚举值。两套模型字段名相似但取值不同,不要跨模块抄代码。
用户问题
├─ 飞行区(限飞区/作业区/禁降区)创建/查询/更新/删除
│ → references/safety-service.md#2-自定义飞行区
├─ 飞行区同步到设备 / 同步失败 / reason 码
│ → references/safety-service.md#25-同步到设备
├─ 离线地图生成/开关/进度/cancel/同步
│ → references/safety-service.md#3-离线地图
├─ 解锁证书上传/校验/提交/查询/开关/清除
│ → references/safety-service.md#4-解锁证书飞行解禁
├─ 信号地图 / H3 网格
│ → references/safety-service.md#1-信号地图
├─ 地图元素(点/线/面/圆)增删改查 / 分组层级 / WS 订阅
│ → references/element.md
├─ 模块获取为 null / 不知道挂在哪
│ → 本文件「模块位置」
├─ 回调参数写错、编译报错
│ → 本文件「规则 1」
└─ 要调 MCP 工具做运维(不写代码)
→ 转交 cloudapi2-mcp-guide
本 Skill 遵循 skills/_shared/sop-template.md 定义的 7 章节 SOP,按 L1/L2/L3 自动选档。
地图域需求必须澄清的点(缺一项就可能写错):
参见 constraints.yaml,所有 critical 规则在生成代码时必须满足;通用 SDK 规则(初始化、鉴权、null 检查)
引用 _shared/constraints-common.yaml,不在本文件重复。
除通用验证外,本域代码必须检查:
getSafetyServiceModule() / getElementModule())references/ 方法表一致(尤其仅 error 的那批,以及 Element 的 3 个 WS 单参数回调)sync,并轮询了 *SyncStatusPoint 而非 Circle)listenXxx 的 listenId 已保存并配对 cancel(listenDroneOfflineMapEnable + Element 的 create/update/delete 三组)check 失败即中止的分支deviceSn vs sn、licenseId 有 String/int 两种),不确定时明确告知用户"需要确认 SDK 文档"references/ 文档路径或官方 SDK 源码| 文档 | 内容 |
|---|---|
references/safety-service.md | SafetyServiceModule 全部 22 个方法、bean 字段、几何约束、sync 语义、reason 码 |
references/element.md | ElementModule 全部 11 个方法、元素/几何模型、分组层级、WS 订阅三元组 |
skills/_shared/constraints-common.yaml | 跨 Skill 通用约束(回调/初始化/null 检查) |
跨 Skill 共享约束见
skills/_shared/constraints-common.yaml。 跨 Skill 路由规则见skills/_shared/skill-routing.md。当发现用户意图属于其他 Skill 职责时,按转交协议切换。 输出格式见skills/_shared/output-format.md。Reference 按需懒加载,不要一次性读取所有 references/。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
13 skills in this plugin
/cloudapi2-aiDJI Cloud API 2 AI 域 SDK 接入助手。当用户要编写 Java 代码管理 AI Box 应用、机载 AI 识别/跟踪/告警、
AI Inside 机载算法生命周期、或 AI 目标检测告警配置与查询时调用。
触发词:AIBoxModule、OnboardAiModule、AIInsideManageModule、AiAlertModule、AI Box、机载 AI、
AI 识别、AIIdentifySet、AIModelSelect、DrcAISpotlightZoom、AI 跟踪、DrcAIAlarm、AI 主动告警、
AI Inside、机载算法、algorithmType、operateAIInsideModel、uploadAlgorithmFile、
AI 告警配置、postDeviceSetting、postAlgorithmSetting、getAiAlertFlights、getAiAlertRecords、
目标检测告警、fetchAIBoxInfo、installApp、operateApp。
不触发:调用 MCP Server 的 fh_* 工具做运维操作(→ cloudapi2-mcp-guide)、
通用 SDK 规则/飞行控制/航线任务(→ cloudapi2-sdk-core)、地图域(→ cloudapi2-map)、
PSDK 负载控制(探照灯/喊话器/Widget,→ cloudapi2-payload)、
设备生命周期与固件升级(→ cloudapi2-device-management)、SEI/OSD 遥测(→ cloudapi2-sei-osd)。
/cloudapi2-device-managementDJI Cloud API 2 SDK 设备管理模块接入助手。当用户要在 skeleton 后端项目中扩展设备管理功能(设备列表、设备状态订阅、HMS 告警、设备上下线、固件升级、控制权获取等),或新建自定义 feature 模块时调用;也覆盖设备运维类模块的 Java 调用代码(机场空调/补光灯/充电/舱盖控制、设备调试、日志管理、维修工单、设备自诊断、RTK 标定、网络测试)。触发词:设备管理、设备列表、设备状态订阅、HMS 告警、固件升级、设备上下线、DeviceOnlineEvent、DeviceOfflineEvent、OsdUpdateEvent、HmsAlertEvent、DeviceStatusService、feature 模块、KernelEvent、EventListener、listen/cancel、getDroneInstance、getDockInstance、DockControlModule、DeviceDebugModule、LogManagementModule、MaintenanceManagementModule、DiagnosisManagementModule、RtkCalibrationModule、NetworkTestModule。/cloudapi2:cloudapi2-mapfrom cloudapi2
npx claudepluginhub dji-sdk/cloud-api-2 --plugin cloudapi2Other plugins' skills for the same job