简体   繁体   English

在 RC 仍处于开机状态时检测 DJI 无人机掉电事件

[英]Detect DJI drone power down event while RC is still powered on

Is there a way to determine when the drone has been powered down (when the remote controller is still powered on)?有没有办法判断无人机什么时候已经关机(遥控器controller还在开机的时候)? For example a pilot may change the drone battery but does not power down the remote controller.例如,飞行员可能会更换无人机电池,但不会关闭遥控器 controller。

I have tried using keyManager to listen to the DJIParamConnection param of DJIProductKey, DJIFlightControllerKey and DJIAirLinkKey.我尝试使用 keyManager 来监听 DJIPructKey、DJIFlightControllerKey 和 DJIAirLinkKey 的 DJIParamConnection 参数。

I also tried listening to the DJISDKManagerDelegate methods productConnected, productDisconnected, productChanged, componentConnectedWithKey, and componentDisconnectedWithKey.我还尝试收听 DJISSDKManagerDelegate 方法 productConnected、productDisconnected、productChanged、componentConnectedWithKey 和 componentDisconnectedWithKey。

But none of these key values or delegate methods are triggered when the drone is powered down.但是当无人机断电时,这些键值或委托方法都不会被触发。 They only trigger when the Remote controller is also powered down.它们仅在远程 controller 也断电时触发。

Is there another way to detect this event?还有另一种方法来检测此事件吗?

Tested on M300 and Mavic Pro with iOS SDK 4.15.2经 M300 和 Mavic Pro 测试 iOS SDK 4.15.2

EDIT编辑

I should have mentioned that this is running on a react native, native module.我应该提到这是在反应本机、本机模块上运行的。 When creating a RN native module, RN puts the module on a background thread unless specified.在创建 RN 原生模块时,除非指定,否则 RN 会将模块放在后台线程中。

componentDisconnectedWithKey and productConnected delegate functions were not firing for me because the instance running the DJISDKManagerDelegate protocol was not running on the main thread so bizarrely sometimes they would fire and sometimes not. componentDisconnectedWithKey 和 productConnected 委托函数没有为我触发,因为运行 DJISDKManagerDelegate 协议的实例没有在主线程上运行,所以奇怪的是有时它们会触发,有时不会。

I should have mentioned in my original post, this is a native module running on a react native app.我应该在我的原始帖子中提到,这是一个运行在 React Native 应用程序上的本地模块。 Most of the DJI samples have the DJISDKManagerDelegate attached to a ViewController which I assume runs on the main thread.大多数 DJI 示例都将 DJISSDKManagerDelegate 附加到我假设在主线程上运行的 ViewController。 When creating a RN native module, RN puts the module on a background thread unless specified.在创建 RN 原生模块时,除非指定,否则 RN 会将模块放在后台线程中。 There may be a more elegant solution but I solved this issue by specifying that this native module should run on the main thread.可能有更优雅的解决方案,但我通过指定此本机模块应在主线程上运行来解决此问题。

- (dispatch_queue_t)methodQueue
{
    return dispatch_get_main_queue();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检测iPhone的电源关闭事件以防止在iOS中截屏 - Detect iPhone power button down event to prevent screen shot in iOS 从DJI无人机读取参数 - Reading parameters from DJI drone DJI无人机未连接(未调用sdkManagerProductDidChange委托方法) - DJI drone not connecting (sdkManagerProductDidChange delegate method not called) 使用EXIF数据从DJI无人机检索图像 - Retrieve images from a DJI Drone with EXIF data 哪个功能用于获取DJI Drone for iOS的GPS坐标的准确位置 - Which Function is used for Get the exact location of GPS Coordinates of DJI Drone for iOS 当(电池电量低/电池电量严重不足)命中时,DJI Drone会一直悬停在1-2m的高度,并自动开始回缩 - DJI Drone keeps hovering at height of 1-2m, when (low battery/ serious low battery) hits and it starts retracting home automatically 什么时候CBCentralManager的状态会启动,但仍然给我一个“未启动”警告? - When would CBCentralManager's state ever be powered on but still give me a “not powered on” warning? 如何在仍然按住手指的同时从使用一个UIButton切换到另一个UIButton? - How can you switch from using one UIButton to another while still holding down finger? ios uiscrollview 是否有可能在仍然提供其拖动、滚动功能的同时检测用户的单击? - ios is it possible for a uiscrollview to detect a single tap by a user while still providing its dragging, scrolling capabilities? 手指向下检测拖曳 - Detect drag with finger down
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM