DJI Mobile SDK Documentation

      class DJIPayload

      @interface DJIPayload : DJIBaseComponent
      Header:DJIPayload.h
      Inherits From:DJIBaseComponent
      Description:

      Class used to interact with the payload device mounted on DJI aircraft.

      Class Members:
      Delegate
      property
      property delegate
      @property(nonatomic, weak) id<DJIPayloadDelegate> delegate
      Header:DJIPayload.h
      Description:

      Delegate to receive the update information.

      See Also:

      DJIPayloadDelegate

      Pipe Lines
      property
      property pipelines
      @property (nonatomic, readonly) DJIPipelines *pipelines
      Header:DJIPayload.h
      Description:

      The pipelines to transmit data between DJI Payload device and DJI mobile SDK. This function does not support dual controllers scenarios. It's only supported by Matrice 300 RTK.

      See Also:

      DJIPipelines

      Upstream Bandwidth
      method
      method getUpstreamBandwidthWithCompletion
      - (void)getUpstreamBandwidthWithCompletion:(void (^)(NSUInteger upstreamBandwidth, NSError * _Nullable error))completion
      Header:DJIPayload.h
      Description:

      Gets the bandwidth of the upstream (from Mobile SDK to Payload). The unit is bytes/s. The bandwidth is determined by the firmware and currently it is not larger than 500 bytes/s.

      Input Parameters:
      NSUInteger upstreamBandwidthThe upstream bandwidth determined by the firmware.
      NSError * _Nullable errorError retrieving the value.
      void (^)(NSUInteger upstreamBandwidth, NSError * _Nullable error) completionCompletion block to receive the result.
      Product Name
      method
      method getPayloadProductName
      - (NSString * _Nullable)getPayloadProductName
      Header:DJIPayload.h
      Description:

      Gets the product name defined by the manufacturer of the payload device.

      Return:
      NSString * _NullableThe product name of the payload device.
      Check Function Limited
      method
      method isFunctionLimited
      - (BOOL)isFunctionLimited
      Header:DJIPayload.h
      Description:

      Gets if function is limited. If Payload's function is limited, it may happen because:
      - The payload is not functioning properly.
      - Skyport or X-Port is not bound.
      - The encryption chip has exception.
      - The aircraft doesn't support this Payload model.

      Return:
      BOOLYES if the product's function is limited.
      Check activation
      method
      method isActivated
      - (BOOL)isActivated
      Header:DJIPayload.h
      Description:

      Gets the product activation status.

      Return:
      BOOLYES if the product is activated.
      Check Video Streaming Channel Available
      method
      method isDJIVideoStreamingChannelAvailable
      - (BOOL)isDJIVideoStreamingChannelAvailable
      Header:DJIPayload.h
      Description:

      When it returns YES, video stream type on PSDK is set to DJI video streaming channel. Please use DJIVideoFeed in DJIVideoFeeder to receive the video data. When it returns NO, video stream type on PSDK is set to custom video streaming channel. Please use payload:didReceiveVideoData to receive custom video data.

      Return:
      BOOLYES if DJI video streaming channel is available.
      method configureWidgetValue:type:index:withCompletion
      - (void)configureWidgetValue:(NSUInteger)value type:(DJIPayloadWidgetType)type index:(NSUInteger)index withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Set the value for a widget of the payload device. Different widget types requires different value:
      - for DJIPayloadWidgetTypeInput, the input should be an unsigned 32-bit integer
      - for DJIPayloadWidgetTypeSwitch, the input should be value of DJIPayloadSwitchState
      - for DJIPayloadWidgetTypeRange, the input should be a integer from value 0 to 100
      - for DJIPayloadWidgetTypeList, the input should be a integer not larger than list size minus one.
      Widget with type DJIPayloadWidgetTypeButton is not configurable.

      Input Parameters:
      NSUInteger valueThe value to configure.
      DJIPayloadWidgetType typeType of the widget to configure.
      NSUInteger indexIndex of the widget to configure.
      DJICompletionBlock completionCompletion block to receive the execution result.
      method setSwitchState:index:withCompletion
      - (void)setSwitchState:(DJIPayloadSwitchState)state index:(NSUInteger)index withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Sets the switch state for the switch widget with the specific index. It has the same effect as configureWidgetValue:type:index:withCompletion with DJIPayloadWidgetTypeSwitch as the argument.

      Input Parameters:
      DJIPayloadSwitchState stateSwitch state to set.
      NSUInteger indexWidget index to set.
      DJICompletionBlock completionCompletion block to receive the execution result.
      method setRangeValue:index:withCompletion
      - (void)setRangeValue:(NSUInteger)rangeValue index:(NSUInteger)index withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Sets the range value for the range widget with the specific index. It has the same effect as configureWidgetValue:type:index:withCompletion with DJIPayloadWidgetTypeRange as the argument.

      Input Parameters:
      NSUInteger rangeValueRange value to set. The valid range is [0, 100].
      NSUInteger indexWidget index to set.
      DJICompletionBlock completionCompletion block to receive the execution result.
      method setSelectedItem:index:withCompletion
      - (void)setSelectedItem:(NSUInteger)selectedItemIndex index:(NSUInteger)index withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Sets the selected item index for the list widget with the specific index. It has the same effect as configureWidgetValue:type:index:withCompletion with DJIPayloadWidgetTypeList as the argument.

      Input Parameters:
      NSUInteger selectedItemIndexIndex of the selected item. The valid range is from 0 to list size - 1.
      NSUInteger indexWidget index to set.
      DJICompletionBlock completionCompletion block to receive the execution result.
      method setInputValue:index:withCompletion
      - (void)setInputValue:(NSUInteger)inputValue index:(NSUInteger)index withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Sets the input value for the input widget with the specific index. It has the same effect as configureWidgetValue:type:index:withCompletion with DJIPayloadWidgetTypeList as the argument.

      Input Parameters:
      NSUInteger inputValueInput value to set. The valid value is an unsigned 32-bit integer.
      NSUInteger indexWidget index to set.
      DJICompletionBlock completionCompletion block to receive the execution result.
      Get Widget
      method
      method getWidget:index
      - (DJIPayloadWidget * _Nullable)getWidget:(DJIPayloadWidgetType)widgetType index:(NSInteger)widgetIndex
      Header:DJIPayload.h
      Description:

      Gets a widget by specifying the widget type and the index.

      Input Parameters:
      DJIPayloadWidgetType widgetTypeWidget type to get.
      NSInteger widgetIndexWidget index to get.
      Return:
      DJIPayloadWidget * _NullableThe widget corresponding to the widget type and the index. nil if the widgets are not ready or there is no widget corresponding to the widget type and the index.
      Get Main Interface Widgets
      method
      method getMainInterfaceWidgets
      - (NSArray<DJIPayloadWidget*> * _Nullable)getMainInterfaceWidgets
      Header:DJIPayload.h
      Description:

      Gets the main interface widget list on the payload device. An empty array will be returned if the payload's data is regarded as invalid.

      Return:
      NSArray<DJIPayloadWidget*> * _NullableA list of widgets. Returns nil if no widgets are fetched.
      Get Config Interface Widgets
      method
      method getConfigInterfaceWidgets
      - (NSArray<DJIPayloadWidget*> * _Nullable)getConfigInterfaceWidgets
      Header:DJIPayload.h
      Description:

      Gets the configuration interface widget list on the payload device. An empty array will be returned if the payload's data is regarded as invalid.

      Return:
      NSArray<DJIPayloadWidget*> * _NullableA list of widgets. Returns nil if no widgets are fetched.
      method sendDataToPayload:withCompletion
      - (void)sendDataToPayload:(NSData *)data withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Sends data to payload.
      - The length of the data to send cannot exceed 32 bytes for Matrice 200 series.
      - The length of the data to send cannot exceed 128 bytes for Matrice 200 V2 series. The throughput cannot exceed the bandwidth returned by getUpstreamBandwidthWithCompletion.

      Input Parameters:
      NSData * dataData that will be sent to the payload device.
      DJICompletionBlock completionCompletion block to receive the execution result.
      method getDeviceTypeWithCompletion
      - (void)getDeviceTypeWithCompletion:(void (^)(DJIPayloadDeviceType deviceType, NSError *_Nullable error))completion
      Header:DJIPayload.h
      Description:

      Gets the device type.

      Input Parameters:
      DJIPayloadDeviceType deviceTypeAn enum value of the DJIPayloadDeviceType.
      NSError *_Nullable errorError retrieving the value.
      void (^)(DJIPayloadDeviceType deviceType, NSError *_Nullable error) completionCompletion block to receive the execution result.
      method getProductPhaseWithCompletion
      - (void)getProductPhaseWithCompletion:(void (^)(DJIPayloadProductPhase mode, NSError *_Nullable error))completion
      Header:DJIPayload.h
      Description:

      Gets current payload product phase.

      Input Parameters:
      DJIPayloadProductPhase modeAn enum value of the DJIPayloadProductPhase.
      NSError *_Nullable errorError retrieving the value.
      void (^)(DJIPayloadProductPhase mode, NSError *_Nullable error) completionCompletion block to receive the execution result.
      General
      class
      State Updates
      protocol
      protocol DJIPayloadDelegate
      @protocol DJIPayloadDelegate <NSObject>
      Header:DJIPayload.h
      Inherits From:NSObject
      Description:

      Delegate class to receive updated state related to Payload.

      Protocol Methods:

      Protocol Method

      method payload:didReceiveCommandData
      @optional
      - (void)payload:(DJIPayload *)payload didReceiveCommandData:(NSData *)data
      Header:DJIPayload.h
      Description:

      Receives the command data sent from the payload device. The command data is sent from the UART/CAN channel of the payload device and the bandwidth of this channel is 3K bytes/s on M200 series.

      Input Parameters:
      DJIPayload * payloadThe payload instance received the command data from the payload device.
      NSData * dataThe data that received by the payload instance.
      method payload:didReceiveStreamData
      @optional
      - (void)payload:(DJIPayload *)payload didReceiveStreamData:(NSData *)data
      Header:DJIPayload.h
      Description:

      Receives the stream data sent from the payload device. The stream data is sent from the UDP channel of the payload device. This channel has wider bandwidth than the channel for command data but data might get lost without re-transmission.

      Input Parameters:
      DJIPayload * payloadThe payload instance received the stream data from the payload device.
      NSData * dataThe data that received by the payload instance.
      method payload:didReceiveVideoData
      @optional
      - (void)payload:(DJIPayload *)payload didReceiveVideoData:(NSData *)data
      Header:DJIPayload.h
      Description:

      Receives the video data sent from the payload device. The data may be live view or playback. Only supported by Matrice 300 RTK.

      Input Parameters:
      DJIPayload * payloadThe payload instance received the video data from the payload device.
      NSData * dataThe video data that received by the payload instance.
      method payload:didReceiveMessage
      @optional
      - (void)payload:(DJIPayload *)payload didReceiveMessage:(NSString *)message
      Header:DJIPayload.h
      Description:

      Receives a text message sent from the payload device.

      Input Parameters:
      DJIPayload * payloadThe payload instance received the text message from the payload device.
      NSString * messageThe message that received by the payload instance.
      method payload:didUpdateMainInterfaceWidgets
      @optional
      - (void)payload:(DJIPayload *)payload didUpdateMainInterfaceWidgets:(NSArray<DJIPayloadWidget*> *)widgets
      Header:DJIPayload.h
      Description:

      Updates a set of payload shortcuts in main interface. if the pay load's data is invalid, an empty array will be updated. It is only supported by DJI Skyport 2.0 and DJI X-Port.

      Input Parameters:
      DJIPayload * payloadThe payload instance received the updated widget values.
      NSArray<DJIPayloadWidget*> * widgetsThe updated value for widgets.
      method payload:didUpdateConfigInterfaceWidgets
      @optional
      - (void)payload:(DJIPayload *)payload didUpdateConfigInterfaceWidgets:(NSArray<DJIPayloadWidget*> *)widgets
      Header:DJIPayload.h
      Description:

      Updates setting for payload widgets. If the pay load's data is invalid, an empty array will be updated.

      Input Parameters:
      DJIPayload * payloadThe payload instance received the updated widget values.
      NSArray<DJIPayloadWidget*> * widgetsThe updated value for widgets.
      typedef block DJIPayloadFetchWidgetConfigurationProgressBlock
      typedef void (^_Nullable DJIPayloadFetchWidgetConfigurationProgressBlock)(NSProgress  * _Nullable progress)
      Header:DJIPayload.h
      Description:

      Called when fetching widget data is in progress.

      Input Parameters:
      NSProgress * _Nullable progressAn object of NSProgress.
      typedef block DJIPayloadFetchWidgetConfigurationSuccessBlock
      typedef void (^_Nullable DJIPayloadFetchWidgetConfigurationSuccessBlock)()
      Header:DJIPayload.h
      Description:

      Called when fetching widget data successful. An array of DJIPayloadWidget will be returned.

      typedef block DJIPayloadFetchWidgetConfigurationFailureBlock
      typedef void (^_Nullable DJIPayloadFetchWidgetConfigurationFailureBlock)(NSError  * _Nullable error)
      Header:DJIPayload.h
      Description:

      Called when fetching widget data failed. Error indicating the reason will be returned.

      Input Parameters:
      NSError * _Nullable errorError retrieving the value.
      method fetchWidgetConfigurationWithProgress:success:failure
      - (void)fetchWidgetConfigurationWithProgress:(DJIPayloadFetchWidgetConfigurationProgressBlock)progressBlock
      success:(DJIPayloadFetchWidgetConfigurationSuccessBlock)successBlock
      failure:(DJIPayloadFetchWidgetConfigurationFailureBlock)failureBlock
      Header:DJIPayload.h
      Description:

      Fetches widget configuration. Mobile SDK will fetch the configuration when it first launches. Returns nil if initial fetching failed. It is only supported by DJI SKYPORT 2.0.

      Input Parameters:
      DJIPayloadFetchWidgetConfigurationProgressBlock progressBlockUpdates the fetching progress.
      DJIPayloadFetchWidgetConfigurationSuccessBlock successBlockCalled when the task finishes successfully.
      DJIPayloadFetchWidgetConfigurationFailureBlock failureBlockCalled when the task is interrupted by an error.
      method setPayloadChannelPriority:onPhysicalSource:withCompletion
      - (void)setPayloadChannelPriority:(DJIVideoFeedPriority)priority
      onPhysicalSource:(DJIVideoFeedPhysicalSource)physicalSource
      withCompletion:(DJICompletionBlock)completion
      Header:DJIPayload.h
      Description:

      Set the channel priority of the payload. Priority will affect the bandwidth allocation if it is not DJIVideoFeedPriorityUnknown, which is the default value. For example, if the data that comes from the payload device mounted on left gimbal is preferred, please set the priority to DJIVideoFeedPriorityHigh, and physicalSource is DJIVideoFeedPhysicalSourceLeftCamera. The others should be set to DJIVideoFeedPriorityMedium or DJIVideoFeedPriorityLow. Only supported by Matrice 300 RTK.

      Input Parameters:
      DJIVideoFeedPriority priorityThe priority to be set, see DJIVideoFeedPriority.
      DJIVideoFeedPhysicalSource physicalSourceSee DJIVideoFeedPhysicalSource.
      DJICompletionBlock completionCompletion block to receive the execution result.
      method getPayloadChannelPriorityOnPhysicalSource:withCompletion
      - (void)getPayloadChannelPriorityOnPhysicalSource:(DJIVideoFeedPhysicalSource)physicalSource withCompletion:(void (^)(DJIVideoFeedPriority priority, NSError *_Nullable error))completion
      Header:DJIPayload.h
      Description:

      Get the channel priority of the payload. Only supported by Matrice 300 RTK.

      Input Parameters:
      DJIVideoFeedPhysicalSource physicalSourceSee DJIVideoFeedPhysicalSource.
      DJIVideoFeedPriority priorityAn enum value of DJIVideoFeedPriority.
      NSError *_Nullable errorError retrieving the value.
      void (^)(DJIVideoFeedPriority priority, NSError *_Nullable error) completionCompletion block to receive the execution result.
      enum DJIPayloadProductPhase
      typedef NS_ENUM(uint8_t, DJIPayloadProductPhase)
      Header:DJIPayloadBaseTypes.h
      Description:

      Development phase has more settings than product phase, including control parameters auto-tuning, coaxiality detection, balance detection, stiffness adjustment. Please note that this phase should be used with DJI Assistant 2, which has bound with Payload SDK developer account. Product phase means that the product is in the stage ready to sell. During this stage, development settings, i.e., control parameters auto-tuning, coaxiality detection, balance detection, stiffness adjustment, should be hidden from user interface.

      Enum Members:
      DJIPayloadProductPhaseDevelopmentThe product is in the development phase.
      DJIPayloadProductPhaseReleaseThe product is in the release phase.
      DJIPayloadProductPhaseUnknownUnknown.
      enum DJIPayloadDeviceType
      typedef NS_ENUM(uint8_t, DJIPayloadDeviceType)
      Header:DJIPayloadBaseTypes.h
      Description:

      All the possible mode of DJIPayloadDeviceType.

      Enum Members:
      DJIPayloadDeviceType_DJI_Skyport_1DJI Skyport 1.0.
      DJIPayloadDeviceType_DJI_Skyport_2DJI Skyport 2.0.
      DJIPayloadDeviceType_DJI_X_PortDJI X-Port.
      DJIPayloadDeviceTypeUnknownUnknown.