'How to convert NSData to a C struct and use it in Swift program
the data should be binary data, it came from a 360 camera with bluetooth or wifi link ,it will call the function when data is prepared
//ins_gyro_info binary @property (nullable, nonatomic, strong) NSData *gyroData;
struct ins_gyro_info {
int64_t timestamp; //millisecond
double gravity_x;
double gravity_y;
double gravity_z;
double rotation_x;
double rotation_y;
double rotation_z;
};
- (void)rawDataOutput:(INSCameraRawDataOutput *)rawDataOutput didOutputGyro:(NSData *)gyroData timestamp:(int64_t)timestamp;
and I wanna use this gyro info in my Swift program, the function in Swift like below
func rawDataOutput(_ rawDataOutput: INSCameraRawDataOutput, didOutputGyro gyroData: Data, timestamp: Int64)
I am hard to try stuff the data into ins_gyro_info
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
