DJI Mobile SDK Documentation

      class DJISDKManager

      @interface DJISDKManager : NSObject
      Header:DJISDKManager.h
      Inherits From:NSObject
      Description:

      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 (such as keyManager), debugging tools, and threading control of asynchronous completion blocks. SDK Registration using registerAppWithDelegate must be successful before the SDK can be used with a DJI product.

      Class Members:

      SDK Admin

      SDK Information
      extern
      extern DJISDKVersionNumber
      FOUNDATION_EXPORT double DJISDKVersionNumber
      Header:DJISDK.h
      Description:

      Version number of DJI Mobile SDK.

      extern DJISDKVersionString
      FOUNDATION_EXPORT const unsigned char DJISDKVersionString[]
      Header:DJISDK.h
      Description:

      Version string of DJI Mobile SDK.

      class method
      class method SDKVersion
      + (NSString *)SDKVersion
      Header:DJISDKManager.h
      Description:

      Gets the DJI Mobile SDK Version. Returns SDK version as a string.

      Return:
      NSString *An NSString object.
      App Registration
      class method
      class method registerAppWithDelegate
      + (void)registerAppWithDelegate:(id<DJISDKManagerDelegate>)delegate
      Header:DJISDKManager.h
      Description:

      The first time the app is initialized after installation, the app connects to a DJI Server through the internet to verify the Application Key. The request will include the following information:

      - App key
      - Bundle ID
      - Device UUID generated from hashed mobile device ID (getDeviceID), hashed SIM serial number (getSIMSerialNumber) and hashed ANDROID ID (Secure.ANDROID_ID). If READ_PHONE_STATE permission is not permitted, a random UUID is generated.
      - System platform, version and name
      - UUID generated by platform's API ([UIDevice)
      - Mobile device model
      - Internet related feature initialisation.
      Subsequent app starts will use locally cached verification information to register the app when the cached information is still valid.

      Input Parameters:
      id<DJISDKManagerDelegate> delegateDelegate used for both the registration result, and when the product changes.
      class method registerAppForLDMWithDelegate
      + (void)registerAppForLDMWithDelegate:(id<DJISDKManagerDelegate>)delegate
      Header:DJISDKManager.h
      Description:

      Designed for LDM feature DJILDMManager. The first time the app is initialized after installation, the app connects to a DJI Server through the internet to verify the Application Key. The request will include the following information:

      - App key
      - Bundle ID
      - Device UUID generated from hashed mobile device ID (getDeviceID), hashed SIM serial number (getSIMSerialNumber) and hashed ANDROID ID (Secure.ANDROID_ID). If READ_PHONE_STATE permission is not permitted, a random UUID is generated.
      - System platform, version and name
      - UUID generated by platform's API ([UIDevice)
      - Mobile device model
      - Internet related feature initialisation (not included)
      After successfully registered, the app will enter LDM mode. Subsequent app starts will use locally cached verification information to register the app when the cached information is still valid.

      Input Parameters:
      id<DJISDKManagerDelegate> delegateDelegate used for both the registration result, and when the product changes.
      class method beginAppRegistration
      + (void)beginAppRegistration
      Header:DJISDKManager.h
      Description:

      The first time the app is initialized after installation, the app connects to a DJI Server through the internet to verify the Application Key. The request will include the following information:

      - App key
      - Bundle ID
      - Device UUID generated from hashed mobile device ID (getDeviceID), hashed SIM serial number (getSIMSerialNumber) and hased ANDROID ID (Secure.ANDROID_ID). If READ_PHONE_STATE permission is not permitted, a random UUID is generated.
      - System platform, version and name
      - UUID generated by platform's API ([UIDevice)
      - Mobile device model
      Subsequent app starts will use locally cached verification information to register the app when the cached information is still valid. Use this method if using startListeningOnRegistrationUpdatesWithListener:andUpdateBlock to listen for registration status.

      class method
      class method hasSDKRegistered
      + (BOOL)hasSDKRegistered
      Header:DJISDKManager.h
      Description:

      Registration state.

      Return:
      BOOLYES if SDK is registered.
      class method startListeningOnRegistrationUpdatesWithListener:andUpdateBlock
      + (void)startListeningOnRegistrationUpdatesWithListener:(id)listener
      andUpdateBlock:(DJIRegistrationUpdateBlock)block
      Header:DJISDKManager.h
      Description:

      Register a listener for SDK app registration status updates. Unlike registerAppWithDelegate this method allows registration updates to go to multiple entities in your app in lieu of a single delegate object.

      Input Parameters:
      id listenerThe object listening to the registration.
      DJIRegistrationUpdateBlock blockThe update block that will run when registration status changes.
      class method stopListeningOnRegistrationUpdatesOfListener
      + (void)stopListeningOnRegistrationUpdatesOfListener:(id)listener
      Header:DJISDKManager.h
      Description:

      Unregister a listener from registration status updates.

      Input Parameters:
      id listenerThe object listening to the registration.
      class method startListeningOnProductConnectionUpdatesWithListener:andUpdateBlock
      + (void)startListeningOnProductConnectionUpdatesWithListener:(id)listener
      andUpdateBlock:(DJIProductConnectionUpdateBlock)block
      Header:DJISDKManager.h
      Description:

      Register a listener for product connection status updates. Unlike registerAppWithDelegate this method allows product connection updates to go to multiple entities in your app in lieu of a single delegate object.

      Input Parameters:
      id listenerListener that is responsible for product connection updates.
      DJIProductConnectionUpdateBlock blockThe update block that will run when product connection status status changes.
      class method stopListeningOnProductConnectionUpdatesOfListener
      + (void)stopListeningOnProductConnectionUpdatesOfListener:(id)listener
      Header:DJISDKManager.h
      Description:

      Unregister a listener from product connection status updates.

      Input Parameters:
      id listenerThe object listening to the registration.
      class method startListeningOnComponentConnectionUpdatesWithListener:andUpdateBlock
      + (void)startListeningOnComponentConnectionUpdatesWithListener:(id)listener
      andUpdateBlock:(DJIComponentConnectionUpdateBlock)block
      Header:DJISDKManager.h
      Description:

      Register a listener for component connection status updates. Unlike registerAppWithDelegate this method allows product connection updates to go to multiple entities in your app in lieu of a single delegate object.

      Input Parameters:
      id listenerListener that is responsible for component connection updates.
      DJIComponentConnectionUpdateBlock blockThe update block that will run when component connection status changes.
      class method stopListeningOnComponentConnectionUpdatesOfListener
      + (void)stopListeningOnComponentConnectionUpdatesOfListener:(id)listener
      Header:DJISDKManager.h
      Description:

      Unregister a listener from component connection status updates.

      Input Parameters:
      id listenerThe object listening to the component connection status
      Threading
      class method
      class method setCompletionBlockQueue
      + (void)setCompletionBlockQueue:(dispatch_queue_t)completionBlockQueue
      Header:DJISDKManager.h
      Description:

      Queue in which completion blocks are called. If left unset, completion blocks are called in main queue.

      Input Parameters:
      dispatch_queue_t completionBlockQueueDispatch queue.
      User Account Manager
      class method
      class method userAccountManager
      + (DJIUserAccountManager *)userAccountManager
      Header:DJISDKManager.h
      Description:

      Used to manage the DJI account of users. Login is required by DJIFlyZoneManager and DJIAppActivationManager.

      Return:
      DJIUserAccountManager *An instance of DJIUserAccountManager.
      App Activation Manager
      class method
      class method appActivationManager
      + (DJIAppActivationManager *)appActivationManager
      Header:DJISDKManager.h
      Description:

      Used to check the states related to the App Activation.

      Return:
      DJIAppActivationManager *An instance of DJIAppActivationManager.
      RTK Network Service Provider
      class method
      class method rtkNetworkServiceProvider
      + (DJIRTKNetworkServiceProvider *)rtkNetworkServiceProvider
      Header:DJISDKManager.h
      Description:

      Accesses the RTK network service provider.

      Return:
      DJIRTKNetworkServiceProvider *An instance of DJIRTKNetworkServiceProvider.
      Component Upgrade
      class method
      class method upgradeManager
      + (nullable DJIUpgradeManager *)upgradeManager
      Header:DJISDKManager.h
      Description:

      Provide access to UpgradeManager used to manage components upgrade.

      Return:
      nullable DJIUpgradeManager *An instance of DJIUpgradeManager.
      UAS Remote ID
      class method
      class method remoteIDManager
      + (nullable DJIUASRemoteIDManager *)remoteIDManager
      Header:DJISDKManager.h
      Description:

      Provide access to UASRemoteIDManager used to manage UA SRemote ID.

      Return:
      nullable DJIUASRemoteIDManager *An instance of DJIUASRemoteIDManager.


      Product Connection

      Product
      class method
      class method product
      + (__kindof DJIBaseProduct *_Nullable)product
      Header:DJISDKManager.h
      Description:

      The DJI product which is connected to the mobile device, only available after successful registration of the app.

      Return:
      __kindof DJIBaseProduct *_NullableAn instance of DJIBaseProduct.
      Bluetooth
      class method
      class method bluetoothProductConnector
      + (nullable DJIBluetoothProductConnector *)bluetoothProductConnector
      Header:DJISDKManager.h
      Description:

      Used to establish the Bluetooth connection between the mobile device and the DJI product. The Bluetooth connection needs to be established before a connection between the SDK and the DJI product can be made using startConnectionToProduct.

      Return:
      nullable DJIBluetoothProductConnector *A DJIBluetoothProductConnector instance.
      Connection
      class method
      class method startConnectionToProduct
      + (BOOL)startConnectionToProduct
      Header:DJISDKManager.h
      Description:

      Starts a connection between the SDK and the DJI product. This method should be called after successful registration of the app and once there is a data connection between the mobile device and DJI product. This data connection is either a USB cable connection, a WiFi connection (that needs to be established outside of the SDK) or a Bluetooth connection (that needs to be established with bluetoothProductConnector). If the connection succeeds, productConnected will be called if the connection succeeded. Returns YES if the connection is started successfully. For products which connect to the mobile device using Bluetooth, bluetoothProductConnector should be used to get a DJIBluetoothProductConnector object which can handle Bluetooth device connection.

      Return:
      BOOLYES if the connection is started successfully.
      class method stopConnectionToProduct
      + (void)stopConnectionToProduct
      Header:DJISDKManager.h
      Description:

      Disconnect from the connected DJI product.

      class method closeConnectionWhenEnteringBackground
      + (void)closeConnectionWhenEnteringBackground:(BOOL)isClose
      Header:DJISDKManager.h
      Description:

      Set the SDK to close the connection automatically when the app enters the background, and resume connection automatically when the app enters the foreground. Default is YES.

      Input Parameters:
      BOOL isCloseYES if the connection should be closed when entering background.


      Debug and Logging

      class method enableBridgeModeWithBridgeAppIP
      + (void)enableBridgeModeWithBridgeAppIP:(NSString *)bridgeAppIP
      Header:DJISDKManager.h
      Description:

      Enter debug mode with debug IP. Please download and use the latest DJI SDK Bridge app from App Store: https://itunes.apple.com/us/app/sdk-bridge/id1263583917?ls=1&mt=8

      Input Parameters:
      NSString * bridgeAppIPDebug IP of the DJI Bridge App.
      class method enableRemoteLoggingWithDeviceID:logServerURLString
      + (void)enableRemoteLoggingWithDeviceID:(NSString *_Nullable)deviceID logServerURLString:(NSString *)url
      Header:DJISDKManager.h
      Description:

      Enable remote logging with log server URL.

      Input Parameters:
      NSString *_Nullable deviceIDOptional device ID to uniquely identify logs from an installation.
      NSString * urlURL of the remote log server.
      Enable Debug Log System
      class method
      class method enableDebugLogSystem
      + (void)enableDebugLogSystem
      Header:DJISDKManager.h
      Description:

      Enables the debug log system. It will enable the DJI Mobile SDK to collect logs that are related to the sdk's internal logic. These logs can be used to help diagnose SDK bugs. The storage limit is 100 MB. When the limit is met, SDK will remove the older half of the logs. By default, the debug log system is disabled. The developer should call this method in each life cycle of the application to enable the debug log system. The logs will be saved to directory named DJISDKDebugLogs. The logs can be accessed through iTunes. In order to improve developer's experience on SDK interconnectivity, DJIPipeline is designed to save log files locally when files are transferred, during which the speed is 475KB per minute. Please be careful with the device storage.

      Disable Debug Log System
      class method
      class method disableDebugLogSystem
      + (void)disableDebugLogSystem
      Header:DJISDKManager.h
      Description:

      Disables the debug log system. Calling this method will not remove the existing logs. Use cleanDebugLogs.

      Clean Debug Logs
      class method
      class method cleanDebugLogs
      + (BOOL)cleanDebugLogs
      Header:DJISDKManager.h
      Description:

      Cleans the existing logs. This method can be called when the debug log system is disabled.

      Return:
      BOOLYES if all the logs are removed.


      Disable Bridge Mode

      Bridge Mode
      class method
      class method disableBridgeMode
      + (void)disableBridgeMode
      Header:DJISDKManager.h
      Description:

      Exits the debug mode, see enableBridgeModeWithBridgeAppIP. If debug mode is not enabled, this method does nothing.


      Get Log Path

      Log Path
      class method
      class method getLogPath
      + (NSString *)getLogPath
      Header:DJISDKManager.h
      Description:

      Gets the path that flight logs are stored to. Flight logs are automatically defineed by MSDK and stored on the mobile device. The SDK does nothing with these logs, and they are provided only as a convenience for developers and users. Users can use these flight logs with DJI service centers if they are making a warranty claim. Only developers using the SDK, and users of the mobile device can access these logs. Older flight logs are overwritten by newer flight logs over time, so the flight log path is given in case an application needs to store all logs.

      Return:
      NSString *An NSString object of the flight log path.


      Crash Collection

      class method disableSDKCrashCollection
      + (void)disableSDKCrashCollection
      Header:DJISDKManager.h
      Description:

      After calling registerAppWithDelegate, you can call this interface to disable the crash collection with DJI.


      Location Accuracy

      Desired Accuracy
      class method
      class method setLocationDesiredAccuracy
      +(void) setLocationDesiredAccuracy:(CLLocationAccuracy)accuracy
      Header:DJISDKManager.h
      Description:

      Sets the desired accuracy for the internal location manager to lower the power usage. The default desired accuracy is "kCLLocationAccuracyBestForNavigation".

      Input Parameters:
      CLLocationAccuracy accuracyA value of "CLLocationAccuracy".


      Managers

      Fly Zones
      class method
      class method flyZoneManager
      + (nullable DJIFlyZoneManager *)flyZoneManager
      Header:DJISDKManager.h
      Description:

      Provide access to DJIFlyZoneManager used to manage DJI's GEO system for no fly zones.

      Return:
      nullable DJIFlyZoneManager *An instance of DJIFlyZoneManager.
      SDK Keys
      class method
      class method keyManager
      + (nullable DJIKeyManager *)keyManager
      Header:DJISDKManager.h
      Description:

      Provide access to the SDK Key interface.

      Return:
      nullable DJIKeyManager *An instance of DJIKeyManager.
      Mission Control
      class method
      class method missionControl
      + (nullable DJIMissionControl *)missionControl
      Header:DJISDKManager.h
      Description:

      Provide access to DJIMissionControl used to manage missions.

      Return:
      nullable DJIMissionControl *An instance of DJIMissionControl.
      Video Feeder
      class method
      class method videoFeeder
      + (nullable DJIVideoFeeder *)videoFeeder
      Header:DJISDKManager.h
      Description:

      Provide access to DJIVideoFeeder used to video feeder.

      Return:
      nullable DJIVideoFeeder *An instance of DJIVideoFeeder.
      Flighthub
      class method
      class method flightHubManager
      + (nullable DJIFlightHubManager *)flightHubManager
      Header:DJISDKManager.h
      Description:

      Provide access to DJIFlightHubManager. It can be used to interact with DJI FlightHub (https://www.dji.com/flighthub).

      Return:
      nullable DJIFlightHubManager *An instance of DJIFlightHubManager.


      LDM

      Local Data Mode
      class method
      class method ldmManager
      + (DJILDMManager *)ldmManager
      Header:DJISDKManager.h
      Description:

      Manages Local Data Mode (LDM) functionality. Local data mode gives the developer the option to put the SDK into airplane mode, restricting its access to the internet. See DJILDMManager for details on when and where this is possible, and what is restricted.

      Return:
      DJILDMManager *An instance of DJILDMManager.


      Data Protection

      Manages Data
      class method
      class method dataProtectionManager
      + (DJIDataProtectionManager *)dataProtectionManager
      Header:DJISDKManager.h
      Description:

      Manages data related to user's information. This class is accessible before calling registerAppWithDelegate.

      Return:
      DJIDataProtectionManager *An instance of DJIDataProtectionManager.


      UTMISS Mannager

      Manages Flight Information
      class method
      class method UTMISSManager
      + (DJIUTMISSManager *)UTMISSManager
      Header:DJISDKManager.h
      Description:

      Manages flight information to report to UTMISS (Unmanned Aircraft System Traffic Management Information Service System). This can be used only in China.

      Return:
      DJIUTMISSManager *An instance of DJIUTMISSManager.


      Connection Update
      typedef block
      typedef block DJIComponentConnectionUpdateBlock
      typedef void (^DJIComponentConnectionUpdateBlock)(NSString *componentKey, NSUInteger index, BOOL isConnected)
      Header:DJISDKManager.h
      Description:

      Called when the "component" is connected.

      Input Parameters:
      NSString * componentKeyKey of the component.
      NSUInteger indexIndex of the component.
      BOOL isConnectedComponent connection status. YES if connected, NO if disconnected.
      Registration
      typedef block
      typedef block DJIRegistrationUpdateBlock
      typedef void (^DJIRegistrationUpdateBlock)(BOOL registered, NSError *registrationError)
      Header:DJISDKManager.h
      Description:

      Callback block that is run when a registration response is received.

      Input Parameters:
      BOOL registeredYES if registration is successful. Otherwise NO.
      NSError * registrationErrornil if registration is successful. Otherwise it contains an NSError object with error codes from DJISDKRegistrationError.
      Product Connection
      typedef block
      typedef block DJIProductConnectionUpdateBlock
      typedef void (^DJIProductConnectionUpdateBlock)(DJIBaseProduct * _Nullable product)
      Header:DJISDKManager.h
      Description:

      Called when the "product" is connected.

      Input Parameters:
      DJIBaseProduct * _Nullable productProduct object. nil if the USB link or WiFi link between the product and phone is disconnected.
      define SDK_APP_KEY_INFO_PLIST_KEY
      #define SDK_APP_KEY_INFO_PLIST_KEY @"DJISDKAppKey"
      Header:DJISDKManager.h
      Description:

      To register the app, create a new key in the info.plist file where the plist key is "DJISDKAppKey" and its value is your DJI registered App key.

      State Updates
      protocol
      protocol DJISDKManagerDelegate
      @protocol DJISDKManagerDelegate <NSObject>
      Header:DJISDKManager.h
      Inherits From:NSObject
      Description:

      This protocol provides delegate methods to receive the updated registration status and the change of the connected product.

      Protocol Methods:
      SDK Registration
      method
      method appRegisteredWithError
      @required
      - (void)appRegisteredWithError:(NSError *_Nullable)error
      Header:DJISDKManager.h
      Description:

      Delegate method after the application attempts to register.

      Input Parameters:
      NSError *_Nullable errornil if registration is successful. Otherwise it contains an NSError object with error codes from DJISDKRegistrationError.
      method productConnected
      @optional
      - (void)productConnected:(DJIBaseProduct *_Nullable)product
      Header:DJISDKManager.h
      SDK Key:DJIKey.DJIParamConnection
      Description:

      Called when the "product" is connected.

      Input Parameters:
      DJIBaseProduct *_Nullable productProduct object. nil if the USB link or WiFi link between the product and phone is disconnected.
      method productDisconnected
      @optional
      - (void)productDisconnected
      Header:DJISDKManager.h
      SDK Key:DJIKey.DJIParamConnection
      Description:

      Called when the "product" is disconnected.

      method productChanged
      @optional
      - (void)productChanged:(DJIBaseProduct *_Nullable)product
      Header:DJISDKManager.h
      Description:

      Called when the connected product is changed. The product will be updated when the aircraft connected changes from only remote controller connected.

      Input Parameters:
      DJIBaseProduct *_Nullable productAn instance of DJIBaseProduct.
      method componentConnectedWithKey:andIndex
      @optional
      - (void)componentConnectedWithKey:(NSString * _Nullable)key andIndex:(NSInteger)index
      Header:DJISDKManager.h
      SDK Key:DJIKey.DJIParamConnection
      Description:

      Called when the "component" is connected.

      Input Parameters:
      NSString * _Nullable keyKey of the component.
      NSInteger indexIndex of the component.
      method componentDisconnectedWithKey:andIndex
      @optional
      - (void)componentDisconnectedWithKey:(NSString * _Nullable)key andIndex:(NSInteger)index
      Header:DJISDKManager.h
      SDK Key:DJIKey.DJIParamConnection
      Description:

      Called when the "component" is disconnected.

      Input Parameters:
      NSString * _Nullable keyKey of the component.
      NSInteger indexIndex of the component.
      method didUpdateDatabaseDownloadProgress
      @required
      - (void)didUpdateDatabaseDownloadProgress:(NSProgress *)progress
      Header:DJISDKManager.h
      Description:

      Called when Fly Safe database download progress is updated. Mobile SDK will download the database when registerAppWithDelegate is invoked. Please integrate the "DJIFlySafeDatabaseResource" bundle to the Xcode project by using Cocoapods (https://cocoapods.org/pods/DJIFlySafeDatabaseResource). Check appRegisteredWithError for updated errors.

      Input Parameters:
      NSProgress * progressThe database resource download progress.