DJIBattery

@interface DJIBattery : DJIBaseComponent

This class manages the battery’s information and real-time status of the connected product.

  • Sets the delegate to receive the battery aggregation information. Only supported by Matrice 600.

    Declaration

    Objective-C

    + (void)setAggregationDelegate:
        (id<DJIBatteryAggregationDelegate> _Nullable)delegate;

    Parameters

    delegate

    The delegate that will receive the aggregation information.

  • Gets the delegate that receives the battery aggregation state. It is only useful when the aircraft has multiple batteries. Only supported by Matrice 600.

    Declaration

    Objective-C

    + (id<DJIBatteryAggregationDelegate> _Nullable)aggregationDelegate;

    Return Value

    the delegate receives the battery aggregation state.

  • Returns the index of the battery. It is useful when the aircraft has multiple batteries. Index starts from 0. For products with only one battery, the index is 0. For Matrice 600, there are printed numbers on the battery boxes. DJIBattery instance with index 0 corresponds to battery compartment number 1.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger index;
  • Returns the number of battery cells.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger numberOfCells;
  • Delegate that receives the updated state pushed by the battery.

    Declaration

    Objective-C

    @property (readwrite, nonatomic) id<DJIBatteryDelegate> _Nullable delegate;
  • YES if the battery is a smart battery. When the connected battery is a DJI smart battery, more information can be obtained by communicating with the battery.

    Declaration

    Objective-C

    - (BOOL)isSmartBattery;
  • Gets the battery’s history. The DJI battery keeps the history for the past 30 days. The history variable in the block stores objects of type DJIBatteryWarningInformation.

    Not supported by Osmo and non-smart batteries.

    Declaration

    Objective-C

    - (void)getWarningInformationRecordsWithCompletion:
        (void (^_Nonnull)(NSArray<DJIBatteryWarningInformation *> *_Nullable,
                          NSError *_Nullable))block;

    Parameters

    block

    Remote execution result callback block.

  • Gets the battery’s current state, which is one of seven battery states that can be found at the top of DJIBattery.h. Call the isSmartBattery method before using this method.

    Not supported by Osmo and non-smart batteries.

    Declaration

    Objective-C

    - (void)getCurrentWarningInformationWithCompletion:
        (void (^_Nonnull)(DJIBatteryWarningInformation *_Nullable,
                          NSError *_Nullable))block;

    Parameters

    block

    Remote execution result callback block.

  • Gets the battery’s cell voltages. The cellArray variable stores DJIBatteryCell objects. Since the Inspire 1 battery has 6 cells, cellArray has 6 objects: one for each battery cell.

    Supported by all smart batteries including Osmo.

    Declaration

    Objective-C

    - (void)getCellVoltagesWithCompletion:
        (void (^_Nonnull)(NSArray<DJIBatteryCell *> *_Nullable,
                          NSError *_Nullable))block;

    Parameters

    block

    Remote execution result callback block.

  • A battery’s full charge capacity reduces a little every time it goes through a discharge and recharge cycle. Therefore, older batteries that have gone through many cycles will have lower full charge capacity than newer batteries. When multiple batteries are used simultaneously in a product, the aggregate full charge capacity will be limited by the battery with lowest full charge capacity. To optimize the amount of energy delivered by a battery over its lifetime to a product, batteries should be matched or paired with other batteries of similar full charge capacity. The operational challenges of always using paired batteries can be alleviated using the battery pairing interfaces.

    This method will pair two batteries, by recording the aggregate of the serial numbers in each of their firmwares. getBatteryPairStatusWithCompletion can then be used to determine if the installed battery combination is a previously assigned pair or not. Batteries can be repaired. Only supported by Inspire 2.

    Declaration

    Objective-C

    - (void)pairBatteriesWithCompletion:(DJICompletionBlock)completion;

    Parameters

    completion

    Completion block that receives the execution result.

  • A battery’s full charge capacity reduces a little every time it goes through a discharge and recharge cycle. Therefore, older batteries that have gone through many cycles will have lower full charge capacity than newer batteries. When multiple batteries are used simultaneously in a product, the aggregate full charge capacity will be limited by the battery with lowest full charge capacity. To optimize the amount of energy delivered by a battery over its lifetime to a product, batteries should be matched or paired with other batteries of similar full charge capacity. The operational challenges of always using paired batteries can be alleviated using the battery pairing interfaces.

    This method can then be used to determine if the installed battery combination is a previously assigned pair or not. Only supported by Inspire 2.

    Declaration

    Objective-C

    - (void)getBatteryPairStatusWithCompletion:
        (void (^_Nonnull)(DJIBatteryPairStatus, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.

  • Sets the battery’s custom self-discharge configuration in the range of [1, 10] days. For example, if the value for day is 10, the battery will discharge over the course of 10 days. Call the isSmartBattery method before using this method.

    Not supported by Osmo and non-smart batteries.

    Declaration

    Objective-C

    - (void)setSelfDischargeDay:(uint8_t)day
                 withCompletion:(DJICompletionBlock)block;

    Parameters

    day

    Day for self-discharge

    block

    Remote execution result error block.

  • Gets the battery’s custom self-discharge configuration. Call the isSmartBattery method before using this method.

    Not supported by Osmo and non-smart batteries.

    Declaration

    Objective-C

    - (void)getSelfDischargeDayWithCompletion:
        (void (^_Nonnull)(uint8_t, NSError *_Nullable))block;

    Parameters

    block

    Remote execution result error block.


  • When the connected battery is not a smart battery, the user needs to set the number of cells manually. The flight controller uses the number of cells and the cell voltage threshold to determine if the aircraft should go home or land. The valid range is [3, 12].

    It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)setNumberOfCells:(NSUInteger)numberOfCells
              withCompletion:(DJICompletionBlock)block;

    Parameters

    numberOfCells

    Number of cells inside the battery.

    block

    Remote execution result error block.

  • Sets the Level 1 cell voltage threshold in mV. When the cell voltage of the battery is lower than the threshold, Level 1 operation will be executed. The valid range is [3600, 4000] mV. When the new value is not 100 mV higher than the Level 2 cell voltage threshold, the Level 2 threshold will be set to (new value - 100) mV.

    It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)setLevel1CellVoltageThreshold:(NSUInteger)voltageInmV
                           withCompletion:(DJICompletionBlock)completion;

    Parameters

    voltageInmV

    Level 1 cell voltage threshold to set.

    completion

    Completion block that receives the setter execution result.

  • Gets the Level 1 cell voltage threshold in mV. When the cell voltage of the battery is lower than the threshold, Level 1 operation will be executed.

    It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)getLevel1CellVoltageThresholdWithCompletion:
        (void (^_Nonnull)(NSUInteger, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.

  • Sets the Level 2 cell voltage threshold in mV. When the cell voltage of the battery is lower than the threshold, Level 2 cell voltage operation will be executed. The valid range is [3500, 3800] mV and must be at least 100 mV lower than the Level 1 voltage threshold. It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)setLevel2CellVoltageThreshold:(NSUInteger)voltageInmV
                           withCompletion:(DJICompletionBlock)completion;

    Parameters

    voltageInmV

    Level 2 cell voltage threshold to set.

    completion

    Completion block that receives the setter execution result.

  • Gets the Level 2 cell voltage threshold in mV. When the cell voltage of the battery is lower than the threshold, Level 1 operation will be executed.

    It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)getLevel2CellVoltageThresholdWithCompletion:
        (void (^_Nonnull)(NSUInteger, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.

  • Sets the operation to be executed when the cell voltage crosses beneath the Level 1 threshold. It can only be set when the motors are off. It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)setLevel1CellVoltageOperation:
                (DJIBatteryLowCellVoltageOperation)operation
                           withCompletion:(DJICompletionBlock)completion;

    Parameters

    operation

    Level 1 operation.

    completion

    Completion block that receives the setter execution result.

  • Gets the operation to be executed when the cell voltage crosses beneath the Level 1 threshold.

    It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)getLevel1CellVoltageOperationWithCompletion:
        (void (^_Nonnull)(DJIBatteryLowCellVoltageOperation,
                          NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.

  • Sets the operation to be executed when the cell voltage is under Level 2 threshold. It can only be set when motors are off. It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)setLevel2CellVoltageOperation:
                (DJIBatteryLowCellVoltageOperation)operation
                           withCompletion:(DJICompletionBlock)completion;

    Parameters

    operation

    Level 2 operation.

    completion

    Completion block that receives the setter execution result.

  • Gets the operation to be executed when the cell voltage crosses beneath the Level 2 threshold.

    It is only supported by stand-alone A3 and N3.

    Declaration

    Objective-C

    - (void)getLevel2CellVoltageOperationWithCompletion:
        (void (^_Nonnull)(DJIBatteryLowCellVoltageOperation,
                          NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.