This repository has been archived by the owner on Oct 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OM200HeaderFile.h
105 lines (80 loc) · 3.14 KB
/
OM200HeaderFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef ONMOVE200_HEADER_FILE
#define ONMOVE200_HEADER_FILE
#include <stdint.h>
typedef struct {
//all numbers are little endian
//field sizes for all "unknown*" are guesses
//start of file (0x0): general statistics
uint32_t distance; /** distance in meters */
uint16_t duration; /** duration in seconds */
uint16_t speed; /** average speed in decameters per hour = km/h * 100 */
uint16_t peakSpeed; /** maximum speed in decameters per hour */
uint16_t energy; /** energy burned in kcal */
uint8_t heartRate;
uint8_t peakHeartRate;
//0xE here: time of workout start
uint8_t year; /** 2 digit format -- century not stored */
uint8_t month; //self explanatory
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t fileNumber1; //assigned sequentially
//0x14 here, three (?) significative bytes that don't matter to the watch and lotsa padding
uint16_t unknown1; // no idea at all
uint8_t gpsOff;
uint16_t unknown2;
uint16_t unknown3;
uint16_t unknown4;
uint16_t unknown5;
uint16_t unknown6;
uint16_t unknown7;
uint16_t unknown8;
//0x26 here
uint8_t fileNumber2; //assigned sequentially
uint8_t magicMarker1; //must be 0xFA
//0x28 here, this section likely deals with the "target" feature as it's only nonzero in the one file I screwed with it during its recording; my match-noted-down-values research shows that stored values are those set just before stopping
//from user manual, one of these should be "% of {time|distance\who knows} target was met"
uint16_t targetTimeUndershot;
uint16_t targetTimeOK;
uint16_t targetTimeOvershot;
uint16_t targetSpeedMinimum;
uint16_t targetSpeedMaximum;
uint8_t targetHeartRateMinimum;
uint8_t targetHeartRateMaximum;
uint8_t targetMode;
//0x35, padding again
uint8_t unknown15;
uint16_t unknown16;
uint16_t unknown17;
uint8_t fileNumber3; /** should equal "fileNumber1" */
uint8_t magicMarker2; /** must be 0xF0 */
//End of file
//phew!
} OMHFile;
/** Verify some assumptions intrinsic to the format:
* returns 1|2 if first|second magic check fails,
* 6|7 if the copies of the sequential number differ */
int isRealisticallyOMH(OMHFile *header);
/** Returns booleanly whether GPS data was recorded */
int wasGpsEnabled(OMHFile *header);
/** Returns distance walked. */
inline unsigned int getDistanceMeters(OMHFile *header);
inline float getDistanceKilometers(OMHFile *header);
/** Returns average speed. */
inline float getSpeedKilometersPerHour(OMHFile *header);
inline float getMaxSpeedKilometersPerHour(OMHFile *header);
/** Returns energy consumed */
inline unsigned int getKilocaloriesBurned(OMHFile *header);
/** Returns start time */
inline unsigned int getYear(OMHFile *header);
inline unsigned int getMonth(OMHFile *header);
inline unsigned int getDay(OMHFile *header);
inline unsigned int getHour(OMHFile *header);
inline unsigned int getMinute(OMHFile *header);
/** Returns activity duration */
inline unsigned long getDurationSeconds(OMHFile *header);
/** Returns average heart rate */
inline unsigned int getHeartRate(OMHFile *header);
/** Returns maximum heart rate */
inline unsigned int getMaxHeartRate(OMHFile *header);
#endif