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 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.

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

      Registration state.

      Return:
      BOOLYES if SDK is registered.
      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 *A 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 *A instance of DJIAppActivationManager.


      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 *_NullableA 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.

      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.


      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 generated 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.


      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.
      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.


      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 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.