DJI Mobile SDK Documentation

      class BatteryState

      @EXClassNullAway
      class BatteryState
      Package:dji.common.battery
      Description:

      Supported by both smart and non-smart batteries, this class keeps track of the real-time state of the battery. Non-smart batteries only support the following properties:

      Class Members:

      Battery Properties

      method getFullChargeCapacity
      int getFullChargeCapacity()
      Package:dji.common.battery
      SDK Key:BatteryKey.FULL_CHARGE_CAPACITY
      Description:

      Returns the total amount of energy, in mAh (milliamp hours), stored in the battery when the battery is fully charged. The energy of the battery at full charge changes over time as the battery continues to get used. Over time, as the battery continues to be recharged, the value of getFullChargeCapacity will decrease.

      Return:
      intAn int value.
      method getChargeRemaining
      int getChargeRemaining()
      Package:dji.common.battery
      SDK Key:BatteryKey.CHARGE_REMAINING
      Description:

      Returns the remaining energy stored in the battery in mAh (milliamp hours).

      Return:
      intAn int value.
      method getChargeRemainingInPercent
      int getChargeRemainingInPercent()
      Package:dji.common.battery
      SDK Key:BatteryKey.CHARGE_REMAINING_IN_PERCENT
      Description:

      Returns the percentage of battery energy left with range [0, 100].

      Return:
      intAn int value.
      method isBeingCharged
      boolean isBeingCharged()
      Package:dji.common.battery
      SDK Key:BatteryKey.IS_BEING_CHARGED
      Description:

      true if the battery is being charged.

      Return:
      booleanThe boolean value.
      method isInSingleBatteryMode
      boolean isInSingleBatteryMode()
      Package:dji.common.battery
      SDK Key:BatteryKey.IS_IN_SINGLE_BATTERY_MODE
      Description:

      true if only one battery is inserted on the the right or starboard side of the aircraft. The aircraft can still take off but the flight time will be shorter. It is only supported by Inspire 2: Inspire 2 must always have a battery in the right/starboard slot.

      Return:
      booleanA boolean value.
      method getSelfHeatingState
      SelfHeatingState getSelfHeatingState()
      Package:dji.common.battery
      Description:

      Get self-heating state of the battery. When the temperature of the battery is below 6 celsius degrees, it will warm up automatically. It is only supported by Mavic 2 Enterprise.

      Return:
      SelfHeatingStateAn enum value of the SelfHeatingState.
      Design Capacity
      method
      method getDesignCapacity
      int getDesignCapacity()
      Package:dji.common.battery
      Description:

      Returns the design capacity of the battery in mAh (milliamp hours). It is the ideal capacity when the battery is new. This value will not change over time. It is only supported by smart battery.

      Return:
      intAn int value.
      Electrical
      method
      method getVoltage
      int getVoltage()
      Package:dji.common.battery
      SDK Key:BatteryKey.VOLTAGE
      Description:

      Returns the current battery voltage (mV).

      Return:
      intAn int value.
      method getCurrent
      int getCurrent()
      Package:dji.common.battery
      SDK Key:BatteryKey.CURRENT
      Description:

      Returns the real time current draw of the battery (mA). A negative value means the battery is being discharged, and a positive value means it is being charged.

      Return:
      intAn int value.
      method getCellVoltageLevel
      BatteryCellVoltageLevel getCellVoltageLevel() { return cellVoltageLevel
      Package:dji.common.battery
      SDK Key:BatteryKey.CELL_VOLTAGE_LEVEL
      Description:

      Current cell voltage level of the battery. It is only supported when the connected product is stand-alone A3 or N3.

      Return:
      BatteryCellVoltageLevelAn enum value of the BatteryCellVoltageLevel.
      Lifetime
      method
      method getLifetimeRemaining
      int getLifetimeRemaining()
      Package:dji.common.battery
      SDK Key:BatteryKey.LIFETIME_REMAINING
      Description:

      Returns the battery's remaining lifetime as a percentage, with range [0, 100]. A new battery will be close to 100%. As a battery experiences charge/discharge cycles, the value will go down. In unsupported products, this value will always be 0. These products are Phantom 4 Pro, Inspire 2, and Phantom 4 Advanced.

      Return:
      intAn int value.
      method getTemperature
      float getTemperature()
      Package:dji.common.battery
      SDK Key:BatteryKey.TEMPERATURE
      Description:

      Returns the battery's temperature, in Celsius, with range [-128, 127] degrees.

      Return:
      floatA float value.
      method getNumberOfDischarges
      int getNumberOfDischarges()
      Package:dji.common.battery
      SDK Key:BatteryKey.NUMBER_OF_DISCHARGES
      Description:

      Returns the total number of discharges the battery has gone through over its lifetime. The total number of discharges includes discharges that happen through normal use and discharges that are manually set.

      Return:
      intAn int value.
      Connection State
      method
      method getConnectionState
      ConnectionState getConnectionState()
      Package:dji.common.battery
      Description:

      Get battery connection status.

      Return:
      ConnectionStateA ConnectionState value.


      Callbacks
      class
      enum BatteryCellVoltageLevel
      @EXClassNullAway
      enum BatteryCellVoltageLevel
      Package:dji.common.battery
      SDK Key:BatteryKey.CELL_VOLTAGE_LEVEL
      Description:

      Battery cell voltage level threshold. Different thresholds will initiate different aircraft behaviors or operations. Level 3 is the lowest level. It is only supported when the connected product is stand-alone A3 and N3.

      Enum Members:
      LEVEL_0The cell voltage is at a safe level; the aircraft can fly normally.
      LEVEL_1The cell voltage is equal to or lower than threshold Level 1. At this level the Level 1 operation will be executed. The threshold value and operation for Level 1 can be configured by the user.
      LEVEL_2The cell voltage is equal to or lower than threshold Level 2. At this level the Level 2 operation will be executed. The threshold value and operation for Level 2 can be configured by the user.
      LEVEL_3The cell voltage is equal to or lower than Level 3. At this level, the aircraft will start landing. The threshold for Level 3 cannot be configured by the user and is fixed at 3400mV.
      UNKNOWNThe cell voltage level is unknown.
      Class Members: