DJI Mobile SDK Documentation

      class DJIFlightHubManager

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

      The FlightHubManager class provides methods to interact with DJI FlightHub (https://www.dji.com/flighthub). SDK provides interfaces to upload the states of the connected aircraft to the FlightHub server and download the flight data from the server. To access DJI FlightHub features through SDK, the logged-in user should be already activated with a valid FlightHub license. Use isUserActivated to check if the user is activated. Note: Invoke updateActivationStateWithCompletion before using any other method to verify your accessibility.

      Class Members:
      property uploadTimeInterval
      @property(nonatomic, readonly) NSTimeInterval uploadTimeInterval
      Header:DJIFlightHubManager.h
      Description:

      Current interval for uploading real-time flight data.

      property
      property uploadState
      @property(atomic, readonly) DJIFlightHubUploadState uploadState
      Header:DJIFlightHubManager.h
      Description:

      Gets current upload state.

      See Also:

      DJIFlightHubUploadState

      property isUserActivated
      @property(atomic, readonly) BOOL isUserActivated
      Header:DJIFlightHubManager.h
      Description:

      Determines if the user has been activated. It is a cached data and it will be refreshed when updateActivationStateWithCompletion is called.

      property
      property delegate
      @property(nonatomic, weak) id<DJIFlightHubManagerDelegate> delegate
      Header:DJIFlightHubManager.h
      Description:

      Delegate to receive the updated state.

      See Also:

      DJIFlightHubManagerDelegate

      method setUploadTimeInterval
      - (nullable NSError *)setUploadTimeInterval:(NSTimeInterval)interval
      Header:DJIFlightHubManager.h
      Description:

      Sets the interval for uploading real-time flight data. By default, the interval is 5 seconds.

      Input Parameters:
      NSTimeInterval intervalInterval in seconds. The value should be in the range [1, 10].
      Return:
      nullable NSError *Error if the input is invalid.
      method setUploadEnabled
      - (void)setUploadEnabled:(BOOL)enabled
      Header:DJIFlightHubManager.h
      Description:

      Set YES to enable SDK to upload real-time flight data of the connected aircraft to DJI FlightHub server. When it is enabled, SDK will start uploading flight data automatically when the aircraft is flying. FlightHub user can access the uploaded flight data on the FlightHub online system. Stop uploading data by setting NO as parameter. Use uploadState to check current uploading state.

      Input Parameters:
      BOOL enabledInterval in seconds. The value should be in the range [1, 10].
      method updateActivationStateWithCompletion
      - (void)updateActivationStateWithCompletion:(DJICompletionBlock)completion
      Header:DJIFlightHubManager.h
      Description:

      Updates the logged-in user's activation state for DJI FlightHub. This method is only valid when the user is logged in. When the state is updated, the state will be cached to isUserActivated. Please invoke the authorizeAccessToDJIDeviceHardwareInfo to authorize DJI server to access DJI device's hardware information.

      Input Parameters:
      DJICompletionBlock completionThe completion block that receives the execution result.
      method getTeamsInformationWithCompletion
      - (void)getTeamsInformationWithCompletion:(void (^)(NSArray<DJIFlightHubTeam *> *_Nullable teams, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets the teams' information that is visible for the user.

      Input Parameters:
      NSArray<DJIFlightHubTeam *> *_Nullable teamsAn array of information for each team. It is nil if there is an error.
      NSError *_Nullable errorError if there is any.
      void (^)(NSArray<DJIFlightHubTeam *> *_Nullable teams, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method getHistoricalFlightPath:withCompletion
      - (void)getHistoricalFlightPath:(NSString *_Nullable)orderID withCompletion:(void (^)(NSArray<DJIFlightHubFlightPathNode *> *_Nullable nodes, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets the flight path nodes of a historical flight path with the specific path ID. This information is only visible for the administrator of the group and the captain of the team.

      Input Parameters:
      NSString *_Nullable orderIDThe order id of the flight path to fetch.
      NSArray<DJIFlightHubFlightPathNode *> *_Nullable nodesAn array of nodes of which the flight path consists.
      NSError *_Nullable errorError if there is any.
      void (^)(NSArray<DJIFlightHubFlightPathNode *> *_Nullable nodes, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method getFlightStatisticsWithStartTime:endTime:account:teamID:withCompletion
      - (void)getFlightStatisticsWithStartTime:(NSTimeInterval)startTime
      endTime:(NSTimeInterval)endTime
      account:(NSString *_Nullable)account
      teamID:(NSString *)teamID
      withCompletion:(void (^)(DJIFlightHubHistoricalFlight *_Nullable flight, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets flight statistics over a period of time. Specify the account to get the statistics related to one user. Otherwise, statistics for the whole team will be fetched. Only DJIFlightHubRoleAdministrator and DJIFlightHubRoleCaptain can access the flight statistics.

      Input Parameters:
      NSTimeInterval startTimeThe start time of the duration (milliseconds).
      NSTimeInterval endTimeThe end time of the duration (milliseconds).
      NSString *_Nullable accountThe user account to which the statistics related. nil to get the statistics of the whole team.
      NSString * teamIDThe ID of the team.
      DJIFlightHubHistoricalFlight *_Nullable flightContains the overall statistics and the detail information for each flight included by the duration.
      NSError *_Nullable errorError if there is any.
      void (^)(DJIFlightHubHistoricalFlight *_Nullable flight, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method bindAircraftToTeam:withCompletion
      - (void)bindAircraftToTeam:(NSString *)teamID withCompletion:(DJICompletionBlock)completion
      Header:DJIFlightHubManager.h
      Description:

      Bind the connected aircraft to DJI FlightHub system. Specify the team ID that the aircraft will belongs to.

      Input Parameters:
      NSString * teamIDTeam ID that current aircraft is expected to bind to.
      DJICompletionBlock completionThe completion block that receives the execution result.
      method unbindAircraftWithCompletion
      - (void)unbindAircraftWithCompletion:(DJICompletionBlock)completion
      Header:DJIFlightHubManager.h
      Description:

      Unbinds current aircraft from the certain team. Only DJIFlightHubRoleAdministrator and DJIFlightHubRoleCaptain can do this operation.

      Input Parameters:
      DJICompletionBlock completionThe completion block that receives the execution result.
      method getLiveViewStreamSourceWithSN:withCompletion
      - (void)getLiveViewStreamSourceWithSN:(NSString *)sn withCompletion:(void (^_Nonnull)(DJIFlightHubLiveStream *_Nullable stream, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets the live view stream sourcing by the other aircraft to DJI FlightHub. The stream is using RTMP (Real-Time Messaging Protocol). External libraries are required to decode and render the live view. Only DJIFlightHubRoleAdministrator and DJIFlightHubRoleCaptain can do this operation.

      Input Parameters:
      NSString * snSerial number of the aircraft sourcing the live view stream.
      DJIFlightHubLiveStream *_Nullable streamThe stream information.
      NSError *_Nullable errorError if there is any.
      void (^_Nonnull)(DJIFlightHubLiveStream *_Nullable stream, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method getLiveViewStreamDestinationWithCompletion
      - (void)getLiveViewStreamDestinationWithCompletion:(void (^)(DJIFlightHubUpStream *_Nullable upStream, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets RTMP (Real-Time Messaging Protocol) url that the connected aircraft should stream to.

      Input Parameters:
      DJIFlightHubUpStream *_Nullable upStreamThe RTMP url.eam.
      NSError *_Nullable errorError if there is any.
      void (^)(DJIFlightHubUpStream *_Nullable upStream, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method checkIfLiveStreamStableWithCompletion
      - (void)checkIfLiveStreamStableWithCompletion:(void (^)(BOOL stable, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Determines whether the live stream is stable from the server perspective.

      Input Parameters:
      BOOL stableYES if the stream is stable.
      NSError *_Nullable errorError if there is any.
      void (^)(BOOL stable, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method getStreamingDevicesWithCompletion
      - (void)getStreamingDevicesWithCompletion:(void (^)(NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets the list of devices streaming live video to DJI FlightHubManager.

      Input Parameters:
      NSArray<DJIFlightHubOnlineDevice *> *_Nullable devicesDevices that streaming live video.
      NSError *_Nullable errorError if there is any.
      void (^)(NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method getOnlineDevicesWithCompletion
      - (void)getOnlineDevicesWithCompletion:(void (^)(NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices, NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets the list of online devices visiable in DJI FlightHub.

      Input Parameters:
      NSArray<DJIFlightHubOnlineDevice *> *_Nullable devicesThe online devices.
      NSError *_Nullable errorError if there is any.
      void (^)(NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices, NSError *_Nullable error) completionThe completion block that receives the execution result.
      method getRealTimeDataWithSNs:withCompletion
      - (void)getRealTimeDataWithSNs:(NSArray<NSString *> *)SNs withCompletion:(void (^)(NSArray<DJIFlightHubRealTimeFlightData *> *_Nullable flightDatas,
      NSError *_Nullable error))completion
      Header:DJIFlightHubManager.h
      Description:

      Gets real time flight data of the given aircraft(s).

      Input Parameters:
      NSArray<NSString *> * SNsAn NSArray of aircrafts' serial numbers.
      NSArray<DJIFlightHubRealTimeFlightData *> *_Nullable flightDatasAn NSArray of DJIFlightHubRealTimeFlightData objects.
      NSError *_Nullable errorError if there is any.
      void (^)(NSArray<DJIFlightHubRealTimeFlightData *> *_Nullable flightDatas, NSError *_Nullable error) completionThe completion block that receives the execution result.
      const DJIFlightHubDurationRange0To5Keys
      extern NSString *const DJIFlightHubDurationRange0To5Keys
      Header:DJIFlightHubBaseTypes.h
      Description:

      The FlightHub histogram distribution of the flight durations key "0-5".

      const DJIFlightHubDurationRange5To10Keys
      extern NSString *const DJIFlightHubDurationRange5To10Keys
      Header:DJIFlightHubBaseTypes.h
      Description:

      The FlightHub histogram distribution of the flight durations key "5-10".

      const DJIFlightHubDurationRange10To15Keys
      extern NSString *const DJIFlightHubDurationRange10To15Keys
      Header:DJIFlightHubBaseTypes.h
      Description:

      The FlightHub histogram distribution of the flight durations key "10-15".

      const DJIFlightHubDurationRange15To20Keys
      extern NSString *const DJIFlightHubDurationRange15To20Keys
      Header:DJIFlightHubBaseTypes.h
      Description:

      The FlightHub histogram distribution of the flight durations key "15-20".

      const DJIFlightHubDurationRange20PlusKeys
      extern NSString *const DJIFlightHubDurationRange20PlusKeys
      Header:DJIFlightHubBaseTypes.h
      Description:

      The FlightHub histogram distribution of the flight durations key "20+".

      enum DJIFlightHubUploadState
      typedef NS_ENUM(NSUInteger, DJIFlightHubUploadState)
      Header:DJIFlightHubBaseTypes.h
      Description:

      The uploading state of the flight data for DJI FlightHub system.

      Enum Members:
      DJIFlightHubUploadStateDisabledThe uploading process is disabled.
      DJIFlightHubUploadStateNetworkNotReachableThe uploading process is enabled but it is not started because the network is not reachable.
      DJIFlightHubUploadStateNotLoggedInThe uploading process is enabled but it is not started because no account is logged in.
      DJIFlightHubUploadStateAircraftDisconnectedThe uploading process is enabled but it is not started because the aircraft is disconnected.
      DJIFlightHubUploadStateRejectedByServerThe uploading process is enabled but the uploading request is rejected by the server.
      DJIFlightHubUploadStateReadyToUploadThe uploading process is enabled and it will start when the aircraft takes off.
      DJIFlightHubUploadStateUploadingSDK is uploading flight data to DJI FlightHub system.
      DJIFlightHubUploadStateUnknownUnknown.
      enum DJIFlightHubRole
      typedef NS_ENUM(NSUInteger, DJIFlightHubRole)
      Header:DJIFlightHubBaseTypes.h
      Description:

      Different roles of members in a FlightHub group. Different roles will have different permissions to access data in the sytem.

      Enum Members:
      DJIFlightHubRoleAdministratorThe administrator is the leader of a group (a group consists of several teams). This role will appear in the member list of all the teams and this role can access all the data of the group.
      DJIFlightHubRoleCaptainA captain is the leader of a team. DJIFlightHubRoleAdministrator can define a captain for a team in the group but it is not compulsory for a team to have a captain. The captain can access the data of the team.
      DJIFlightHubRolePilotA pilot is a member in the team without special permissions.
      DJIFlightHubRoleUnknownUnknown.
      State Updates
      protocol
      protocol DJIFlightHubManagerDelegate
      @protocol DJIFlightHubManagerDelegate <NSObject>
      Header:DJIFlightHubManager.h
      Inherits From:NSObject
      Description:

      Delegate to receive updated states related to DJI FlightHub.

      Protocol Methods:

      Protocol Method

      method flightHubManager:didUpdateUploadState:error
      required
      - (void)flightHubManager:(DJIFlightHubManager *)flightHubManager didUpdateUploadState:(DJIFlightHubUploadState)state error:(nullable NSError *)error
      Header:DJIFlightHubManager.h
      Description:

      Updates states for the uploading progress of flight data.

      Input Parameters:
      DJIFlightHubManager * flightHubManagerThe FlightHub Manager updates the state.
      DJIFlightHubUploadState stateThe updated state. When it is DJIFlightHubUploadStateRejectedByServer, refer to error for more detail.
      nullable NSError * errorThe returned error when the upload request is rejected by the server. Use the error to check the reason.