获取实时电池百分比 Dji Drone

Get Real-time battery percentage Dji Drone

我正在尝试使用 windows SDK 访问我的 DJI drone 的电池百分比,但我无法初始化电池处理程序。

这是 API 文档 https://developer.dji.com/api-reference/windows-api/Components/BatteryHandler.html

如何初始化 batteryHandler

DJI.WindowsSDK.Components.BatteryHandler batteryHandler = new DJI.WindowsSDK.Components.BatteryHandler();

我应该在构造函数中传递什么?文档没有解释如何使用它。

最好的, 保罗

通过DJISDKManagerclass

快速查看使用API所需的文档

"This class is the entry point for using the SDK with a DJI product. Most importantly, this class is used to register the SDK, and to connect to and access the product. This class also provides access to important feature managers. SDK Registration using must be successful before the SDK can be used with a DJI product."

有了这个 class 就可以使用 :

DJISDKManager.ComponentManager.GetBatteryHandler(productIndex, componentIndex)

见:https://developer.dji.com/api-reference/windows-api/Components/ComponentManager.html#componentmanager_getbatteryhandler_inline