SuperAPI AI Directory

cloudapi2-device-management

Coding & development

View repository

Updated 11-12 16:17

About this skill

DJI Cloud API 2 SDK device management integration assistant

What this Skill does

Helps integrator developers correctly extend device management functionality in the skeleton backend project(Spring Boot 3.2.5 + Java 17): create new feature modules, integrate SDK events, expose REST APIs, and handle OSD/HMS data.

When to trigger

  • The user wants to extend device management functionality (query device list, subscribe to device status, handle alerts)
  • The user wants to create a new custom feature module (same pattern as feature-device)
  • The user mentions SDK event-related class names (DeviceOnlineEvent, OsdUpdateEvent, HmsAlertEvent, etc.)
  • The user asks about the listen/cancel pattern, device control authority, or OSD data structures
  • The user asks about the skeleton's modular architecture (kernel-spi → feature → app)

Do not trigger: frontend component questions (use the cloudapi2-frontend-component Skill), MCP Tool development (use the cloudapi2-sdk-core Skill), or pure SDK API queries.

Workflow

This Skill follows the 7-chapter SOP defined by skills/_shared/sop-template.md . Automatically select the execution depth (L1/L2/L3) based on the user's request.

The following are the specialized rules of this Skill:

Ch2 Clarification questions

When the user's intent is unclear, clarify along the following dimensions:

  1. What to do: query devices? subscribe to status? handle alerts? control devices? or create a new feature module?
  2. Data source: obtain from SDK events, or query from the existing DeviceStatusService?
  3. Whether a new module is needed: can it be extended within the existing feature-device, or does it require an independent feature module?

Ch5 Coding constraints

See constraints.yaml; all critical rules must be satisfied when generating code.

Core iron rules:

  1. listen/cancel must be paired: each @EventListener corresponds to an underlying SDK subscription, which is released in @PreDestroy released in
  2. null guard:getDroneInstance(sn) / getDockInstance(sn) return values must be null-checked
  3. error_code check: all SDK callbacks must first check error.getErrorCode() == SUCCESS
  4. Modularity: new functionality must be a standalone feature module, registered via AutoConfiguration
  5. Event bus: consume KernelEvent only through @EventListener ; do not directly operate the underlying SDK

Ch6 Verification extension

In addition to general verification, the following must be checked:

  • @EventListener methods correspond to the correct event types
  • ConcurrentHashMap / volatile / synchronized are used correctly
  • AutoConfiguration conditional annotations are configured correctly
  • spring.factories or AutoConfiguration.imports has been registered
  • The new module's POM inheritance relationship and dependency declarations are correct

Decision tree

用户要做什么?
├── 查设备列表
│   └── 使用 DeviceStatusService.listAll() + REST endpoint
├── 订阅 OSD 状态
│   └── @EventListener + OsdUpdateEvent → 更新内存状态
├── 处理 HMS 告警
│   └── @EventListener + HmsAlertEvent → bounded deque + 分级处理
├── 设备控制指令
│   └── 需要 acquireFlightControlAuthority → 指令 → release
├── 固件升级 / OTA 进度
│   └── 加载 references/firmware-management.md(工作空间级 FirmwareManageModule,非设备级)
├── 机场辅助设备控制(摄像头切换/空调/补光灯/充电/舱盖)
│   └── 加载 references/device-lifecycle.md 的 DockControlModule 节(挂在 Dock 上)
├── 设备调试类控制(调试模式/舱盖开关/重启格式化/限飞限高/eSIM切换/Geo Caging)
│   └── 加载 references/device-debug.md(DeviceDebugModule,59 方法,设备级)
├── 运维长尾能力(日志管理/维修工单/设备自诊断/RTK 标定/网络测试)
│   └── 加载 references/ops-reporting.md
├── 新建 feature 模块
│   └── 按 playbooks/add-device-feature.yaml 步骤执行
└── 其他 SDK 调用
    └── 转交 cloudapi2-sdk-core Skill

skeleton module architecture

skeleton/
├── kernel/
│   ├── kernel-spi/          ← 接口定义(KernelEvent、SdkEventBus)
│   ├── kernel-impl/         ← Spring 实现(ApplicationEventPublisher)
│   ├── kernel-mock-sdk/     ← 模拟 SDK(本地开发用)
│   └── kernel-real-sdk/     ← 真实 SDK(生产用)
├── feature/
│   ├── feature-device/      ← 设备管理(已实现,参考模板)
│   ├── feature-user/        ← 用户管理
│   └── feature-chat/        ← AI 对话
└── app/
    └── fh-skeleton-app/     ← 启动入口,聚合所有模块

Integrator extension approach: create a new module under feature/ , and consume events defined in kernel-spi via @EventListener .

Authoritative reference

  • references/skeleton-map.md — ★ skeleton complete architecture map (must-read before creating new modules)
  • references/device-lifecycle.md — device online/offline lifecycle
  • references/osd-subscription.md — OSD data subscription mode
  • references/hms-alert-handling.md — HMS alarm severity handling
  • references/firmware-management.md — firmware upgrade (FirmwareManageModule, workspace-level)
  • references/device-debug.md — device debugging and operations control (DeviceDebugModule, 59 methods)
  • references/ops-reporting.md — long-tail operations modules (LogManagementModule/MaintenanceManagementModule/DiagnosisManagementModule/RtkCalibrationModule/NetworkTestModule)
  • playbooks/add-device-feature.yaml — steps for creating a new feature module
  • snippets/ — code template

The constraints.yaml of this Skill contains only domain-specific rules; for general SDK constraints see skills/_shared/constraints-common.yaml(must also be followed when generating code). For cross-Skill routing rules see skills/_shared/skill-routing.md. When user intent is found to fall under the responsibility of another Skill, switch according to the handoff protocol. For output format see skills/_shared/output-format.md. References are lazy-loaded on demand; do not read all references/ at once.