with the code below i am able to retrieve serial number of the dji drone remote controller. however, I cannot get battery level. is there anyway I can retrieve battery level? please advise.
the code for serial number (which is fine):
public void getSerialNumber(CommonCallbacks.CompletionCallbackWith<String> callback)
{
if(baseProduct != null && baseProduct.isConnected()) {
if (baseProduct instanceof Aircraft) {
((Aircraft) baseProduct).getFlightController().getSerialNumber(callback);
}
else callback.onFailure(null);
}
else callback.onFailure(null);
}
the code for remaining battery (which doesn't work):
public void getBatteryLevel(CommonCallbacks.CompletionCallbackWith<Integer> callback)
{
if(baseProduct != null && baseProduct.isConnected()) {
if (baseProduct instanceof Aircraft) {
((Aircraft) baseProduct).getBattery().getChargeRemaining(callback);
}
else callback.onFailure(null);
}
else callback.onFailure(null);
}