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 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 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.
NSTimeInterval interval Interval 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.
BOOL enabled Interval 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.
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.
NSString *_Nullable orderID The order id of the flight path to fetch. NSArray<DJIFlightHubFlightPathNode *> *_Nullable nodes An array of nodes of which the flight path consists. NSError *_Nullable error Error if there is any. void (^)(NSArray<DJIFlightHubFlightPathNode *> *_Nullable nodes, NSError *_Nullable error) completion The 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.
NSTimeInterval startTime The start time of the duration (milliseconds). NSTimeInterval endTime The end time of the duration (milliseconds). NSString *_Nullable account The user account to which the statistics related. nil
to get the statistics of the whole team. NSString * teamID The ID of the team. DJIFlightHubHistoricalFlight *_Nullable flight Contains the overall statistics and the detail information for each flight included by the duration. NSError *_Nullable error Error if there is any. void (^)(DJIFlightHubHistoricalFlight *_Nullable flight, NSError *_Nullable error) completion The 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.
NSString * teamID Team ID that current aircraft is expected to bind to. DJICompletionBlock completion The 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.
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.
NSString * sn Serial number of the aircraft sourcing the live view stream. DJIFlightHubLiveStream *_Nullable stream The stream information. NSError *_Nullable error Error if there is any. void (^_Nonnull)(DJIFlightHubLiveStream *_Nullable stream, NSError *_Nullable error) completion The 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.
DJIFlightHubUpStream *_Nullable upStream The RTMP url.eam. NSError *_Nullable error Error if there is any. void (^)(DJIFlightHubUpStream *_Nullable upStream, NSError *_Nullable error) completion The 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.
BOOL stable YES
if the stream is stable.NSError *_Nullable error Error if there is any. void (^)(BOOL stable, NSError *_Nullable error) completion The 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.
NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices Devices that streaming live video. NSError *_Nullable error Error if there is any. void (^)(NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices, NSError *_Nullable error) completion The 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.
NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices The online devices. NSError *_Nullable error Error if there is any. void (^)(NSArray<DJIFlightHubOnlineDevice *> *_Nullable devices, NSError *_Nullable error) completion The 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).
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.
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.