rubyfit 0.0.11 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rubyfit/fit.c +418 -412
- data/ext/rubyfit/fit.h +397 -380
- data/ext/rubyfit/fit_config.h +37 -36
- data/ext/rubyfit/fit_convert.c +619 -596
- data/ext/rubyfit/fit_convert.h +213 -203
- data/ext/rubyfit/fit_crc.c +67 -67
- data/ext/rubyfit/fit_crc.h +42 -42
- data/ext/rubyfit/fit_example.c +1512 -1431
- data/ext/rubyfit/fit_example.h +8000 -6147
- data/ext/rubyfit/fit_include.h +19 -19
- data/ext/rubyfit/fit_ram.c +211 -203
- data/ext/rubyfit/fit_ram.h +44 -39
- data/ext/rubyfit/rubyfit.c +560 -566
- data/lib/rubyfit/version.rb +1 -1
- metadata +3 -3
data/ext/rubyfit/fit.h
CHANGED
@@ -1,380 +1,397 @@
|
|
1
|
-
////////////////////////////////////////////////////////////////////////////////
|
2
|
-
// The following FIT Protocol software provided may be used with FIT protocol
|
3
|
-
// devices only and remains the copyrighted property of
|
4
|
-
// The software is being provided on an "as-is" basis and as an accommodation,
|
5
|
-
// and therefore all warranties, representations, or guarantees of any kind
|
6
|
-
// (whether express, implied or statutory) including, without limitation,
|
7
|
-
// warranties of merchantability, non-infringement, or fitness for a particular
|
8
|
-
// purpose, are specifically disclaimed.
|
9
|
-
//
|
10
|
-
// Copyright
|
11
|
-
////////////////////////////////////////////////////////////////////////////////
|
12
|
-
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
|
13
|
-
// Profile Version =
|
14
|
-
// Tag = production/akw/
|
15
|
-
// Product = EXAMPLE
|
16
|
-
// Alignment = 4 bytes, padding disabled.
|
17
|
-
////////////////////////////////////////////////////////////////////////////////
|
18
|
-
|
19
|
-
|
20
|
-
#if !defined(FIT_H)
|
21
|
-
#define FIT_H
|
22
|
-
|
23
|
-
#include "fit_config.h"
|
24
|
-
|
25
|
-
#if defined(FIT_USE_STDINT_H)
|
26
|
-
#include <stdint.h>
|
27
|
-
#else
|
28
|
-
typedef unsigned char uint8_t;
|
29
|
-
typedef signed char int8_t;
|
30
|
-
typedef unsigned short uint16_t;
|
31
|
-
typedef signed short int16_t;
|
32
|
-
typedef unsigned long uint32_t;
|
33
|
-
typedef signed long int32_t;
|
34
|
-
typedef signed long long int64_t;
|
35
|
-
typedef unsigned long long uint64_t;
|
36
|
-
#endif
|
37
|
-
|
38
|
-
#if defined(__cplusplus)
|
39
|
-
extern "C" {
|
40
|
-
#endif
|
41
|
-
|
42
|
-
|
43
|
-
///////////////////////////////////////////////////////////////////////
|
44
|
-
// Version
|
45
|
-
///////////////////////////////////////////////////////////////////////
|
46
|
-
|
47
|
-
#define FIT_PROTOCOL_VERSION_10 ( ( FIT_UINT8 )( 1 << FIT_PROTOCOL_VERSION_MAJOR_SHIFT ) | 0 )
|
48
|
-
#define FIT_PROTOCOL_VERSION_20 ( ( FIT_UINT8 )( 2 << FIT_PROTOCOL_VERSION_MAJOR_SHIFT ) | 0 )
|
49
|
-
|
50
|
-
#if !defined(FIT_CPP_INCLUDE_C)
|
51
|
-
#define FIT_PROTOCOL_VERSION_MAJOR(version) ( ( FIT_UINT8 )( version >> FIT_PROTOCOL_VERSION_MAJOR_SHIFT ) )
|
52
|
-
#define FIT_PROTOCOL_VERSION_MINOR(version) ( ( FIT_UINT8 )( version & FIT_PROTOCOL_VERSION_MINOR_MASK ) )
|
53
|
-
#define FIT_PROTOCOL_VERSION_MAJOR_SHIFT 4
|
54
|
-
#define FIT_PROTOCOL_VERSION_MAJOR_MASK ((FIT_UINT8) (0x0F << FIT_PROTOCOL_VERSION_MAJOR_SHIFT))
|
55
|
-
#define FIT_PROTOCOL_VERSION_MINOR_MASK ((FIT_UINT8) 0x0F)
|
56
|
-
|
57
|
-
// Deprecated.
|
58
|
-
#define FIT_PROTOCOL_VERSION FIT_PROTOCOL_VERSION_10
|
59
|
-
|
60
|
-
#define FIT_PROTOCOL_VERSION_MAX FIT_PROTOCOL_VERSION_20
|
61
|
-
|
62
|
-
#define FIT_PROFILE_VERSION_MAJOR
|
63
|
-
#define FIT_PROFILE_VERSION_MINOR
|
64
|
-
#define FIT_PROFILE_VERSION_SCALE 100
|
65
|
-
#define FIT_PROFILE_VERSION ((FIT_UINT16) (FIT_PROFILE_VERSION_MAJOR * 100 + FIT_PROFILE_VERSION_MINOR))
|
66
|
-
#endif // !defined(FIT_CPP_INCLUDE_C)
|
67
|
-
|
68
|
-
///////////////////////////////////////////////////////////////////////
|
69
|
-
// Type Definitions
|
70
|
-
///////////////////////////////////////////////////////////////////////
|
71
|
-
|
72
|
-
#define FIT_ANTFS_FILE_DATA_TYPE 128
|
73
|
-
|
74
|
-
#define FIT_BASE_TYPE_ENDIAN_FLAG ((FIT_UINT8)0x80)
|
75
|
-
#define FIT_BASE_TYPE_RESERVED ((FIT_UINT8)0x60)
|
76
|
-
#define FIT_BASE_TYPE_NUM_MASK ((FIT_UINT8)0x1F)
|
77
|
-
|
78
|
-
typedef uint8_t FIT_ENUM;
|
79
|
-
typedef const FIT_ENUM * FIT_CONST_ENUM_PTR;
|
80
|
-
#define FIT_ENUM_INVALID ((FIT_ENUM)0xFF)
|
81
|
-
#define FIT_BASE_TYPE_ENUM ((FIT_UINT8)0x00)
|
82
|
-
|
83
|
-
typedef int8_t FIT_SINT8;
|
84
|
-
typedef const FIT_SINT8 * FIT_CONST_SINT8_PTR;
|
85
|
-
#define FIT_SINT8_INVALID ((FIT_SINT8)0x7F)
|
86
|
-
#define FIT_BASE_TYPE_SINT8 ((FIT_UINT8)0x01)
|
87
|
-
|
88
|
-
typedef uint8_t FIT_UINT8;
|
89
|
-
typedef const FIT_UINT8 * FIT_CONST_UINT8_PTR;
|
90
|
-
#define FIT_UINT8_INVALID ((FIT_UINT8)0xFF)
|
91
|
-
#define FIT_BASE_TYPE_UINT8 ((FIT_UINT8)0x02)
|
92
|
-
|
93
|
-
typedef int16_t FIT_SINT16;
|
94
|
-
typedef const FIT_SINT16 * FIT_CONST_SINT16_PTR;
|
95
|
-
#define FIT_SINT16_INVALID ((FIT_SINT16)0x7FFF)
|
96
|
-
#define FIT_BASE_TYPE_SINT16 ((FIT_UINT8)0x83)
|
97
|
-
|
98
|
-
typedef uint16_t FIT_UINT16;
|
99
|
-
typedef const FIT_UINT16 * FIT_CONST_UINT16_PTR;
|
100
|
-
#define FIT_UINT16_INVALID ((FIT_UINT16)0xFFFF)
|
101
|
-
#define FIT_BASE_TYPE_UINT16 ((FIT_UINT8)0x84)
|
102
|
-
|
103
|
-
typedef int32_t FIT_SINT32;
|
104
|
-
typedef const FIT_SINT32 * FIT_CONST_SINT32_PTR;
|
105
|
-
#define FIT_SINT32_INVALID ((FIT_SINT32)0x7FFFFFFF)
|
106
|
-
#define FIT_BASE_TYPE_SINT32 ((FIT_UINT8)0x85)
|
107
|
-
|
108
|
-
typedef uint32_t FIT_UINT32;
|
109
|
-
typedef const FIT_UINT32 * FIT_CONST_UINT32_PTR;
|
110
|
-
#define FIT_UINT32_INVALID ((FIT_UINT32)0xFFFFFFFF)
|
111
|
-
#define FIT_BASE_TYPE_UINT32 ((FIT_UINT8)0x86)
|
112
|
-
|
113
|
-
typedef char FIT_STRING; // UTF-8 null terminated string
|
114
|
-
typedef const FIT_STRING * FIT_CONST_STRING_PTR;
|
115
|
-
#define FIT_STRING_INVALID ((FIT_STRING)0x00)
|
116
|
-
#define FIT_BASE_TYPE_STRING ((FIT_UINT8)0x07)
|
117
|
-
|
118
|
-
#if !defined(FIT_CPP_INCLUDE_C)
|
119
|
-
typedef float FIT_FLOAT32;
|
120
|
-
typedef const FIT_FLOAT32 * FIT_CONST_FLOAT32_PTR;
|
121
|
-
#define FIT_FLOAT32_INVALID ((FIT_FLOAT32)*((FIT_FLOAT32*)fit_base_type_invalids[FIT_BASE_TYPE_FLOAT32 & FIT_BASE_TYPE_NUM_MASK]))
|
122
|
-
#define FIT_BASE_TYPE_FLOAT32 ((FIT_UINT8)0x88)
|
123
|
-
|
124
|
-
typedef double FIT_FLOAT64;
|
125
|
-
typedef const FIT_FLOAT64 * FIT_CONST_FLOAT64_PTR;
|
126
|
-
#define FIT_FLOAT64_INVALID ((FIT_FLOAT64)*((FIT_FLOAT64*)fit_base_type_invalids[FIT_BASE_TYPE_FLOAT64 & FIT_BASE_TYPE_NUM_MASK]))
|
127
|
-
#define FIT_BASE_TYPE_FLOAT64 ((FIT_UINT8)0x89)
|
128
|
-
#endif // !defined(FIT_CPP_INCLUDE_C)
|
129
|
-
|
130
|
-
typedef uint8_t FIT_UINT8Z;
|
131
|
-
typedef const FIT_UINT8Z * FIT_CONST_UINT8Z_PTR;
|
132
|
-
#define FIT_UINT8Z_INVALID ((FIT_UINT8Z)0x00)
|
133
|
-
#define FIT_BASE_TYPE_UINT8Z ((FIT_UINT8)0x0A)
|
134
|
-
|
135
|
-
typedef uint16_t FIT_UINT16Z;
|
136
|
-
typedef const FIT_UINT16Z * FIT_CONST_UINT16Z_PTR;
|
137
|
-
#define FIT_UINT16Z_INVALID ((FIT_UINT16Z)0x0000)
|
138
|
-
#define FIT_BASE_TYPE_UINT16Z ((FIT_UINT8)0x8B)
|
139
|
-
|
140
|
-
typedef uint32_t FIT_UINT32Z;
|
141
|
-
typedef const FIT_UINT32Z * FIT_CONST_UINT32Z_PTR;
|
142
|
-
#define FIT_UINT32Z_INVALID ((FIT_UINT32Z)0x00000000)
|
143
|
-
#define FIT_BASE_TYPE_UINT32Z ((FIT_UINT8)0x8C)
|
144
|
-
|
145
|
-
typedef uint8_t FIT_BYTE;
|
146
|
-
typedef const FIT_BYTE * FIT_CONST_BYTE_PTR;
|
147
|
-
#define FIT_BYTE_INVALID ((FIT_BYTE)0xFF) // Field is invalid if all bytes are invalid.
|
148
|
-
#define FIT_BASE_TYPE_BYTE ((FIT_UINT8)0x0D)
|
149
|
-
|
150
|
-
typedef int64_t FIT_SINT64;
|
151
|
-
typedef const FIT_SINT64 * FIT_CONST_SINT64_PTR;
|
152
|
-
#define FIT_SINT64_INVALID ((FIT_SINT64)0x7FFFFFFFFFFFFFFFL)
|
153
|
-
#define FIT_BASE_TYPE_SINT64 ((FIT_UINT8)0x8E)
|
154
|
-
|
155
|
-
typedef uint64_t FIT_UINT64;
|
156
|
-
typedef const FIT_UINT64 * FIT_CONST_UINT64_PTR;
|
157
|
-
#define FIT_UINT64_INVALID ((FIT_UINT64)0xFFFFFFFFFFFFFFFFL)
|
158
|
-
#define FIT_BASE_TYPE_UINT64 ((FIT_UINT8)0x8F)
|
159
|
-
|
160
|
-
typedef uint64_t FIT_UINT64Z;
|
161
|
-
typedef const FIT_UINT64Z * FIT_CONST_UINT64Z_PTR;
|
162
|
-
#define FIT_UINT64Z_INVALID ((FIT_UINT64Z)0x0000000000000000L)
|
163
|
-
#define FIT_BASE_TYPE_UINT64Z ((FIT_UINT8)0x90)
|
164
|
-
|
165
|
-
#define FIT_BASE_TYPES 17
|
166
|
-
|
167
|
-
typedef FIT_ENUM FIT_BOOL;
|
168
|
-
#define FIT_BOOL_INVALID FIT_ENUM_INVALID
|
169
|
-
#define FIT_BOOL_FALSE ((FIT_BOOL)0)
|
170
|
-
#define FIT_BOOL_TRUE ((FIT_BOOL)1)
|
171
|
-
#define FIT_FALSE FIT_BOOL_FALSE
|
172
|
-
#define FIT_TRUE FIT_BOOL_TRUE
|
173
|
-
#define FIT_NULL 0
|
174
|
-
|
175
|
-
typedef FIT_UINT32 (*FIT_READ_BYTES_FUNC)(void *, FIT_UINT32, FIT_UINT32);
|
176
|
-
#define FIT_MESG_DEF_HEADER_SIZE FIT_STRUCT_OFFSET(fields, FIT_MESG_DEF)
|
177
|
-
|
178
|
-
|
179
|
-
///////////////////////////////////////////////////////////////////////
|
180
|
-
// File Header
|
181
|
-
///////////////////////////////////////////////////////////////////////
|
182
|
-
|
183
|
-
typedef struct
|
184
|
-
{
|
185
|
-
FIT_UINT8 header_size; // FIT_FILE_HDR_SIZE (size of this structure)
|
186
|
-
FIT_UINT8 protocol_version; // FIT_PROTOCOL_VERSION
|
187
|
-
FIT_UINT16 profile_version; // FIT_PROFILE_VERSION
|
188
|
-
FIT_UINT32 data_size; // Does not include file header or crc. Little endian format.
|
189
|
-
FIT_UINT8 data_type[4]; // ".FIT"
|
190
|
-
FIT_UINT16 crc; // CRC of this file header in little endian format.
|
191
|
-
} FIT_FILE_HDR;
|
192
|
-
|
193
|
-
#define FIT_FILE_HDR_SIZE 14
|
194
|
-
#define FIT_FILE_CRC_SIZE 2
|
195
|
-
|
196
|
-
|
197
|
-
///////////////////////////////////////////////////////////////////////
|
198
|
-
// Record Definitions
|
199
|
-
///////////////////////////////////////////////////////////////////////
|
200
|
-
|
201
|
-
#define FIT_HDR_SIZE 1
|
202
|
-
#define FIT_HDR_TIME_REC_BIT ((FIT_UINT8) 0x80)
|
203
|
-
#define FIT_HDR_TIME_TYPE_MASK ((FIT_UINT8) 0x60)
|
204
|
-
#define FIT_HDR_TIME_TYPE_SHIFT 5
|
205
|
-
#define FIT_HDR_TIME_OFFSET_MASK ((FIT_UINT8) 0x1F)
|
206
|
-
#define FIT_HDR_TYPE_DEF_BIT ((FIT_UINT8) 0x40)
|
207
|
-
#define FIT_HDR_DEV_DATA_BIT ((FIT_UINT8) 0x20)
|
208
|
-
#define FIT_HDR_TYPE_MASK ((FIT_UINT8) 0x0F)
|
209
|
-
#define FIT_MAX_LOCAL_MESGS (FIT_HDR_TYPE_MASK + 1)
|
210
|
-
|
211
|
-
///////////////////////////////////////////////////////////////////////
|
212
|
-
// File Definitions
|
213
|
-
///////////////////////////////////////////////////////////////////////
|
214
|
-
|
215
|
-
typedef struct
|
216
|
-
{
|
217
|
-
FIT_UINT32 def_file_offset;
|
218
|
-
FIT_UINT32 data_file_offset;
|
219
|
-
FIT_UINT16 num;
|
220
|
-
FIT_UINT16 count;
|
221
|
-
FIT_UINT16 mesg;
|
222
|
-
} FIT_FILE_MESG;
|
223
|
-
|
224
|
-
typedef struct
|
225
|
-
{
|
226
|
-
FIT_UINT32 data_size;
|
227
|
-
const FIT_FILE_MESG *mesgs;
|
228
|
-
FIT_UINT16 mesg_count;
|
229
|
-
FIT_UINT8 type;
|
230
|
-
FIT_UINT8 count;
|
231
|
-
} FIT_FILE_DEF;
|
232
|
-
|
233
|
-
|
234
|
-
///////////////////////////////////////////////////////////////////////
|
235
|
-
// Message Definitions
|
236
|
-
///////////////////////////////////////////////////////////////////////
|
237
|
-
|
238
|
-
typedef struct
|
239
|
-
{
|
240
|
-
FIT_UINT8 field_def_num;
|
241
|
-
FIT_UINT8 size;
|
242
|
-
FIT_UINT8 base_type;
|
243
|
-
} FIT_FIELD_DEF;
|
244
|
-
|
245
|
-
#define FIT_FIELD_DEF_SIZE 3
|
246
|
-
|
247
|
-
typedef struct
|
248
|
-
{
|
249
|
-
FIT_UINT8 def_num;
|
250
|
-
FIT_UINT8 size;
|
251
|
-
FIT_UINT8 dev_index;
|
252
|
-
} FIT_DEV_FIELD_DEF;
|
253
|
-
|
254
|
-
#define FIT_DEV_FIELD_DEF_SIZE 3
|
255
|
-
|
256
|
-
typedef struct
|
257
|
-
{
|
258
|
-
FIT_UINT8 reserved_1;
|
259
|
-
FIT_UINT8 arch;
|
260
|
-
FIT_UINT16 global_mesg_num;
|
261
|
-
FIT_UINT8 num_fields;
|
262
|
-
FIT_UINT8 fields[1];
|
263
|
-
} FIT_MESG_DEF;
|
264
|
-
|
265
|
-
#define FIT_MAX_MESG_SIZE ((
|
266
|
-
|
267
|
-
#define FIT_ARCH_ENDIAN_MASK ((FIT_UINT8)0x01)
|
268
|
-
#define FIT_ARCH_ENDIAN_LITTLE 0
|
269
|
-
#define FIT_ARCH_ENDIAN_BIG 1
|
270
|
-
|
271
|
-
|
272
|
-
///////////////////////////////////////////////////////////////////////
|
273
|
-
// Field Definitions
|
274
|
-
///////////////////////////////////////////////////////////////////////
|
275
|
-
|
276
|
-
#define FIT_MAX_FIELD_SIZE ((FIT_UINT8)255)
|
277
|
-
#define FIT_FIELD_NUM_INVALID ((FIT_UINT8)0xFF)
|
278
|
-
#define FIT_FIELD_NUM_MESSAGE_INDEX ((FIT_UINT8)254)
|
279
|
-
#define FIT_FIELD_NUM_TIMESTAMP ((FIT_UINT8)253)
|
280
|
-
|
281
|
-
#define FIT_MESSAGE_INDEX_FIELD_NUM FIT_FIELD_NUM_MESSAGE_INDEX // For reverse compatibility only. Use FIT_FIELD_NUM_MESSAGE_INDEX instead.
|
282
|
-
#define FIT_TIMESTAMP_FIELD_NUM FIT_FIELD_NUM_TIMESTAMP // For reverse compatibility only. Use FIT_FIELD_NUM_TIMESTAMP instead.
|
283
|
-
|
284
|
-
|
285
|
-
///////////////////////////////////////////////////////////////////////
|
286
|
-
// Macros
|
287
|
-
///////////////////////////////////////////////////////////////////////
|
288
|
-
|
289
|
-
#define FIT_STRUCT_OFFSET(MEMBER, STRUCT_TYPE) ( ((FIT_UINT8 *) &(((STRUCT_TYPE *) FIT_NULL)->MEMBER)) - ((FIT_UINT8 *) (FIT_NULL)) ) // Computes the byte offset of a member in a file. Compiles to a constant.
|
290
|
-
|
291
|
-
#define FIT_MESG_DEF_FIELD_OFFSET(FIELD_MEMBER, FIELD_INDEX) (FIT_STRUCT_OFFSET(FIELD_MEMBER, FIT_FIELD_DEF) + FIT_FIELD_DEF_SIZE * FIELD_INDEX) // Computes the byte offset of a field definition member. Compiles to a constant.
|
292
|
-
|
293
|
-
// Offset of message in file including file header.
|
294
|
-
#define FIT_MESG_OFFSET(MESG_MEMBER, MESG_INDEX, MESG_SIZE, FILE) (FIT_STRUCT_OFFSET(MESG_MEMBER, FILE) + MESG_INDEX * (FIT_HDR_SIZE + MESG_SIZE) + FIT_HDR_SIZE) // Computes the byte offset of a message in a file structure. Compiles to a constant.
|
295
|
-
#define FIT_MESG_DEF_OFFSET(MESG_DEF_MEMBER, FILE) (FIT_STRUCT_OFFSET(MESG_DEF_MEMBER, FILE) + FIT_HDR_SIZE) // Computes the byte offset of a message definition in a file structure. Compiles to a constant.
|
296
|
-
|
297
|
-
// Below macros are obsolete because C file structures now include file header. For reverse compatibility only.
|
298
|
-
#define FIT_FILE_MESG_OFFSET(MESG_MEMBER, MESG_INDEX, MESG_SIZE, FILE) FIT_MESG_OFFSET(MESG_MEMBER, MESG_INDEX, MESG_SIZE, FILE)
|
299
|
-
#define FIT_FILE_MESG_DEF_OFFSET(MESG_DEF_MEMBER, FILE) FIT_MESG_DEF_OFFSET(MESG_DEF_MEMBER, FILE)
|
300
|
-
#define FIT_FILE_MESG_DEF_FIELD_OFFSET(FIELD_MEMBER, FIELD_INDEX) FIT_MESG_DEF_FIELD_OFFSET(FIELD_MEMBER, FIELD_INDEX)
|
301
|
-
|
302
|
-
|
303
|
-
///////////////////////////////////////////////////////////////////////
|
304
|
-
// Public Constants
|
305
|
-
///////////////////////////////////////////////////////////////////////
|
306
|
-
|
307
|
-
extern const FIT_UINT8 fit_base_type_sizes[FIT_BASE_TYPES];
|
308
|
-
extern const FIT_CONST_UINT8_PTR fit_base_type_invalids[FIT_BASE_TYPES];
|
309
|
-
|
310
|
-
|
311
|
-
///////////////////////////////////////////////////////////////////////
|
312
|
-
// Public Functions
|
313
|
-
///////////////////////////////////////////////////////////////////////
|
314
|
-
|
315
|
-
///////////////////////////////////////////////////////////////////////
|
316
|
-
// Returns architecture type.
|
317
|
-
// Includes runtime check for little or big endian.
|
318
|
-
// See FIT_MESG_DEF->arch and FIT_ARCH_*.
|
319
|
-
///////////////////////////////////////////////////////////////////////
|
320
|
-
FIT_UINT8 Fit_GetArch(void);
|
321
|
-
|
322
|
-
///////////////////////////////////////////////////////////////////////
|
323
|
-
// Returns message definition corresponding to global message number.
|
324
|
-
///////////////////////////////////////////////////////////////////////
|
325
|
-
const FIT_MESG_DEF *Fit_GetMesgDef(FIT_UINT16 global_mesg_num);
|
326
|
-
|
327
|
-
///////////////////////////////////////////////////////////////////////
|
328
|
-
// Returns message definition corresponding to FIT_MESG enum.
|
329
|
-
///////////////////////////////////////////////////////////////////////
|
330
|
-
const FIT_MESG_DEF *Fit_GetMesgDefFromEnum(FIT_UINT32 fit_mesg_enum);
|
331
|
-
|
332
|
-
///////////////////////////////////////////////////////////////////////
|
333
|
-
// Returns the size of message definition.
|
334
|
-
///////////////////////////////////////////////////////////////////////
|
335
|
-
FIT_UINT16 Fit_GetMesgDefSize(const FIT_MESG_DEF *mesg_def);
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
//
|
344
|
-
///////////////////////////////////////////////////////////////////////
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
///////////////////////////////////////////////////////////////////////
|
359
|
-
|
360
|
-
//
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
///////////////////////////////////////////////////////////////////////
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
1
|
+
////////////////////////////////////////////////////////////////////////////////
|
2
|
+
// The following FIT Protocol software provided may be used with FIT protocol
|
3
|
+
// devices only and remains the copyrighted property of Garmin Canada Inc.
|
4
|
+
// The software is being provided on an "as-is" basis and as an accommodation,
|
5
|
+
// and therefore all warranties, representations, or guarantees of any kind
|
6
|
+
// (whether express, implied or statutory) including, without limitation,
|
7
|
+
// warranties of merchantability, non-infringement, or fitness for a particular
|
8
|
+
// purpose, are specifically disclaimed.
|
9
|
+
//
|
10
|
+
// Copyright 2020 Garmin Canada Inc.
|
11
|
+
////////////////////////////////////////////////////////////////////////////////
|
12
|
+
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
|
13
|
+
// Profile Version = 21.27Release
|
14
|
+
// Tag = production/akw/21.27.00-0-gef9575d
|
15
|
+
// Product = EXAMPLE
|
16
|
+
// Alignment = 4 bytes, padding disabled.
|
17
|
+
////////////////////////////////////////////////////////////////////////////////
|
18
|
+
|
19
|
+
|
20
|
+
#if !defined(FIT_H)
|
21
|
+
#define FIT_H
|
22
|
+
|
23
|
+
#include "fit_config.h"
|
24
|
+
|
25
|
+
#if defined(FIT_USE_STDINT_H)
|
26
|
+
#include <stdint.h>
|
27
|
+
#else
|
28
|
+
typedef unsigned char uint8_t;
|
29
|
+
typedef signed char int8_t;
|
30
|
+
typedef unsigned short uint16_t;
|
31
|
+
typedef signed short int16_t;
|
32
|
+
typedef unsigned long uint32_t;
|
33
|
+
typedef signed long int32_t;
|
34
|
+
typedef signed long long int64_t;
|
35
|
+
typedef unsigned long long uint64_t;
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#if defined(__cplusplus)
|
39
|
+
extern "C" {
|
40
|
+
#endif
|
41
|
+
|
42
|
+
|
43
|
+
///////////////////////////////////////////////////////////////////////
|
44
|
+
// Version
|
45
|
+
///////////////////////////////////////////////////////////////////////
|
46
|
+
|
47
|
+
#define FIT_PROTOCOL_VERSION_10 ( ( FIT_UINT8 )( 1 << FIT_PROTOCOL_VERSION_MAJOR_SHIFT ) | 0 )
|
48
|
+
#define FIT_PROTOCOL_VERSION_20 ( ( FIT_UINT8 )( 2 << FIT_PROTOCOL_VERSION_MAJOR_SHIFT ) | 0 )
|
49
|
+
|
50
|
+
#if !defined(FIT_CPP_INCLUDE_C)
|
51
|
+
#define FIT_PROTOCOL_VERSION_MAJOR(version) ( ( FIT_UINT8 )( version >> FIT_PROTOCOL_VERSION_MAJOR_SHIFT ) )
|
52
|
+
#define FIT_PROTOCOL_VERSION_MINOR(version) ( ( FIT_UINT8 )( version & FIT_PROTOCOL_VERSION_MINOR_MASK ) )
|
53
|
+
#define FIT_PROTOCOL_VERSION_MAJOR_SHIFT 4
|
54
|
+
#define FIT_PROTOCOL_VERSION_MAJOR_MASK ((FIT_UINT8) (0x0F << FIT_PROTOCOL_VERSION_MAJOR_SHIFT))
|
55
|
+
#define FIT_PROTOCOL_VERSION_MINOR_MASK ((FIT_UINT8) 0x0F)
|
56
|
+
|
57
|
+
// Deprecated.
|
58
|
+
#define FIT_PROTOCOL_VERSION FIT_PROTOCOL_VERSION_10
|
59
|
+
|
60
|
+
#define FIT_PROTOCOL_VERSION_MAX FIT_PROTOCOL_VERSION_20
|
61
|
+
|
62
|
+
#define FIT_PROFILE_VERSION_MAJOR 21
|
63
|
+
#define FIT_PROFILE_VERSION_MINOR 27
|
64
|
+
#define FIT_PROFILE_VERSION_SCALE 100
|
65
|
+
#define FIT_PROFILE_VERSION ((FIT_UINT16) (FIT_PROFILE_VERSION_MAJOR * 100 + FIT_PROFILE_VERSION_MINOR))
|
66
|
+
#endif // !defined(FIT_CPP_INCLUDE_C)
|
67
|
+
|
68
|
+
///////////////////////////////////////////////////////////////////////
|
69
|
+
// Type Definitions
|
70
|
+
///////////////////////////////////////////////////////////////////////
|
71
|
+
|
72
|
+
#define FIT_ANTFS_FILE_DATA_TYPE 128
|
73
|
+
|
74
|
+
#define FIT_BASE_TYPE_ENDIAN_FLAG ((FIT_UINT8)0x80)
|
75
|
+
#define FIT_BASE_TYPE_RESERVED ((FIT_UINT8)0x60)
|
76
|
+
#define FIT_BASE_TYPE_NUM_MASK ((FIT_UINT8)0x1F)
|
77
|
+
|
78
|
+
typedef uint8_t FIT_ENUM;
|
79
|
+
typedef const FIT_ENUM * FIT_CONST_ENUM_PTR;
|
80
|
+
#define FIT_ENUM_INVALID ((FIT_ENUM)0xFF)
|
81
|
+
#define FIT_BASE_TYPE_ENUM ((FIT_UINT8)0x00)
|
82
|
+
|
83
|
+
typedef int8_t FIT_SINT8;
|
84
|
+
typedef const FIT_SINT8 * FIT_CONST_SINT8_PTR;
|
85
|
+
#define FIT_SINT8_INVALID ((FIT_SINT8)0x7F)
|
86
|
+
#define FIT_BASE_TYPE_SINT8 ((FIT_UINT8)0x01)
|
87
|
+
|
88
|
+
typedef uint8_t FIT_UINT8;
|
89
|
+
typedef const FIT_UINT8 * FIT_CONST_UINT8_PTR;
|
90
|
+
#define FIT_UINT8_INVALID ((FIT_UINT8)0xFF)
|
91
|
+
#define FIT_BASE_TYPE_UINT8 ((FIT_UINT8)0x02)
|
92
|
+
|
93
|
+
typedef int16_t FIT_SINT16;
|
94
|
+
typedef const FIT_SINT16 * FIT_CONST_SINT16_PTR;
|
95
|
+
#define FIT_SINT16_INVALID ((FIT_SINT16)0x7FFF)
|
96
|
+
#define FIT_BASE_TYPE_SINT16 ((FIT_UINT8)0x83)
|
97
|
+
|
98
|
+
typedef uint16_t FIT_UINT16;
|
99
|
+
typedef const FIT_UINT16 * FIT_CONST_UINT16_PTR;
|
100
|
+
#define FIT_UINT16_INVALID ((FIT_UINT16)0xFFFF)
|
101
|
+
#define FIT_BASE_TYPE_UINT16 ((FIT_UINT8)0x84)
|
102
|
+
|
103
|
+
typedef int32_t FIT_SINT32;
|
104
|
+
typedef const FIT_SINT32 * FIT_CONST_SINT32_PTR;
|
105
|
+
#define FIT_SINT32_INVALID ((FIT_SINT32)0x7FFFFFFF)
|
106
|
+
#define FIT_BASE_TYPE_SINT32 ((FIT_UINT8)0x85)
|
107
|
+
|
108
|
+
typedef uint32_t FIT_UINT32;
|
109
|
+
typedef const FIT_UINT32 * FIT_CONST_UINT32_PTR;
|
110
|
+
#define FIT_UINT32_INVALID ((FIT_UINT32)0xFFFFFFFF)
|
111
|
+
#define FIT_BASE_TYPE_UINT32 ((FIT_UINT8)0x86)
|
112
|
+
|
113
|
+
typedef char FIT_STRING; // UTF-8 null terminated string
|
114
|
+
typedef const FIT_STRING * FIT_CONST_STRING_PTR;
|
115
|
+
#define FIT_STRING_INVALID ((FIT_STRING)0x00)
|
116
|
+
#define FIT_BASE_TYPE_STRING ((FIT_UINT8)0x07)
|
117
|
+
|
118
|
+
#if !defined(FIT_CPP_INCLUDE_C)
|
119
|
+
typedef float FIT_FLOAT32;
|
120
|
+
typedef const FIT_FLOAT32 * FIT_CONST_FLOAT32_PTR;
|
121
|
+
#define FIT_FLOAT32_INVALID ((FIT_FLOAT32)*((FIT_FLOAT32*)fit_base_type_invalids[FIT_BASE_TYPE_FLOAT32 & FIT_BASE_TYPE_NUM_MASK]))
|
122
|
+
#define FIT_BASE_TYPE_FLOAT32 ((FIT_UINT8)0x88)
|
123
|
+
|
124
|
+
typedef double FIT_FLOAT64;
|
125
|
+
typedef const FIT_FLOAT64 * FIT_CONST_FLOAT64_PTR;
|
126
|
+
#define FIT_FLOAT64_INVALID ((FIT_FLOAT64)*((FIT_FLOAT64*)fit_base_type_invalids[FIT_BASE_TYPE_FLOAT64 & FIT_BASE_TYPE_NUM_MASK]))
|
127
|
+
#define FIT_BASE_TYPE_FLOAT64 ((FIT_UINT8)0x89)
|
128
|
+
#endif // !defined(FIT_CPP_INCLUDE_C)
|
129
|
+
|
130
|
+
typedef uint8_t FIT_UINT8Z;
|
131
|
+
typedef const FIT_UINT8Z * FIT_CONST_UINT8Z_PTR;
|
132
|
+
#define FIT_UINT8Z_INVALID ((FIT_UINT8Z)0x00)
|
133
|
+
#define FIT_BASE_TYPE_UINT8Z ((FIT_UINT8)0x0A)
|
134
|
+
|
135
|
+
typedef uint16_t FIT_UINT16Z;
|
136
|
+
typedef const FIT_UINT16Z * FIT_CONST_UINT16Z_PTR;
|
137
|
+
#define FIT_UINT16Z_INVALID ((FIT_UINT16Z)0x0000)
|
138
|
+
#define FIT_BASE_TYPE_UINT16Z ((FIT_UINT8)0x8B)
|
139
|
+
|
140
|
+
typedef uint32_t FIT_UINT32Z;
|
141
|
+
typedef const FIT_UINT32Z * FIT_CONST_UINT32Z_PTR;
|
142
|
+
#define FIT_UINT32Z_INVALID ((FIT_UINT32Z)0x00000000)
|
143
|
+
#define FIT_BASE_TYPE_UINT32Z ((FIT_UINT8)0x8C)
|
144
|
+
|
145
|
+
typedef uint8_t FIT_BYTE;
|
146
|
+
typedef const FIT_BYTE * FIT_CONST_BYTE_PTR;
|
147
|
+
#define FIT_BYTE_INVALID ((FIT_BYTE)0xFF) // Field is invalid if all bytes are invalid.
|
148
|
+
#define FIT_BASE_TYPE_BYTE ((FIT_UINT8)0x0D)
|
149
|
+
|
150
|
+
typedef int64_t FIT_SINT64;
|
151
|
+
typedef const FIT_SINT64 * FIT_CONST_SINT64_PTR;
|
152
|
+
#define FIT_SINT64_INVALID ((FIT_SINT64)0x7FFFFFFFFFFFFFFFL)
|
153
|
+
#define FIT_BASE_TYPE_SINT64 ((FIT_UINT8)0x8E)
|
154
|
+
|
155
|
+
typedef uint64_t FIT_UINT64;
|
156
|
+
typedef const FIT_UINT64 * FIT_CONST_UINT64_PTR;
|
157
|
+
#define FIT_UINT64_INVALID ((FIT_UINT64)0xFFFFFFFFFFFFFFFFL)
|
158
|
+
#define FIT_BASE_TYPE_UINT64 ((FIT_UINT8)0x8F)
|
159
|
+
|
160
|
+
typedef uint64_t FIT_UINT64Z;
|
161
|
+
typedef const FIT_UINT64Z * FIT_CONST_UINT64Z_PTR;
|
162
|
+
#define FIT_UINT64Z_INVALID ((FIT_UINT64Z)0x0000000000000000L)
|
163
|
+
#define FIT_BASE_TYPE_UINT64Z ((FIT_UINT8)0x90)
|
164
|
+
|
165
|
+
#define FIT_BASE_TYPES 17
|
166
|
+
|
167
|
+
typedef FIT_ENUM FIT_BOOL;
|
168
|
+
#define FIT_BOOL_INVALID FIT_ENUM_INVALID
|
169
|
+
#define FIT_BOOL_FALSE ((FIT_BOOL)0)
|
170
|
+
#define FIT_BOOL_TRUE ((FIT_BOOL)1)
|
171
|
+
#define FIT_FALSE FIT_BOOL_FALSE
|
172
|
+
#define FIT_TRUE FIT_BOOL_TRUE
|
173
|
+
#define FIT_NULL 0
|
174
|
+
|
175
|
+
typedef FIT_UINT32 (*FIT_READ_BYTES_FUNC)(void *, FIT_UINT32, FIT_UINT32);
|
176
|
+
#define FIT_MESG_DEF_HEADER_SIZE FIT_STRUCT_OFFSET(fields, FIT_MESG_DEF)
|
177
|
+
|
178
|
+
|
179
|
+
///////////////////////////////////////////////////////////////////////
|
180
|
+
// File Header
|
181
|
+
///////////////////////////////////////////////////////////////////////
|
182
|
+
|
183
|
+
typedef struct
|
184
|
+
{
|
185
|
+
FIT_UINT8 header_size; // FIT_FILE_HDR_SIZE (size of this structure)
|
186
|
+
FIT_UINT8 protocol_version; // FIT_PROTOCOL_VERSION
|
187
|
+
FIT_UINT16 profile_version; // FIT_PROFILE_VERSION
|
188
|
+
FIT_UINT32 data_size; // Does not include file header or crc. Little endian format.
|
189
|
+
FIT_UINT8 data_type[4]; // ".FIT"
|
190
|
+
FIT_UINT16 crc; // CRC of this file header in little endian format.
|
191
|
+
} FIT_FILE_HDR;
|
192
|
+
|
193
|
+
#define FIT_FILE_HDR_SIZE 14
|
194
|
+
#define FIT_FILE_CRC_SIZE 2
|
195
|
+
|
196
|
+
|
197
|
+
///////////////////////////////////////////////////////////////////////
|
198
|
+
// Record Definitions
|
199
|
+
///////////////////////////////////////////////////////////////////////
|
200
|
+
|
201
|
+
#define FIT_HDR_SIZE 1
|
202
|
+
#define FIT_HDR_TIME_REC_BIT ((FIT_UINT8) 0x80)
|
203
|
+
#define FIT_HDR_TIME_TYPE_MASK ((FIT_UINT8) 0x60)
|
204
|
+
#define FIT_HDR_TIME_TYPE_SHIFT 5
|
205
|
+
#define FIT_HDR_TIME_OFFSET_MASK ((FIT_UINT8) 0x1F)
|
206
|
+
#define FIT_HDR_TYPE_DEF_BIT ((FIT_UINT8) 0x40)
|
207
|
+
#define FIT_HDR_DEV_DATA_BIT ((FIT_UINT8) 0x20)
|
208
|
+
#define FIT_HDR_TYPE_MASK ((FIT_UINT8) 0x0F)
|
209
|
+
#define FIT_MAX_LOCAL_MESGS (FIT_HDR_TYPE_MASK + 1)
|
210
|
+
|
211
|
+
///////////////////////////////////////////////////////////////////////
|
212
|
+
// File Definitions
|
213
|
+
///////////////////////////////////////////////////////////////////////
|
214
|
+
|
215
|
+
typedef struct
|
216
|
+
{
|
217
|
+
FIT_UINT32 def_file_offset;
|
218
|
+
FIT_UINT32 data_file_offset;
|
219
|
+
FIT_UINT16 num;
|
220
|
+
FIT_UINT16 count;
|
221
|
+
FIT_UINT16 mesg;
|
222
|
+
} FIT_FILE_MESG;
|
223
|
+
|
224
|
+
typedef struct
|
225
|
+
{
|
226
|
+
FIT_UINT32 data_size;
|
227
|
+
const FIT_FILE_MESG *mesgs;
|
228
|
+
FIT_UINT16 mesg_count;
|
229
|
+
FIT_UINT8 type;
|
230
|
+
FIT_UINT8 count;
|
231
|
+
} FIT_FILE_DEF;
|
232
|
+
|
233
|
+
|
234
|
+
///////////////////////////////////////////////////////////////////////
|
235
|
+
// Message Definitions
|
236
|
+
///////////////////////////////////////////////////////////////////////
|
237
|
+
|
238
|
+
typedef struct
|
239
|
+
{
|
240
|
+
FIT_UINT8 field_def_num;
|
241
|
+
FIT_UINT8 size;
|
242
|
+
FIT_UINT8 base_type;
|
243
|
+
} FIT_FIELD_DEF;
|
244
|
+
|
245
|
+
#define FIT_FIELD_DEF_SIZE 3
|
246
|
+
|
247
|
+
typedef struct
|
248
|
+
{
|
249
|
+
FIT_UINT8 def_num;
|
250
|
+
FIT_UINT8 size;
|
251
|
+
FIT_UINT8 dev_index;
|
252
|
+
} FIT_DEV_FIELD_DEF;
|
253
|
+
|
254
|
+
#define FIT_DEV_FIELD_DEF_SIZE 3
|
255
|
+
|
256
|
+
typedef struct
|
257
|
+
{
|
258
|
+
FIT_UINT8 reserved_1;
|
259
|
+
FIT_UINT8 arch;
|
260
|
+
FIT_UINT16 global_mesg_num;
|
261
|
+
FIT_UINT8 num_fields;
|
262
|
+
FIT_UINT8 fields[1];
|
263
|
+
} FIT_MESG_DEF;
|
264
|
+
|
265
|
+
#define FIT_MAX_MESG_SIZE ((FIT_UINT16)65535)
|
266
|
+
|
267
|
+
#define FIT_ARCH_ENDIAN_MASK ((FIT_UINT8)0x01)
|
268
|
+
#define FIT_ARCH_ENDIAN_LITTLE 0
|
269
|
+
#define FIT_ARCH_ENDIAN_BIG 1
|
270
|
+
|
271
|
+
|
272
|
+
///////////////////////////////////////////////////////////////////////
|
273
|
+
// Field Definitions
|
274
|
+
///////////////////////////////////////////////////////////////////////
|
275
|
+
|
276
|
+
#define FIT_MAX_FIELD_SIZE ((FIT_UINT8)255)
|
277
|
+
#define FIT_FIELD_NUM_INVALID ((FIT_UINT8)0xFF)
|
278
|
+
#define FIT_FIELD_NUM_MESSAGE_INDEX ((FIT_UINT8)254)
|
279
|
+
#define FIT_FIELD_NUM_TIMESTAMP ((FIT_UINT8)253)
|
280
|
+
|
281
|
+
#define FIT_MESSAGE_INDEX_FIELD_NUM FIT_FIELD_NUM_MESSAGE_INDEX // For reverse compatibility only. Use FIT_FIELD_NUM_MESSAGE_INDEX instead.
|
282
|
+
#define FIT_TIMESTAMP_FIELD_NUM FIT_FIELD_NUM_TIMESTAMP // For reverse compatibility only. Use FIT_FIELD_NUM_TIMESTAMP instead.
|
283
|
+
|
284
|
+
|
285
|
+
///////////////////////////////////////////////////////////////////////
|
286
|
+
// Macros
|
287
|
+
///////////////////////////////////////////////////////////////////////
|
288
|
+
|
289
|
+
#define FIT_STRUCT_OFFSET(MEMBER, STRUCT_TYPE) ( ((FIT_UINT8 *) &(((STRUCT_TYPE *) FIT_NULL)->MEMBER)) - ((FIT_UINT8 *) (FIT_NULL)) ) // Computes the byte offset of a member in a file. Compiles to a constant.
|
290
|
+
|
291
|
+
#define FIT_MESG_DEF_FIELD_OFFSET(FIELD_MEMBER, FIELD_INDEX) (FIT_STRUCT_OFFSET(FIELD_MEMBER, FIT_FIELD_DEF) + FIT_FIELD_DEF_SIZE * FIELD_INDEX) // Computes the byte offset of a field definition member. Compiles to a constant.
|
292
|
+
|
293
|
+
// Offset of message in file including file header.
|
294
|
+
#define FIT_MESG_OFFSET(MESG_MEMBER, MESG_INDEX, MESG_SIZE, FILE) (FIT_STRUCT_OFFSET(MESG_MEMBER, FILE) + MESG_INDEX * (FIT_HDR_SIZE + MESG_SIZE) + FIT_HDR_SIZE) // Computes the byte offset of a message in a file structure. Compiles to a constant.
|
295
|
+
#define FIT_MESG_DEF_OFFSET(MESG_DEF_MEMBER, FILE) (FIT_STRUCT_OFFSET(MESG_DEF_MEMBER, FILE) + FIT_HDR_SIZE) // Computes the byte offset of a message definition in a file structure. Compiles to a constant.
|
296
|
+
|
297
|
+
// Below macros are obsolete because C file structures now include file header. For reverse compatibility only.
|
298
|
+
#define FIT_FILE_MESG_OFFSET(MESG_MEMBER, MESG_INDEX, MESG_SIZE, FILE) FIT_MESG_OFFSET(MESG_MEMBER, MESG_INDEX, MESG_SIZE, FILE)
|
299
|
+
#define FIT_FILE_MESG_DEF_OFFSET(MESG_DEF_MEMBER, FILE) FIT_MESG_DEF_OFFSET(MESG_DEF_MEMBER, FILE)
|
300
|
+
#define FIT_FILE_MESG_DEF_FIELD_OFFSET(FIELD_MEMBER, FIELD_INDEX) FIT_MESG_DEF_FIELD_OFFSET(FIELD_MEMBER, FIELD_INDEX)
|
301
|
+
|
302
|
+
|
303
|
+
///////////////////////////////////////////////////////////////////////
|
304
|
+
// Public Constants
|
305
|
+
///////////////////////////////////////////////////////////////////////
|
306
|
+
|
307
|
+
extern const FIT_UINT8 fit_base_type_sizes[FIT_BASE_TYPES];
|
308
|
+
extern const FIT_CONST_UINT8_PTR fit_base_type_invalids[FIT_BASE_TYPES];
|
309
|
+
|
310
|
+
|
311
|
+
///////////////////////////////////////////////////////////////////////
|
312
|
+
// Public Functions
|
313
|
+
///////////////////////////////////////////////////////////////////////
|
314
|
+
|
315
|
+
///////////////////////////////////////////////////////////////////////
|
316
|
+
// Returns architecture type.
|
317
|
+
// Includes runtime check for little or big endian.
|
318
|
+
// See FIT_MESG_DEF->arch and FIT_ARCH_*.
|
319
|
+
///////////////////////////////////////////////////////////////////////
|
320
|
+
FIT_UINT8 Fit_GetArch(void);
|
321
|
+
|
322
|
+
///////////////////////////////////////////////////////////////////////
|
323
|
+
// Returns message definition corresponding to global message number.
|
324
|
+
///////////////////////////////////////////////////////////////////////
|
325
|
+
const FIT_MESG_DEF *Fit_GetMesgDef(FIT_UINT16 global_mesg_num);
|
326
|
+
|
327
|
+
///////////////////////////////////////////////////////////////////////
|
328
|
+
// Returns message definition corresponding to FIT_MESG enum.
|
329
|
+
///////////////////////////////////////////////////////////////////////
|
330
|
+
const FIT_MESG_DEF *Fit_GetMesgDefFromEnum(FIT_UINT32 fit_mesg_enum);
|
331
|
+
|
332
|
+
///////////////////////////////////////////////////////////////////////
|
333
|
+
// Returns the size of message definition.
|
334
|
+
///////////////////////////////////////////////////////////////////////
|
335
|
+
FIT_UINT16 Fit_GetMesgDefSize(const FIT_MESG_DEF *mesg_def);
|
336
|
+
|
337
|
+
#if !defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
338
|
+
///////////////////////////////////////////////////////////////////////
|
339
|
+
// In SDK 21.00.00 Some APIs were modified to allow for Messages with
|
340
|
+
// length > 255 bytes. This config item was added for developer
|
341
|
+
// awareness of the modifications.
|
342
|
+
// Once Developer usages have been evaluated add:
|
343
|
+
// #define FIT_16BIT_MESG_LENGTH_SUPPORT to fit_config.h
|
344
|
+
///////////////////////////////////////////////////////////////////////
|
345
|
+
#error 16 bit message length is required
|
346
|
+
#endif // !defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
347
|
+
|
348
|
+
#if defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
349
|
+
///////////////////////////////////////////////////////////////////////
|
350
|
+
// Returns the size of message corresponding to global message number.
|
351
|
+
///////////////////////////////////////////////////////////////////////
|
352
|
+
FIT_UINT16 Fit_GetMesgSize(FIT_UINT16 global_mesg_num);
|
353
|
+
#endif // defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
354
|
+
|
355
|
+
#if defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
356
|
+
///////////////////////////////////////////////////////////////////////
|
357
|
+
// Returns the size of message corresponding to FIT_MESG enum.
|
358
|
+
///////////////////////////////////////////////////////////////////////
|
359
|
+
FIT_UINT16 Fit_GetMesgSizeFromEnum(FIT_UINT32 fit_mesg_enum);
|
360
|
+
#endif // defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
361
|
+
|
362
|
+
///////////////////////////////////////////////////////////////////////
|
363
|
+
// Initializes message with invalids.
|
364
|
+
// Returns 1 if successful, otherwise 0.
|
365
|
+
///////////////////////////////////////////////////////////////////////
|
366
|
+
FIT_BOOL Fit_InitMesg(const FIT_MESG_DEF *mesg_def, void *mesg);
|
367
|
+
|
368
|
+
#if defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
369
|
+
///////////////////////////////////////////////////////////////////////
|
370
|
+
// Returns the byte offset of a field in a message.
|
371
|
+
///////////////////////////////////////////////////////////////////////
|
372
|
+
FIT_UINT16 Fit_GetFieldOffset(const FIT_MESG_DEF *mesg_def, FIT_UINT8 field_def_num);
|
373
|
+
#endif // defined(FIT_16BIT_MESG_LENGTH_SUPPORT)
|
374
|
+
|
375
|
+
///////////////////////////////////////////////////////////////////////
|
376
|
+
// Returns the definition for a field in a message.
|
377
|
+
// field_def_num is set to FIT_FIELD_NUM_INVALID if field is not found in message.
|
378
|
+
///////////////////////////////////////////////////////////////////////
|
379
|
+
FIT_FIELD_DEF Fit_GetFieldDef(const FIT_MESG_DEF *mesg_def, FIT_UINT8 field_def_num);
|
380
|
+
|
381
|
+
///////////////////////////////////////////////////////////////////////
|
382
|
+
// Finds the byte offset of a message with the given message index in a FIT file
|
383
|
+
// Requires a pointer to a function which can read a given number of bytes from a provided offset in a FIT file.
|
384
|
+
// Returns the local message number if successful, or FIT_UINT8_INVALID if unsuccessful.
|
385
|
+
///////////////////////////////////////////////////////////////////////
|
386
|
+
FIT_UINT8 Fit_LookupMessage(FIT_UINT16 global_mesg_num, FIT_UINT16 message_index, FIT_UINT32 *offset, FIT_READ_BYTES_FUNC read_bytes_func, FIT_BOOL read_header);
|
387
|
+
|
388
|
+
///////////////////////////////////////////////////////////////////////
|
389
|
+
// Returns the byte offset of a message within a file.
|
390
|
+
///////////////////////////////////////////////////////////////////////
|
391
|
+
FIT_UINT32 Fit_GetFileMesgOffset(const FIT_FILE_DEF *file_def, FIT_UINT16 mesg_num, FIT_UINT16 mesg_index);
|
392
|
+
|
393
|
+
#if defined(__cplusplus)
|
394
|
+
}
|
395
|
+
#endif
|
396
|
+
|
397
|
+
#endif // !defined(FIT_H)
|