ios - 使用 DJI UXSDKDemo (iOS) 记录数据的最佳方法

标签 ios objective-c dji-sdk

我想从下面的两个类中提取值并将它们记录在一个文件中。提取这些值的最佳方法是什么?属性(property)观察员会工作并且有效吗?是否有一个主循环或时钟可以用来持续调用和记录这些数据?任何帮助,将不胜感激。谢谢

    //IMU
EXTERN_KEY NSString *const DJIFlightControllerParamIMUState;
EXTERN_KEY NSString *const DJIFlightControllerParamIMUsCount;

EXTERN_KEY NSString *const DJIFlightControllerParamIMUStateGyroscopeState;
EXTERN_KEY NSString *const DJIFlightControllerParamIMUAccelerometerState;
EXTERN_KEY NSString *const DJIFlightControllerParamIMUStateCalibrationProgress;
EXTERN_KEY NSString *const DJIFlightControllerParamIMUStateCalibrationState;

这相关吗?
 @class DJIFlightHubManager;


/**
 *  Delegate to receive updated states related to DJI FlightHub.
 */
@protocol DJIFlightHubManagerDelegate <NSObject>


/**
 *  Updates states for the uploading progress of flight data.
 *  
 *  @param flightHubManager The FlightHub Manager updates the state.
 *  @param state The updated state. When it is `DJIFlightHubUploadStateRejectedByServer`, refer to error for more detail.
 *  @param error The returned error when the upload request is rejected by the server. Use the error to check the reason.
 */
- (void)flightHubManager:(DJIFlightHubManager *)flightHubManager didUpdateUploadState:(DJIFlightHubUploadState)state error:(nullable NSError *)error;

@end

最佳答案

在这种情况下,DJIFlighthubManager 将不相关 - 它对应于我们的 FlightHub device

对于您要写入文件的每个键,您需要先获取并监听状态,然后将数据写入文件。这是一个例子:

DJIFlightControllerKey *exampleKey = [DJIFlightControllerKey keyWithParam:DJIFlightControllerParamIMUState];

// Will get called once to get current value of the key
[[DJISDKManager keyManager] getValueForKey:exampleKey withCompletion:^(DJIKeyedValue * _Nullable value, NSError * _Nullable error) {

}];

// Called only when the value for the key changes
[[DJISDKManager keyManager] startListeningForChangesOnKey:exampleKey withListener:self andUpdateBlock:^(DJIKeyedValue * _Nullable oldValue, DJIKeyedValue * _Nullable newValue) {

}];

`

关于ios - 使用 DJI UXSDKDemo (iOS) 记录数据的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50767318/

相关文章:

ios - iOS 9 中 UILabel 中的多行文本

ios - 在 swift 中访问状态信息 - DJI Mobile SDK iOS

ios - 在 Cordova/WatchKit 应用程序上导入 MMWormhole

ios - 在 Swift 3.0 中动画完成后导航到新 View Controller

ios - 程序化嵌入转场

Objective C 中的 C++ 函数

ios - Xcode TARGET_OS_IPHONE 似乎很困惑,错误或配置错误?

ios - 选择表情符号时键盘顶部出现随机蓝色

swift - DJI Bridge App 教程 Swift 无视频流 - Phantom 4 Pro

ios - DJIFlightControllerState - 硬件时间戳