在SDK 4.0中,引入了DJIKeyManager,我想知道何时以及如何使用它。
例如,函数
let batteryLevelKey = DJIBatteryKey(param: DJIBatteryParamChargeRemainingInPercent)
keyManager.startListeningForChanges(on: batteryLevelKey!, withListener: self, andUpdate: ....
DJIKeyManager提供的看起来与
相同battery(_ battery: DJIBattery, didUpdate batteryState: DJIBatteryState)
答案 0 :(得分:2)
你喜欢那样
final BatteryKey batterLevelKey = BatteryKey.create(BatteryKey.CHARGE_REMAINING_IN_PERCENT);
DJISDKManager.getInstance().getKeyManager().addListener(batterLevelKey, new KeyListener() {
@Override
public void onValueChange(@Nullable Object o, @Nullable Object o1) {
int remainingChargeInPercentage = (int) o1;
Log.d("remainingChargeInPercentage", remainingChargeInPercentage + "");
}
});