我想从下面的两个类中提取值,并将它们记录在一个文件中。提取这些值的最佳方法是什么?一个属性观察者会工作并且有效吗?有没有一个主循环或时钟可以用来一致地调用和记录这些数据?任何帮助都将不胜感激。谢谢
//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
发布于 2018-06-09 05:04:54
在这种情况下,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) {
}];
`
https://stackoverflow.com/questions/50767318
复制相似问题