You are here: Forum Home → ANT Developers Forums → ANT+ FIT Forum Has Moved → Thread
21 March 2016 01:35 PM
for i in `ls *.cpp`; do g++ -c $i; done
ar rcs libcppfit.a *.o
g++ -I. examples/decode/decode.cpp -o decode -lcppfit
FIT Decode Example Application
File ID:
Type: 4
Manufacturer: 1
Product: 1036
Serial Number: 3886102490
Device info:
Timestamp: 815910596
Battery status: Invalid
Device info:
Timestamp: 815910596
Battery status: Invalid
Device info:
Timestamp: 815910596
Battery status: Invalid
Device info:
Timestamp: 815910596
Battery status: Invalid
Device info:
Timestamp: 815910596
Battery status: Invalid
Device info:
Timestamp: 815917265
Battery status: Invalid
Device info:
Timestamp: 815917265
Battery status: Invalid
Device info:
Timestamp: 815917265
Battery status: Invalid
Device info:
Timestamp: 815917265
Battery status: Invalid
Device info:
Timestamp: 815917265
Battery status: Invalid
Decoded FIT file file.fit.
for i in `ls *.c`; do gcc -c $i; done
ar rcs libcfit.a *.o
gcc -I. examples/decode/decode.c -o decode -lcfit
./decode file.fit
Testing file conversion using file.fit file...
File is not FIT.
22 March 2016 01:41 PM #1
do
{
#if defined(FIT_CONVERT_MULTI_THREAD)
convert_return = FitConvert_Read(&state;, buf, buf_size);
#else
convert_return = FitConvert_Read(buf, buf_size);
#endif
/////////////////////////////////////////////////
//MY CODE
if(convert_return==FIT_CONVERT_CONTINUE)
printf("FIT_CONVERT_CONTINUE %d\n",convert_return);
else if(convert_return==FIT_CONVERT_MESSAGE_AVAILABLE)
printf("FIT_CONVERT_MESSAGE_AVAILABLE %d\n",convert_return);
else if(convert_return==FIT_CONVERT_ERROR)
printf("FIT_CONVERT_ERROR %d\n",convert_return);
else if(convert_return==FIT_CONVERT_END_OF_FILE)
printf("FIT_CONVERT_END_OF_FILE %d\n",convert_return);
else if(convert_return==FIT_CONVERT_PROTOCOL_VERSION_NOT_SUPPORTED)
printf("FIT_CONVERT_PROTOCOL_VERSION_NOT_SUPPORTED %d\n",convert_return);
else if(convert_return==FIT_CONVERT_DATA_TYPE_NOT_SUPPORTED)
printf("FIT_CONVERT_DATA_TYPE_NOT_SUPPORTED %d\n",convert_return);
else if(convert_return==FIT_CONVERT_MESSAGE_NUMBER_FOUND)
printf("FIT_CONVERT_MESSAGE_NUMBER_FOUND %d\n",convert_return);
else
printf("Unknown convert_return\n");
//MY CODE
/////////////////////////////////////////////////
switch (convert_return)
{
case FIT_CONVERT_MESSAGE_AVAILABLE:
{
./decode file.fit
Testing file conversion using file.fit file...
FIT_CONVERT_CONTINUE 0
FIT_CONVERT_DATA_TYPE_NOT_SUPPORTED 5
File is not FIT.
if (state->mesg_offset >= state->u.file_hdr.header_size)
{
state->file_bytes_left = *((FIT_UINT8 *) &state;->u.file_hdr.data_size);
state->file_bytes_left |= (FIT_UINT32)*((FIT_UINT8 *) &state;->u.file_hdr.data_size + 1) << 8;
state->file_bytes_left |= (FIT_UINT32)*((FIT_UINT8 *) &state;->u.file_hdr.data_size + 2) << 16;
state->file_bytes_left |= (FIT_UINT32)*((FIT_UINT8 *) &state;->u.file_hdr.data_size + 3) << 24;
state->file_bytes_left += 2; // CRC.
// #if defined(FIT_CONVERT_CHECK_FILE_HDR_DATA_TYPE)
// if (memcmp(state->u.file_hdr.data_type, ".FIT", 4) != 0)
// return FIT_CONVERT_DATA_TYPE_NOT_SUPPORTED;
// #endif
if ((state->u.file_hdr.protocol_version & FIT_PROTOCOL_VERSION_MAJOR_MASK) > (FIT_PROTOCOL_VERSION_MAJOR << FIT_PROTOCOL_VERSION_MAJOR_SHIFT))
return FIT_CONVERT_PROTOCOL_VERSION_NOT_SUPPORTED;
state->decode_state = FIT_CONVERT_DECODE_RECORD;
}
break;
for i in `ls *.c`; do gcc -c $i; done
ar rcs libcfit.a *.o
gcc -I. decode.c -o decode -lcfit
./decode file.fit > result.fit
Restored num_sessions=1 - Activity: timestamp=815917700, type=0, event=26, event_type=1, num_sessions=1
Unexpected end of file.
23 March 2016 06:07 AM #2
1 of 1 Pages