使用 DJI UXSDKDemo 记录数据的最佳方法 (iOS)
Optimal Method to Log Data using DJI UXSDKDemo (iOS)
我想从下面的两个 类 中提取值并将它们记录在一个文件中。提取这些值的最佳方法是什么? 属性 观察员会工作并且有效吗?我是否可以使用主循环或时钟来持续调用和记录此数据?任何帮助,将不胜感激。谢谢
//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) {
}];
`
我想从下面的两个 类 中提取值并将它们记录在一个文件中。提取这些值的最佳方法是什么? 属性 观察员会工作并且有效吗?我是否可以使用主循环或时钟来持续调用和记录此数据?任何帮助,将不胜感激。谢谢
//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) {
}];
`