Last active
June 2, 2017 13:28
-
-
Save nzatsepilov/5e7d9f04a09c00c1e9ef81ba63411faa to your computer and use it in GitHub Desktop.
Gps data file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gps data file | |
Структуры с клиента: | |
struct RouteHeader { | |
int32_t magic; // marker 0xFF11 | |
int32_t pointsCount; | |
}; | |
typedef struct RouteHeader RouteHeader; | |
struct __attribute__((packed)) GeoPoint { | |
int32_t timestamp; // 4 bytes | |
double latitude; // 8 bytes | |
double longitude; // 8 bytes | |
}; // total 20 bytes | |
typedef struct GeoPoint GeoPoint; | |
Структура всего файла: | |
header (RouteHeader) 8 байт | |
point_0 (GeoPoint) 20 байта | |
point_1 (GeoPoint) 20 байта | |
point_2 (GeoPoint) 20 байта | |
... | |
point_i (i = header.pointsCount) | |
лучше использовать sizeof для получения размера, на клиенте выглядит так: | |
RouteHeader header; | |
int headerSize = sizeof(header); // 8 | |
points_start = sizeof(header); | |
point_i_start = sizeof(header) + sizeof(point) * i; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment