class DJIPayload
@interface DJIPayload : DJIBaseComponent
Description:
Class used to interact with the payload device mounted on DJI aircraft.
Class Members:
property delegate
@property (nonatomic , weak ) id <DJIPayloadDelegate> delegate
Description:
Delegate to receive the update information.
See Also:
DJIPayloadDelegate
method getUpstreamBandwidthWithCompletion
- (void )getUpstreamBandwidthWithCompletion:(void (^)(NSUInteger upstreamBandwidth, NSError * _Nullable error))completion
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.
NSUInteger upstreamBandwidth The upstream bandwidth determined by the firmware. NSError * _Nullable error Error retrieving the value. void (^)(NSUInteger upstreamBandwidth, NSError * _Nullable error) completion Completion block to receive the result.
method getPayloadProductName
- (NSString * _Nullable)getPayloadProductName
Description:
Gets the product name defined by the manufacturer of the payload device.
Return:
NSString * _Nullable The product name of the payload device.
method setSwitchState:index:withCompletion
- (void )setSwitchState:(DJIPayloadSwitchState)state index:(NSUInteger )index withCompletion:(DJICompletionBlock)completion
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.
method setRangeValue:index:withCompletion
- (void )setRangeValue:(NSUInteger )rangeValue index:(NSUInteger )index withCompletion:(DJICompletionBlock)completion
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.
NSUInteger rangeValue Range value to set. The valid range is [0, 100]. NSUInteger index Widget index to set. DJICompletionBlock completion Completion block to receive the execution result.
method setSelectedItem:index:withCompletion
- (void )setSelectedItem:(NSUInteger )selectedItemIndex index:(NSUInteger )index withCompletion:(DJICompletionBlock)completion
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.
NSUInteger selectedItemIndex Index of the selected item. The valid range is from 0 to list size - 1. NSUInteger index Widget index to set. DJICompletionBlock completion Completion block to receive the execution result.
method sendDataToPayload:withCompletion
- (void )sendDataToPayload:(NSData *)data withCompletion:(DJICompletionBlock)completion
Description:
Sends data to payload. The length of the data to send cannot exceed 32 bytes. The throughput cannot exceed the bandwidth returned by getUpstreamBandwidthWithCompletion
.
NSData * data Data that will be sent to the payload device. DJICompletionBlock completion Completion block to receive the execution result.
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
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.
DJIPayload * payload The payload instance received the command data from the payload device. NSData * data The data that received by the payload instance.
method payload:didReceiveStreamData
@optional
- (void )payload:(DJIPayload *)payload didReceiveStreamData:(NSData *)data
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.
DJIPayload * payload The payload instance received the stream data from the payload device. NSData * data The data that received by the payload instance.
method payload:didReceiveMessage
@optional
- (void )payload:(DJIPayload *)payload didReceiveMessage:(NSString *)message
Description:
Receives a text message sent from the payload device.
DJIPayload * payload The payload instance received the text message from the payload device. NSString * message The message that received by the payload instance.