Garmin Fleet Management Controller  2.19.0
FmiLogParser.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * MODULE NAME:
4 * FmiLogParser.cpp
5 *
6 * Copyright 2008-2018 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 
11 #include "stdafx.h"
12 
13 #include <fstream>
14 #include "FmiLogParser.h"
15 #include "fmi.h"
16 #include "util.h"
17 #include "GarminTransportLayer.h"
18 #if( FMI_SUPPORT_A612 )
19 #include "fmi_CustomForms.cpp"
20 #endif
21 
25 {
31 };
32 
33 const float cMsToMph = 2.23693629f;
34 const float cMsToKph = 3.6f;
35 
36 using namespace std;
37 
38 //----------------------------------------------------------------------
41 //----------------------------------------------------------------------
43 {
44  // Initialize map of Garmin packet IDs to names
45  initGarminPacketNames();
46 
47  // Initialize map of command IDs to names
48  initGarminCommandNames();
49 
50 #if( FMI_SUPPORT_A602 )
51  // Initialize the map of FMI packet IDs to names
52  initFmiPacketNames();
53 #endif
54 
55 #if( FMI_SUPPORT_A607 )
56  // Initialize the map of FMI feature IDs to names
57  initFmiFeatureNames();
58 #endif
59 }
60 
61 //----------------------------------------------------------------------
63 //----------------------------------------------------------------------
65 {
66 }
67 
68 //----------------------------------------------------------------------
75 //----------------------------------------------------------------------
77  (
78  int aPacketNumber
79  )
80 {
81  CString packetTitle;
82 
83  int filenameLength = WideCharToMultiByte( CP_ACP, 0, mLogFilename, -1, NULL, 0, NULL, NULL );
84  char *filenameAnsi = new char[filenameLength];
85  WideCharToMultiByte( CP_ACP, 0, mLogFilename, -1, filenameAnsi, filenameLength, NULL, NULL );
86 
87  ifstream logFile( filenameAnsi, ios_base::in );
88  delete[] filenameAnsi;
89 
90  if( logFile.good() )
91  {
92  const char * logLine;
93  std::string logLineString;
94  logFile.seekg( mLineOffset[aPacketNumber], ios_base::beg );
95 
96  getline( logFile, logLineString );
97  logLine = logLineString.c_str();
98 
99  uint8 packetId;
100  int i;
101 
102  if( logLine[0] == 'T' )
103  packetTitle.Format( _T("TX: ") ); //first char tells TX or RX
104  else
105  packetTitle.Format( _T("RX: ") );
106  i = 1; // i keeps track of the index in the current logLine (already read one char)
107 
108  while( logLine[i++] != '-' ); // skip over time and hyphen
109 
110  i += 2; //skip the DLE byte
111  ASSERT( strlen( logLine+i ) > 0 ); // log must have data
112  ASSERT( strlen( logLine+i ) % 2 == 0 ); // log data must be whole uint8 as hex
113  UTIL_hex_to_uint8( logLine + i, &packetId, 1 ); //convert 2 hex digits to one byte
114 
115  i += 2; //point past packetId
116  switch( packetId )
117  {
118  case ID_COMMAND_BYTE:
119  {
120  uint16 commandId;
121  uint8 commandIdByte[2];
122  uint8 sizeByte;
123 
124  //not using size here, but need to check for DLE byte stuffing
125  UTIL_hex_to_uint8( logLine + i, &sizeByte, 1 );
126  i += 2; //skip past size
127  if( sizeByte == ID_DLE_BYTE )
128  i += 2; //skip the DLE stuffing
129  UTIL_hex_to_uint8( logLine + i, commandIdByte, 2 ); //convert 4 hex digits to 2 uint8s
130 
131  //uses little endian...so can't use UTIL_hex_to_uint16()
132  commandId = commandIdByte[0] + commandIdByte[1] * 256;
133  packetTitle.Append( getGarminCommandName( commandId ) );
134  break;
135  }
136 #if( CDT_SUPPORT )
137  case ID_CDT_PACKET:
138  {
139  uint8 cdtPacketId;
140  uint8 packetIdByte[2];
141  uint8 sizeByte;
142 
143  //not using size here, but need to check for DLE byte stuffing
144  UTIL_hex_to_uint8( logLine + i, &sizeByte, 1 );
145  i += 2; //skip past size
146  if( sizeByte == ID_DLE_BYTE )
147  i += 2; //skip the DLE stuffing
148  UTIL_hex_to_uint8( logLine + i, packetIdByte, 2 );
149  if( packetIdByte[0] == ID_DLE_BYTE )
150  {
151  i += 4; //skip the payload id just read in
152  UTIL_hex_to_uint8( logLine + i, &packetIdByte[1], 1 ); //read in actual byte (not stuffing)
153  }
154  cdtPacketId = packetIdByte[0];
155  packetTitle.Append( getCdtPacketName( cdtPacketId ) ); //display the CDT packet name or unknown
156  break;
157  }
158 #endif
159 #if( FMI_SUPPORT_A602 )
160  case ID_FMI_PACKET:
161  {
162  uint16 fmiPacketId;
163  uint8 packetIdByte[2];
164  uint8 sizeByte;
165 
166  //not using size here, but need to check for DLE byte stuffing
167  UTIL_hex_to_uint8( logLine + i, &sizeByte, 1 );
168  i += 2; //skip past size
169  if( sizeByte == ID_DLE_BYTE )
170  i += 2; //skip the DLE stuffing
171  UTIL_hex_to_uint8( logLine + i, packetIdByte, 2 );
172  if( packetIdByte[0] == ID_DLE_BYTE )
173  {
174  i += 4; //skip the payload id just read in
175  UTIL_hex_to_uint8( logLine + i, &packetIdByte[1], 1 ); //read in actual byte (not stuffing)
176  }
177  //uses little endian...so can't use UTIL_hex_to_uint16()
178  fmiPacketId = packetIdByte[0] + packetIdByte[1] * 256;
179  packetTitle.Append( getFmiPacketName( fmiPacketId ) ); //display the FMI packet name or unknown
180  break;
181  }
182 #if( FMI_SUPPORT_A615 )
183  case ID_HOSART_PACKET:
184  {
185  uint16 hosartPacketId;
186  uint8 packetIdByte[2];
187  uint8 sizeByte;
188 
189  //not using size here, but need to check for DLE byte stuffing
190  UTIL_hex_to_uint8( logLine + i, &sizeByte, 1 );
191  i += 2; //skip past size
192  if( sizeByte == ID_DLE_BYTE )
193  i += 2; //skip the DLE stuffing
194  UTIL_hex_to_uint8( logLine + i, packetIdByte, 2 );
195  if( packetIdByte[0] == ID_DLE_BYTE )
196  {
197  i += 4; //skip the payload id just read in
198  UTIL_hex_to_uint8( logLine + i, &packetIdByte[1], 1 ); //read in actual byte (not stuffing)
199  }
200  //uses little endian...so can't use UTIL_hex_to_uint16()
201  hosartPacketId = packetIdByte[0] + packetIdByte[1] * 256;
202  packetTitle.Append( getHosartPacketName( hosartPacketId ) ); //display the FMI packet name or unknown
203  break;
204  }
205  case ID_SET_TIME_PACKET:
206  {
207  packetTitle.Append( _T( "SET_TIME" ) );
208  break;
209  }
210 #endif //end FMI_SUPPORT_A615
211 #endif //end FMI_SUPPORT_A602
212  default:
213  // all other packet IDs are listed with the Garmin packet name
214  packetTitle.Append( getGarminPacketName( packetId ) );
215  break;
216  } // end of switch (packetId)
217  }
218  logFile.close();
219  return packetTitle;
220 } /* getPacketTitle() */
221 
222 //----------------------------------------------------------------------
230 //----------------------------------------------------------------------
232  (
233  int aPacketNumber
234  )
235 {
236  CString packet;
237 
238  int filenameLength = WideCharToMultiByte( CP_ACP, 0, mLogFilename, -1, NULL, 0, NULL, NULL );
239 
240  char *filenameAnsi = new char[filenameLength];
241  WideCharToMultiByte( CP_ACP, 0, mLogFilename, -1, filenameAnsi, filenameLength, NULL, NULL );
242  ifstream logFile( filenameAnsi, ios_base::in );
243  delete[] filenameAnsi;
244 
245  if( logFile.good() )
246  {
247  const char* logLine;
248  std::string logLineString;
249  uint8 packetId;
250  uint8 payloadSize;
251  int rawByteCount;
252  PacketStatusType packetStatus = PACKET_STATUS_OK;
253  uint8 rawBytes[MAX_PACKET_SIZE];
254  uint8 packetChecksum;
255 
256  int i = 1; //i used to keep track of index within the logLine (start at one to skip over T/R)
257  int packetTimeOffset = 0;
258  logFile.seekg( mLineOffset[aPacketNumber] );
259  getline( logFile, logLineString );
260  logLine = logLineString.c_str();
261  while( logLine[i] != '-' ) //read in the time
262  {
263  packetTimeOffset = packetTimeOffset * 10 + ( logLine[i++] - 0x30 );
264  }
265 
266  BOOL packetTimeIsMorning = mIsMorning;
267  int packetTimeHour = mLogStartHr;
268  int packetTimeMinute = mLogStartMin;
269  int packetTimeSecond = mLogStartSec;
270  int packetTimeMillis = mLogStartMillis;
271  packetTimeMillis += packetTimeOffset % 1000;
272  if( packetTimeMillis > 999 )
273  {
274  packetTimeMillis -= 1000; //ms overflow...subtract a seconds worth of ms and add one second
275  packetTimeSecond++;
276  }
277  packetTimeSecond += ( packetTimeOffset % 60000 ) / 1000;
278  if( packetTimeSecond > 59 )
279  {
280  packetTimeSecond -= 60; //sec overflow...subtract a minutes worth of sec and add one minute
281  packetTimeMinute++;
282  }
283  packetTimeMinute += ( packetTimeOffset % 3600000 ) / 60000;
284  if( packetTimeMinute > 59 )
285  {
286  packetTimeMinute -= 60; //minute overflow...sub an hours worth of mins and add one hour
287  packetTimeHour++;
288  }
289  packetTimeHour += ( packetTimeOffset % 43200000 ) / 3600000;
290  if( packetTimeHour >= 12 )
291  {
292  if( packetTimeHour != 12 ) packetTimeHour -= 12; //if above after noon...no longer morning
293  packetTimeIsMorning = !mIsMorning;
294  }
295 
296  i++; //skip the hyphen
297  rawByteCount = UTIL_hex_to_uint8( logLine + i, rawBytes, sizeof( rawBytes ) );
298 
299  // NOTE: From this point forward i refers to the index into rawBytes array, not to line.
300  i = 0;
301  if( rawBytes[i++] != ID_DLE_BYTE )
302  {
303  packetStatus = PACKET_STATUS_FRAMING_ERROR_STX;
304  }
305 
306  packet.Format
307  (
308  _T(" Time:\t\t %02d:%02d:%02d.%03d "),
309  packetTimeHour,
310  packetTimeMinute,
311  packetTimeSecond,
312  packetTimeMillis
313  );
314  if( packetTimeIsMorning )
315  packet.Append( _T("AM\r\n") );
316  else
317  packet.Append( _T("PM\r\n") );
318 
319  packetId = rawBytes[i++];
320  packet.AppendFormat( _T(" Packet ID:\t 0x%02x\r\n"), packetId );
321 
322  payloadSize = rawBytes[i++];
323  if( payloadSize == ID_DLE_BYTE )
324  {
325  i++;
326  }
327  packet.AppendFormat( _T(" Payload Size:\t %d\t(dec)\r\n"), payloadSize );
328 
329  //parse out the packet's payload, removing DLE stuffing
330  uint8 * rawData = new uint8[payloadSize];
331  for( int j = 0; j < payloadSize; j++ )
332  {
333  rawData[j] = rawBytes[i++];
334  if( ID_DLE_BYTE == rawData[j] )
335  {
336  uint8 stuffing = rawBytes[i++];
337  if( ID_DLE_BYTE != stuffing ) // check for and remove DLE stuffing
338  packetStatus = PACKET_STATUS_DLE_STUFF_ERROR;
339  }
340  if( ( i + SIZE_OF_FOOTER ) > rawByteCount )
341  {
342  packetStatus = PACKET_STATUS_TOO_SHORT;
343  break;
344  }
345  }
346 
347  packetChecksum = rawBytes[i++];
348  if( ID_DLE_BYTE == packetChecksum )
349  {
350  i++;
351  }
352 
353  if( ( i + SIZE_OF_FOOTER ) > rawByteCount )
354  {
355  packetStatus = PACKET_STATUS_TOO_SHORT;
356  }
357  else
358  {
359  if( ID_DLE_BYTE != rawBytes[i++] )
360  {
361  packetStatus = PACKET_STATUS_FRAMING_ERROR_ETX;
362  }
363  if( ID_ETX_BYTE != rawBytes[i++] )
364  {
365  packetStatus = PACKET_STATUS_FRAMING_ERROR_ETX;
366  }
367  }
368 
369 
370  rawByteCount = minval( rawByteCount, i );
371 
372  switch( packetStatus )
373  {
375  packet.Append( _T(" WARNING: DLE stuffing error in application payload\r\n") );
376  break;
378  packet.Append( _T(" WARNING: Packet too short (truncated or bad payload size?)\r\n") );
379  break;
381  packet.Append( _T(" WARNING: Framing error at start of packet\r\n") );
382  break;
384  packet.Append( _T(" WARNING: Framing error at end of packet\r\n") );
385  break;
386  }
387 
388  switch( packetId )
389  {
390  case ID_ACK_BYTE:
391  case ID_NAK_BYTE:
392  {
393  uint8 forPacketId = rawData[0];
394  packet.AppendFormat( _T(" For packet:\t 0x%02x\t%s\r\n"), forPacketId, getGarminPacketName( forPacketId ) );
395  break;
396  }
397 #if( CDT_SUPPORT )
398  case ID_CDT_PACKET:
399  {
400  uint8 cdtPacketId = rawData[0];
401  map<uint16, CString>::iterator it = mCdtPacketNames.find( cdtPacketId );
402  if( it != mCdtPacketNames.end() ) //find returns end iterator if not found
403  {
404  packet.AppendFormat( _T(" CDT Packet ID:\t 0x%04x\r\n\t\t %s\r\n"), cdtPacketId, it->second );
405  packet.Append( formatCdtPacket( logLine[0] == 'T', cdtPacketId, rawData + 1, payloadSize - 1 ) );
406  }
407  else
408  {
409  packet.AppendFormat( _T(" CDT Packet ID:\t 0x%04x\r\n\t\t (Unknown)\r\n"), cdtPacketId );
410  }
411  break;
412  }
413 #endif
414 #if( FMI_SUPPORT_A602 )
415  case ID_FMI_PACKET:
416  {
417  uint16 fmiPacketId = rawData[0] + 256 * rawData[1]; //little endian
418  map<uint16, CString>::iterator it = mFmiPacketNames.find( fmiPacketId );
419  if( it != mFmiPacketNames.end() ) //find returns end iterator if not found
420  {
421  packet.AppendFormat( _T(" FMI Packet ID:\t 0x%04x\r\n\t\t %s\r\n"), fmiPacketId, it->second );
422  packet.Append( formatFmiPacket( logLine[0] == 'T', fmiPacketId, rawData + 2, payloadSize - 2 ) );
423  }
424  else
425  {
426  packet.AppendFormat( _T(" FMI Packet ID:\t 0x%04x\r\n\t\t (Unknown)\r\n"), fmiPacketId );
427  }
428  break;
429  }
430 #if( FMI_SUPPORT_A615 )
431  case ID_HOSART_PACKET:
432  {
433  uint16 hosartPacketId = rawData[0] + 256 * rawData[1]; //little endian
434  map<uint16, CString>::iterator it = mHosartPacketNames.find( hosartPacketId );
435  if( it != mHosartPacketNames.end() ) //find returns end iterator if not found
436  {
437  packet.AppendFormat( _T(" HOSART Packet ID:\t 0x%04x\r\n\t\t %s\r\n"), hosartPacketId, it->second );
438  packet.Append( formatHosartPacket( logLine[0] == 'T', hosartPacketId, rawData + 2, payloadSize - 2 ) );
439  }
440  else
441  {
442  packet.AppendFormat( _T(" HOSART Packet ID:\t 0x%04x\r\n\t\t (Unknown)\r\n"), hosartPacketId );
443  }
444  break;
445  }
446  case ID_SET_TIME_PACKET:
447  {
448  time_type time;
449  memset( &time, 0, sizeof( time ) );
450  memcpy( &time, rawData + 2, sizeof( time ) );
451  packet.AppendFormat( _T( " SET_TIME:\t 0x%08x - %s\r\n"), time, formatTime( time ) );
452 
453  break;
454  }
455 #endif //FMI_SUPPORT_A615
456 #endif //FMI_SUPPORT_A602
457  case ID_COMMAND_BYTE:
458  {
459  uint16 command = rawData[0] + 256 * rawData[1]; //little endian
460  packet.AppendFormat( _T(" Command ID:\t 0x%04x\r\n\t\t %s\r\n"), command, getGarminCommandName( command ) );
461  break;
462  }
463  case ID_UNIT_ID:
464  {
465  unit_id_data_type unitIdData;
466  memset( &unitIdData, 0, sizeof( unitIdData ) );
467  memcpy( &unitIdData, rawData, minval( payloadSize, sizeof( unitIdData ) ) );
468  packet.AppendFormat( _T(" Unit ID:\t 0x%08x\r\n"), unitIdData.unit_id );
469  break;
470  }
471  case ID_DATE_TIME_DATA:
472  {
473  date_time_data_type dateTimeData;
474  memset( &dateTimeData, 0, sizeof( dateTimeData ) );
475  memcpy( &dateTimeData, rawData, minval( payloadSize, sizeof( dateTimeData ) ) );
476  packet.AppendFormat( _T(" Month:\t %d\r\n"), dateTimeData.date.month );
477  packet.AppendFormat( _T(" Day:\t\t %d\r\n"), dateTimeData.date.day );
478  packet.AppendFormat( _T(" Year:\t %d\r\n"), dateTimeData.date.year );
479  packet.AppendFormat( _T(" Hour:\t %d\r\n"), dateTimeData.time.hour );
480  packet.AppendFormat( _T(" Minute:\t %d\r\n"), dateTimeData.time.minute );
481  packet.AppendFormat( _T(" Second:\t %d\r\n"), dateTimeData.time.second );
482  break;
483  }
484  case ID_PVT_DATA:
485  {
486  pvt_data_type pvtData;
487 
488  memset( &pvtData, 0, sizeof( pvtData ) );
489  memcpy( &pvtData, rawData, minval( payloadSize, sizeof( pvtData ) ) );
490 
491  packet.AppendFormat( _T(" Altitude:\t %05.3f\r\n"), pvtData.altitude );
492  packet.AppendFormat( _T(" EPE:\t\t %f\r\n"), pvtData.epe );
493  packet.AppendFormat( _T(" EPV:\t\t %f\r\n"), pvtData.epv );
494  packet.AppendFormat( _T(" EPH:\t\t %f\r\n"), pvtData.eph );
495  packet.AppendFormat( _T(" GPS Fix:\t %d\r\n"), pvtData.type_of_gps_fix );
496  packet.AppendFormat( _T(" Time of Wk:\t %lf\r\n"), pvtData.time_of_week );
497  packet.AppendFormat( _T(" Lat:\t\t %08.6f\r\n"), UTIL_convert_radians_to_degrees( pvtData.position.lat ) );
498  packet.AppendFormat( _T(" Lon:\t\t %08.6f\r\n"), UTIL_convert_radians_to_degrees( pvtData.position.lon ) );
499  packet.AppendFormat( _T(" East Vel:\t %05.3f\r\n"), pvtData.east_velocity );
500  packet.AppendFormat( _T(" North Vel:\t %05.3f\r\n"), pvtData.north_velocity );
501  packet.AppendFormat( _T(" Up Vel:\t\t %05.3f\r\n"), pvtData.up_velocity );
502  packet.AppendFormat( _T(" M above sea:\t %05.3f\r\n"), pvtData.mean_sea_level_height );
503  packet.AppendFormat( _T(" Leap Secs:\t %u\r\n"), pvtData.leap_seconds );
504  packet.AppendFormat( _T(" Wk # days:\t %u\r\n"), pvtData.week_number_days );
505  break;
506  }
507 #if( FMI_SUPPORT_LEGACY )
508  case ID_LEGACY_STOP_MSG:
509  {
510  legacy_stop_data_type legacyStopData;
511 
512  memset( &legacyStopData, 0, sizeof( legacyStopData ) );
513  memcpy( &legacyStopData, rawData, minval( payloadSize, sizeof( legacyStopData ) ) );
514 
515  packet.AppendFormat( _T(" Latitude:\t %08.6f\r\n"), UTIL_convert_semicircles_to_degrees( legacyStopData.stop_position.lat ) );
516  packet.AppendFormat( _T(" Longitude:\t %08.6f\r\n"), UTIL_convert_semicircles_to_degrees( legacyStopData.stop_position.lon ) );
517  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( legacyStopData.text, sizeof( legacyStopData.text ) ) );
518  break;
519  }
520  case ID_LEGACY_TEXT_MSG:
521  {
522  char message[200];
523 
524  memset( &message, 0, sizeof( message ) );
525  memcpy( &message, rawData, minval( payloadSize, sizeof( message ) ) );
526 
527  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( message, sizeof( message ) ) );
528  break;
529  }
530 #endif
531  case ID_PRODUCT_DATA:
532  {
533  product_id_data_type productIdData;
534  char strings[MAX_PAYLOAD_SIZE];
535  char * currentString = strings + sizeof( productIdData );
536  char * end = strings + minval( payloadSize, MAX_PAYLOAD_SIZE );
537 
538  memset( &productIdData, 0, sizeof( productIdData ) );
539  memset( &strings, 0, sizeof( strings ) );
540  memcpy( &productIdData, rawData, minval( payloadSize, sizeof( productIdData ) ) );
541  memcpy( &strings, rawData, minval( payloadSize, MAX_PAYLOAD_SIZE ) );
542 
543  packet.AppendFormat( _T(" Product ID:\t 0x%04x\r\n"), productIdData.product_id );
544  packet.AppendFormat( _T(" SW Version:\t 0x%04x\r\n"), productIdData.software_version );
545  while( currentString < end )
546  {
547  packet.AppendFormat( _T(" String:\t\t %s\r\n"), CString( currentString ) );
548  currentString += strlen( currentString );
549  ++currentString;
550  }
551  break;
552  }
553  default:
554  break;
555  } // end of switch(aFmiPacketId)
556 
557 
558 #if( LOG_SHOW_RAW_ASCII )
559  packet.Append( _T(" Raw Text:\t ") );
560  for( int k = 0; k < rawByteCount; k++ )
561  {
562  if( k != 0 && k % 32 == 0 )
563  packet.Append( _T("\r\n\t\t ") );
564 
565  //print the data
566  packet.AppendFormat
567  (
568  _T("%c"),
569  isprint( rawBytes[k] ) ? rawBytes[k] : '.'
570  );
571  }
572  packet.Append( _T("\r\n") );
573 #endif
574 
575  packet.Append( _T(" Raw Hex:\t") );
576  packet.Append( formatMultiLineHex( rawByteCount, rawBytes ) );
577  delete[] rawData;
578  }
579  logFile.close();
580 
581  return packet;
582 }
583 
584 //----------------------------------------------------------------------
588 //----------------------------------------------------------------------
590  (
591  boolean aBool
592  )
593 {
594  return aBool ? _T("TRUE") : _T("FALSE");
595 }
596 
597 //----------------------------------------------------------------------
601 //----------------------------------------------------------------------
603  (
604  sint32 aSemicircles
605  )
606 {
607  double latitudeDegrees;
608  CString text;
609 
610  latitudeDegrees = UTIL_convert_semicircles_to_degrees( aSemicircles );
611  if( latitudeDegrees < 0 )
612  {
613  text.Format( _T( "%08.6f °S" ), latitudeDegrees * -1 );
614  }
615  else
616  {
617  text.Format( _T( "%08.6f °N" ), latitudeDegrees );
618  }
619 
620  return text;
621 }
622 
623 //----------------------------------------------------------------------
627 //----------------------------------------------------------------------
629  (
630  sint32 aSemicircles
631  )
632 {
633  double longitudeDegrees;
634  CString text;
635 
636  longitudeDegrees = UTIL_convert_semicircles_to_degrees( aSemicircles );
637  if( longitudeDegrees < 0 )
638  {
639  text.Format( _T( "%08.6f °W" ), longitudeDegrees * -1 );
640  }
641  else
642  {
643  text.Format( _T(" %08.6f °E" ), longitudeDegrees );
644  }
645 
646  return text;
647 }
648 
649 //----------------------------------------------------------------------
655 //----------------------------------------------------------------------
657  (
658  const uint8 * aMessageId,
659  uint8 aMessageIdSize
660  )
661 {
662  int i = 0;
663  CString text;
664 
665  for( i = 0; i < minval( aMessageIdSize, 16 ); i++ )
666  {
667  if( i == 8 )
668  {
669  text.Append( _T("\r\n\t\t") );
670  }
671  text.AppendFormat( _T(" %02x"), aMessageId[i] );
672  }
673  return text;
674 }
675 
676 //----------------------------------------------------------------------
681 //----------------------------------------------------------------------
683  (
684  const char * aText,
685  int aMaxLength
686  )
687 {
688  int i;
689  WCHAR source[256]; // Big enough to store anything this function will receive
690  CString text;
691 
692  // If support is available, display Unicode characters properly.
693  #if( FMI_SUPPORT_A604 )
694  memset( source, 0, sizeof( source ) );
695  MultiByteToWideChar( CODEPAGE_UNICODE, 0, aText, aMaxLength, source, 256 );
696 
697  for( i = 0; i < 256 && source[i] != '\0'; i++ )
698  {
699  if( i != 0 && ( i % 29 ) == 0 )
700  {
701  text.Append( _T("\r\n\t\t ") );
702  }
703  text.AppendFormat( _T("%c"), source[i] );
704  }
705  #else
706  for( i = 0; i < aMaxLength && aText[i] != '\0'; i++ )
707  {
708  if( i != 0 && ( i % 29 ) == 0 )
709  {
710  text.Append( _T("\r\n\t\t ") );
711  }
712  text.AppendFormat( _T("%c"), aText[i] );
713  }
714  #endif
715 
716  return text;
717 }
718 
719 //----------------------------------------------------------------------
723 //----------------------------------------------------------------------
725  (
726  time_type aTimestamp
727  )
728 {
729  // convert timestamp to date_time
730  date_time_data_type date_time;
731  UTIL_convert_UTC_to_local( &aTimestamp, &aTimestamp );
732  UTIL_convert_seconds_to_date_type( &aTimestamp, &date_time );
733  UTIL_convert_seconds_to_time_type( &aTimestamp, &date_time );
734 
735  // get string representations of date and time
736  char date[11];
737  char time[13];
738  UTIL_format_date_string( &date_time, date, sizeof( date ) );
739  UTIL_format_time_string( &date_time, time, sizeof( time ) );
740 
741  // format date and time for output
742  CString dateString = CString( date, sizeof( date ) );
743  CString timeString = CString( time, sizeof( time ) );
744  CString text;
745  text.Format( _T("%s %s"), dateString, timeString );
746 
747  return text;
748 }
749 
750 #if( FMI_SUPPORT_A602 )
751 //----------------------------------------------------------------------
760 //----------------------------------------------------------------------
762  (
763  BOOL transmitted,
764  uint16 aFmiPacketId,
765  uint8 * aFmiPayload,
766  uint8 aFmiPayloadSize
767  )
768 {
769  CString packet;
770 
771  switch( aFmiPacketId )
772  {
773  case FMI_ID_ENABLE: // 0x0000
774  {
775 #if( FMI_SUPPORT_A607 )
776  // This packet only has a payload when A607 support is enabled
777  uint8 i;
778  fmi_features_data_type features;
779 
780  memset( &features, 0, sizeof( features ) );
781  memcpy( &features, aFmiPayload, minval( aFmiPayloadSize, sizeof( features ) ) );
782 
783  packet.AppendFormat( _T(" Feature Count:\t %u\r\n"), features.feature_count );
784 
785  for( i = 0; i < minval( features.feature_count, cnt_of_array( features.features ) ); i++ )
786  {
787  uint16 id = features.features[i] & FEATURE_ID_MASK;
788  uint16 state = features.features[i] & FEATURE_STATE_MASK;
789 
790  packet.AppendFormat
791  (
792  _T(" Feature:\t %s is %s\r\n"),
793  mFmiFeatureNames[id],
794  state == FEATURE_STATE_ENABLED ? _T("enabled") : _T("disabled")
795  );
796  }
797 #endif
798  break;
799  }
800  case FMI_ID_PRODUCT_ID_DATA: // 0x0002
801  {
802  product_id_data_type productIdData;
803  memset( &productIdData, 0, sizeof( productIdData ) );
804  memcpy( &productIdData, aFmiPayload, minval( aFmiPayloadSize, sizeof( productIdData ) ) );
805  packet.AppendFormat( _T(" Prod ID:\t 0x%04x\r\n"), productIdData.product_id );
806  packet.AppendFormat( _T(" Soft Ver:\t 0x%04x\r\n"), productIdData.software_version );
807  break;
808  }
809 
810  case FMI_ID_PROTOCOL_DATA: // 0x0003
811  {
813  unsigned int i;
814 
815  packet.Append( _T(" Protocols:\t") );
816  for( i = 0; i < ( aFmiPayloadSize - sizeof( protocol ) ); i += sizeof( protocol ) )
817  {
818  if( i != 0 && ( i / sizeof( protocol ) ) % 5 == 0 )
819  {
820  packet.Append( _T("\r\n\t\t") );
821  }
822  memset( &protocol, 0, sizeof( protocol ) );
823 
824  //copy one protocol from aFmiPayload
825  memcpy( &protocol, &aFmiPayload[i], sizeof( protocol ) );
826  //print one char tag and 3 digit data (e.g.,. A604) and a space to protocol string
827  packet.AppendFormat( _T(" %c%03d"), (char)protocol.tag, protocol.data );
828  }
829  packet.Append( _T("\r\n") );
830  break;
831  }
832 
833  case FMI_ID_TEXT_MSG_ACK: // 0x0020
834  {
835  text_msg_ack_data_type textMessageAck;
836  memset( &textMessageAck, 0, sizeof( textMessageAck ) );
837  memcpy( &textMessageAck, aFmiPayload, minval( sizeof( textMessageAck ), aFmiPayloadSize ) );
838  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessageAck.origination_time, formatTime( textMessageAck.origination_time ) );
839  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), textMessageAck.id_size );
840  packet.AppendFormat( _T(" ID(hex):\t%s\r\n"), formatMessageId( textMessageAck.id, textMessageAck.id_size ) );
841  packet.AppendFormat( _T(" Ack Type:\t 0x%08x\r\n"), textMessageAck.msg_ack_type );
842  break;
843  }
844 
845  case FMI_ID_SERVER_OPEN_TXT_MSG: //0x0021
846  {
848 
849  memset( &textMessage, 0, sizeof( textMessage ) );
850  memcpy( &textMessage, aFmiPayload, minval( sizeof( textMessage ), aFmiPayloadSize ) );
851 
852  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessage.origination_time, formatTime( textMessage.origination_time ) );
853  packet.AppendFormat( _T(" Msg:\t\t %s\r\n"), formatText( textMessage.text_message, sizeof( textMessage.text_message ) ) );
854  break;
855  }
856 
857  case FMI_ID_SERVER_OK_ACK_TXT_MSG: //0x0022
858  case FMI_ID_SERVER_YES_NO_CONFIRM_MSG: //0x0023
859  {
861 
862  memset( &textMessage, 0, sizeof( textMessage ) );
863  memcpy( &textMessage, aFmiPayload, minval( sizeof( textMessage ), aFmiPayloadSize ) );
864 
865  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessage.origination_time, formatTime( textMessage.origination_time ) );
866  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), textMessage.id_size );
867  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( textMessage.id, textMessage.id_size ) );
868  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( textMessage.text_message, sizeof( textMessage.text_message ) ) );
869  break;
870  }
871 
872 #if( FMI_SUPPORT_A603 )
873  case FMI_ID_CLIENT_OPEN_TXT_MSG: // 0x0024
874  {
876 
877  memset( &textMessage, 0, sizeof( textMessage ) );
878  memcpy( &textMessage, aFmiPayload, minval( aFmiPayloadSize, sizeof( textMessage ) ) );
879 
880  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessage.origination_time, formatTime( textMessage.origination_time ) );
881  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), textMessage.unique_id );
882  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( textMessage.text_message, sizeof( textMessage.text_message ) ) );
883 
884  break;
885  }
886 
887  case FMI_ID_CLIENT_TXT_MSG_RCPT: //0x0025
888  {
890 
891  memset( &receipt, 0, sizeof( receipt ) );
892  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
893 
894  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), receipt.unique_id );
895  break;
896  }
897 #endif
898 
899 #if( FMI_SUPPORT_A607 )
900  case FMI_ID_A607_CLIENT_OPEN_TXT_MSG: // 0x0026
901  {
903 
904  memset( &textMessage, 0, sizeof( textMessage ) );
905  memcpy( &textMessage, aFmiPayload, minval( aFmiPayloadSize, sizeof( textMessage ) ) );
906 
907  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessage.origination_time, formatTime( textMessage.origination_time ) );
908  packet.AppendFormat( _T(" Lat:\t\t 0x%08x\r\n"), textMessage.scposn.lat );
909  packet.AppendFormat( _T(" Lon:\t\t 0x%08x\r\n"), textMessage.scposn.lon );
910  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), textMessage.unique_id );
911  packet.AppendFormat( _T(" Link ID size:\t %u\r\n"), textMessage.id_size );
912  packet.AppendFormat( _T(" Link ID (hex):\t%s\r\n"), formatMessageId( textMessage.id, textMessage.id_size ) );
913  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( textMessage.text_message, sizeof( textMessage.text_message ) ) );
914  break;
915  }
916 #endif
917 
918 #if( FMI_SUPPORT_A604 )
919  case FMI_ID_SET_CANNED_RESP_LIST: //0x0028
920  {
921  canned_response_list_data_type cannedResponseList;
922 
923  memset( &cannedResponseList, 0, sizeof( cannedResponseList ) );
924  memcpy( &cannedResponseList, aFmiPayload, minval( aFmiPayloadSize, sizeof( cannedResponseList ) ) );
925 
926  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), cannedResponseList.id_size );
927  packet.AppendFormat( _T(" Resp Count:\t %u\r\n"), cannedResponseList.response_count );
928  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( cannedResponseList.id, cannedResponseList.id_size ) );
929 
930  packet.Append( _T("\r\n Responses:\t") );
931  int i = 0;
932  while( i < cannedResponseList.response_count )
933  {
934  if( i != 0 && ( i % 2 ) == 0 )
935  packet.Append( _T("\r\n\t\t") );
936  packet.AppendFormat( _T(" 0x%08x"), cannedResponseList.response_id[i++] );
937  }
938  packet.Append( _T("\r\n") );
939  break;
940  }
941 
942  case FMI_ID_CANNED_RESP_LIST_RCPT: // 0x0029
943  {
945 
946  memset( &receipt, 0, sizeof( receipt ) );
947  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
948 
949  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), receipt.id_size );
950  packet.AppendFormat( _T(" Result code:\t %u\r\n"), receipt.result_code );
951  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( receipt.id, receipt.id_size ) );
952  break;
953  }
954 
955  case FMI_ID_A604_OPEN_TEXT_MSG: // 0x002A
956  {
958 
959  memset( &textMessage, 0, sizeof( textMessage ) );
960  memcpy( &textMessage, aFmiPayload, minval( aFmiPayloadSize, sizeof( textMessage ) ) );
961 
962  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessage.origination_time, formatTime( textMessage.origination_time ) );
963  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), textMessage.id_size );
964  packet.AppendFormat( _T(" Msg Type:\t %u\r\n"), textMessage.message_type );
965  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( textMessage.id, textMessage.id_size ) );
966  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( textMessage.text_message, sizeof( textMessage.text_message ) ) );
967  break;
968  }
969 
970  case FMI_ID_A604_OPEN_TEXT_MSG_RCPT: // 0x002B
971  {
973 
974  memset( &receipt, 0, sizeof( receipt ) );
975  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
976 
977  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), receipt.origination_time, formatTime( receipt.origination_time ) );
978  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), receipt.id_size );
979  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean( receipt.result_code ) );
980  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( receipt.id, receipt.id_size ) );
981  break;
982  }
983 
984  case FMI_ID_TEXT_MSG_ACK_RCPT: // 0x002C
985  {
986  text_msg_id_data_type receipt;
987 
988  memset( &receipt, 0, sizeof( receipt ) );
989  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
990 
991  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), receipt.id_size );
992  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( receipt.id, receipt.id_size ) );
993  break;
994  }
995 
996 #if FMI_SUPPORT_A607
997  case FMI_ID_TEXT_MSG_DELETE_REQUEST: // 0x002D
998  {
999  delete_message_request_data_type messageDeleteRequest;
1000 
1001  memset( &messageDeleteRequest, 0, sizeof( messageDeleteRequest ) );
1002  memcpy( &messageDeleteRequest, aFmiPayload, minval( aFmiPayloadSize, sizeof( messageDeleteRequest ) ) );
1003 
1004  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), messageDeleteRequest.id_size );
1005  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( messageDeleteRequest.id, messageDeleteRequest.id_size ) );
1006  break;
1007  }
1008 
1009  case FMI_ID_TEXT_MSG_DELETE_RESPONSE: // 0x002E
1010  {
1011  delete_message_response_data_type deleteResponse;
1012 
1013  memset( &deleteResponse, 0, sizeof( deleteResponse ) );
1014  memcpy( &deleteResponse, aFmiPayload, minval( aFmiPayloadSize, sizeof( deleteResponse ) ) );
1015 
1016  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), deleteResponse.id_size );
1017  packet.AppendFormat( _T(" Result Code:\t %u\r\n"), deleteResponse.result_code );
1018  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( deleteResponse.id, deleteResponse.id_size ) );
1019  break;
1020  }
1021 #endif
1022 
1023  case FMI_ID_SET_CANNED_RESPONSE: //0x0030
1024  {
1025  canned_response_data_type cannedResponse;
1026 
1027  memset( &cannedResponse, 0, sizeof( cannedResponse ) );
1028  memcpy( &cannedResponse, aFmiPayload, minval( aFmiPayloadSize, sizeof( cannedResponse ) ) );
1029 
1030  packet.AppendFormat( _T(" Response ID:\t 0x%08x\r\n"), cannedResponse.response_id );
1031  packet.AppendFormat( _T(" Response Text:\t%s\r\n"), formatText( cannedResponse.response_text, sizeof( cannedResponse.response_text ) ) );
1032  break;
1033  }
1034 
1035  case FMI_ID_DELETE_CANNED_RESPONSE: //0x0031
1036  {
1037  canned_response_delete_data_type cannedResponseDelete;
1038 
1039  memset( &cannedResponseDelete, 0, sizeof( cannedResponseDelete ) );
1040  memcpy( &cannedResponseDelete, aFmiPayload, minval( aFmiPayloadSize, sizeof( cannedResponseDelete ) ) );
1041 
1042  packet.AppendFormat( _T(" Response ID:\t 0x%08x\r\n"), cannedResponseDelete.response_id );
1043  break;
1044  }
1045 
1046  case FMI_ID_SET_CANNED_RESPONSE_RCPT: //0x0032
1048  {
1050 
1051  memset( &receipt, 0, sizeof( receipt ) );
1052  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1053 
1054  packet.AppendFormat( _T(" Response ID:\t 0x%08x\r\n"), receipt.response_id );
1055  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean(receipt.result_code) );
1056  break;
1057  }
1058 
1059  case FMI_ID_REFRESH_CANNED_RESP_LIST: //0x0034
1060  {
1062 
1063  memset( &refresh, 0, sizeof( refresh ) );
1064  memcpy( &refresh, aFmiPayload, minval( aFmiPayloadSize, sizeof( refresh ) ) );
1065 
1066  packet.AppendFormat( _T(" Resp Count:\t %u\r\n"), refresh.response_count );
1067 
1068  packet.AppendFormat( _T(" Response:\t") );
1069  unsigned int i = 0;
1070  while( i < refresh.response_count && i <= 50 )
1071  {
1072  if( i != 0 && i % 2 == 0 ) packet.Append( _T("\r\n") );
1073  packet.AppendFormat( _T(" 0x%08x") );
1074  }
1075  packet.Append( _T("\r\n") );
1076  break;
1077  }
1078 
1079  case FMI_ID_TEXT_MSG_STATUS_REQUEST: //0x0040
1080  {
1081  message_status_request_data_type statusRequest;
1082 
1083  memset( &statusRequest, 0, sizeof( statusRequest ) );
1084  memcpy( &statusRequest, aFmiPayload, minval( aFmiPayloadSize, sizeof( statusRequest ) ) );
1085 
1086  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), statusRequest.id_size );
1087  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( statusRequest.id, statusRequest.id_size ) );
1088  break;
1089  }
1090 
1091  case FMI_ID_TEXT_MSG_STATUS: //0x0041
1092  {
1093  message_status_data_type messageStatus;
1094 
1095  memset( &messageStatus, 0, sizeof( messageStatus ) );
1096  memcpy( &messageStatus, aFmiPayload, minval( aFmiPayloadSize, sizeof( messageStatus ) ) );
1097 
1098  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), messageStatus.id_size );
1099  packet.AppendFormat( _T(" Status Code:\t %u\r\n"), messageStatus.status_code );
1100  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( messageStatus.id, messageStatus.id_size ) );
1101  break;
1102  }
1103 
1104  case FMI_ID_SET_CANNED_MSG: //0x0050
1105  {
1106  canned_message_data_type message;
1107 
1108  memset( &message, 0, sizeof( message ) );
1109  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
1110 
1111  packet.AppendFormat( _T(" Msg ID:\t 0x%08x\r\n"), message.message_id );
1112  packet.AppendFormat( _T(" Message:\t %s\r\n"), formatText( message.message , sizeof( message.message ) ) );
1113  break;
1114  }
1115 
1116  case FMI_ID_SET_CANNED_MSG_RCPT: //0x0051
1117  case FMI_ID_DELETE_CANNED_MSG_RCPT: //0x0053
1118  {
1120 
1121  memset( &receipt, 0, sizeof( receipt ) );
1122  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1123 
1124  packet.AppendFormat( _T(" Msg ID:\t 0x%08x\r\n"), receipt.message_id );
1125  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean( receipt.result_code ) );
1126  break;
1127  }
1128 
1129  case FMI_ID_DELETE_CANNED_MSG: //0x0052
1130  {
1131  canned_message_delete_data_type deleteRequest;
1132 
1133  memset( &deleteRequest, 0, sizeof( deleteRequest ) );
1134  memcpy( &deleteRequest, aFmiPayload, minval( aFmiPayloadSize, sizeof( deleteRequest ) ) );
1135 
1136  packet.AppendFormat( _T(" Msg ID:\t 0x%08x\r\n"), deleteRequest.message_id );
1137  break;
1138  }
1139 
1140  case FMI_ID_REFRESH_CANNED_MSG_LIST: // 0x0054
1141  // No FMI payload associated with this packet
1142  break;
1143 #endif
1144 
1145 #if( FMI_SUPPORT_A611 )
1146  case FMI_ID_LONG_TEXT_MSG: // 0x0055
1147  {
1148  long_text_msg_data_type textMessage;
1149 
1150  memset( &textMessage, 0, sizeof( textMessage ) );
1151  memcpy( &textMessage, aFmiPayload, minval( aFmiPayloadSize, sizeof( textMessage ) ) );
1152 
1153  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), textMessage.origination_time, formatTime( textMessage.origination_time ) );
1154  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), textMessage.id_size );
1155  packet.AppendFormat( _T(" Msg Type:\t %u\r\n"), textMessage.type );
1156  packet.AppendFormat( _T(" Finished:\t%s\r\n"), formatBoolean( textMessage.finished_flag ) );
1157  packet.AppendFormat( _T(" Seq Num:\t%u\r\n"), textMessage.sequence_number );
1158  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( textMessage.id, textMessage.id_size ) );
1159  packet.AppendFormat( _T(" Msg Data:\t %s\r\n"), formatText( textMessage.text_message, sizeof( textMessage.text_message ) ) );
1160  break;
1161  }
1162 
1163  case FMI_ID_LONG_TEXT_MSG_RCPT: // 0x0056
1164  {
1166 
1167  memset( &receipt, 0, sizeof( receipt ) );
1168  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1169 
1170  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), receipt.origination_time, formatTime( receipt.origination_time ) );
1171  packet.AppendFormat( _T(" ID Size:\t %u\r\n"), receipt.id_size );
1172  packet.AppendFormat( _T(" Result Code:\t %u\r\n"), receipt.result_code );
1173  packet.AppendFormat( _T(" Finished:\t%s\r\n"), formatBoolean( receipt.finished_flag ) );
1174  packet.AppendFormat( _T(" Seq Num:\t%u\r\n"), receipt.sequence_number );
1175  packet.AppendFormat( _T(" ID (hex):\t%s\r\n"), formatMessageId( receipt.id, receipt.id_size ) );
1176  break;
1177  }
1178 #endif
1179 
1180  case FMI_ID_A602_STOP: //0x0100
1181  {
1182  A602_stop_data_type stop;
1183 
1184  memset( &stop, 0, sizeof( stop ) );
1185  memcpy( &stop, aFmiPayload, minval( aFmiPayloadSize, sizeof( stop ) ) );
1186 
1187  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), stop.origination_time, formatTime( stop.origination_time ) );
1188  packet.AppendFormat( _T(" Lat:\t\t 0x%08x\r\n"), stop.stop_position.lat );
1189  packet.AppendFormat( _T(" Lon:\t\t 0x%08x\r\n"), stop.stop_position.lon );
1190  packet.AppendFormat( _T(" Text:\t\t %s\r\n"), formatText( stop.text, sizeof( stop.text ) ) );
1191  break;
1192  }
1193 
1194 #if( FMI_SUPPORT_A603 )
1195  case FMI_ID_A603_STOP: //0x0101
1196  {
1197  A603_stop_data_type stop;
1198 
1199  memset( &stop, 0, sizeof( stop ) );
1200  memcpy( &stop, aFmiPayload, minval( aFmiPayloadSize, sizeof( stop ) ) );
1201 
1202  packet.AppendFormat( _T(" Orig Time:\t 0x%08x - %s\r\n"), stop.origination_time, formatTime( stop.origination_time ) );
1203  packet.AppendFormat( _T(" Lat:\t\t 0x%08x\r\n"), stop.stop_position.lat );
1204  packet.AppendFormat( _T(" Lon:\t\t 0x%08x\r\n"), stop.stop_position.lon );
1205  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), stop.unique_id );
1206  packet.AppendFormat( _T(" Text:\t\t %s\r\n"), formatText( stop.text, sizeof( stop.text ) ) );
1207  break;
1208  }
1209 #endif
1210 
1211 #if( FMI_SUPPORT_A604 )
1212  case FMI_ID_SORT_STOP_LIST: // 0x0110
1213  // no FMI payload associated with this packet
1214  break;
1215 
1216  case FMI_ID_SORT_STOP_LIST_ACK: // 0x0111
1217  // no FMI payload associated with this packet
1218  break;
1219 #endif
1220 
1221 #if( FMI_SUPPORT_A607 )
1222  case FMI_ID_WAYPOINT: // 0x0130
1223  {
1224  waypoint_data_type waypointData;
1225 
1226  memset( &waypointData, 0, sizeof( waypointData ) );
1227  memcpy( &waypointData, aFmiPayload, minval( aFmiPayloadSize, sizeof( waypointData ) ) );
1228 
1229  packet.AppendFormat( _T(" Unique ID:\t 0x%04x\r\n"), waypointData.unique_id );
1230  packet.AppendFormat( _T(" Symbol:\t 0x%04x\r\n"), waypointData.symbol );
1231  packet.AppendFormat( _T(" Lat:\t\t 0x%08x\r\n"), waypointData.posn.lat );
1232  packet.AppendFormat( _T(" Lon:\t\t 0x%08x\r\n"), waypointData.posn.lon );
1233  packet.AppendFormat( _T(" Cat:\t\t 0x%04x\r\n"), waypointData.cat );
1234  packet.AppendFormat( _T(" Name:\t\t %s\r\n"), formatText( waypointData.name, sizeof( waypointData.name ) ) );
1235  packet.AppendFormat( _T(" Comment: \t %s\r\n"), formatText( waypointData.comment, sizeof( waypointData.comment ) ) );
1236  break;
1237  }
1238 
1239  case FMI_ID_WAYPOINT_RCPT: // 0x0131
1240  {
1241  waypoint_rcpt_data_type waypointReceipt;
1242 
1243  memset( &waypointReceipt, 0, sizeof( waypointReceipt ) );
1244  memcpy( &waypointReceipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( waypointReceipt ) ) );
1245 
1246  packet.AppendFormat( _T(" Unique ID:\t 0x%04x\r\n"), waypointReceipt.unique_id );
1247  packet.AppendFormat( _T(" Result Code:\t %u\r\n"), waypointReceipt.result_code );
1248  break;
1249  }
1250 
1251  case FMI_ID_WAYPOINT_DELETE: // 0x0132
1252  case FMI_ID_WAYPOINT_DELETED_RCPT: // 0x0134
1253  {
1254  uint16 waypointId;
1255 
1256  memset( &waypointId, 0, sizeof( waypointId ) );
1257  memcpy( &waypointId, aFmiPayload, minval( aFmiPayloadSize, sizeof( waypointId ) ) );
1258 
1259  packet.AppendFormat( _T(" Unique ID:\t 0x%04x\r\n"), waypointId );
1260  break;
1261  }
1262 
1263  case FMI_ID_WAYPOINT_DELETED: // 0x0133
1264  {
1265  waypoint_deleted_data_type waypointDeleted;
1266 
1267  memset( &waypointDeleted, 0, sizeof( waypointDeleted ) );
1268  memcpy( &waypointDeleted, aFmiPayload, minval( aFmiPayloadSize, sizeof( waypointDeleted ) ) );
1269 
1270  packet.AppendFormat( _T(" Unique ID:\t 0x%04x\r\n"), waypointDeleted.unique_id );
1271  packet.AppendFormat( _T(" Result Code:\t %u\r\n"), waypointDeleted.result_code );
1272 
1273  break;
1274  }
1275 
1276  case FMI_ID_DELETE_WAYPOINT_CAT: // 0x0135
1277  {
1278  uint16 waypointCategories;
1279 
1280  memset( &waypointCategories, 0, sizeof( waypointCategories ) );
1281  memcpy( &waypointCategories, aFmiPayload, minval( aFmiPayloadSize, sizeof( waypointCategories ) ) );
1282 
1283  packet.AppendFormat( _T(" Category:\t 0x%04x\r\n"), waypointCategories );
1284  break;
1285  }
1286 
1287  case FMI_ID_DELETE_WAYPOINT_CAT_RCPT: // 0x0136
1288  {
1290 
1291  memset( &receipt, 0, sizeof( receipt ) );
1292  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1293 
1294  packet.AppendFormat( _T(" Category:\t 0x%04x\r\n"), receipt.cat_id );
1295  packet.AppendFormat( _T(" Count:\t\t %u\r\n"), receipt.count );
1296  break;
1297  }
1298 
1299  case FMI_ID_CREATE_WAYPOINT_CAT: // 0x0137
1300  {
1301  category_data_type receipt;
1302 
1303  memset( &receipt, 0, sizeof( receipt ) );
1304  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1305 
1306  packet.AppendFormat( _T(" Category:\t %u\r\n"), receipt.id );
1307  packet.AppendFormat( _T(" Name: \t\t %s\r\n"), formatText( receipt.name, sizeof( receipt.name ) ) );
1308  break;
1309  }
1310 
1311  case FMI_ID_CREATE_WAYPOINT_CAT_RCPT: // 0x0138
1312  {
1313  category_rcpt_data_type receipt;
1314 
1315  memset( &receipt, 0, sizeof( receipt ) );
1316  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1317 
1318  packet.AppendFormat( _T(" Category:\t %u\r\n"), receipt.id );
1319  packet.AppendFormat( _T(" Result Code:\t %u\r\n"), receipt.result_code );
1320  break;
1321  }
1322 
1323 #endif
1324 
1325 #if( FMI_SUPPORT_A603 )
1326  case FMI_ID_ETA_DATA_REQUEST: // 0x0200
1327  // No FMI payload associated with this packet
1328  break;
1329 
1330  case FMI_ID_ETA_DATA: //0x0201
1331  {
1332  eta_data_type etaData;
1333 
1334  memset( &etaData, 0, sizeof( etaData ) );
1335  memcpy( &etaData, aFmiPayload, minval( sizeof( etaData ), aFmiPayloadSize ) );
1336 
1337  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), etaData.unique_id );
1338  packet.AppendFormat( _T(" ETA time:\t 0x%08x\r\n"), etaData.eta_time );
1339  packet.AppendFormat( _T(" Dist to Dest:\t 0x%08x\r\n"), etaData.distance_to_destination );
1340  packet.AppendFormat( _T(" Lat of Dest:\t 0x%08x\r\n"), etaData.position_of_destination.lat );
1341  packet.AppendFormat( _T(" Lon of Dest:\t 0x%08x\r\n"), etaData.position_of_destination.lon );
1342  break;
1343  }
1344 
1345  case FMI_ID_ETA_DATA_RCPT: //0x0202
1346  {
1347  eta_data_receipt_type receipt;
1348 
1349  memset( &receipt, 0, sizeof( receipt ) );
1350  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1351 
1352  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), receipt.unique_id );
1353  break;
1354  }
1355 
1356  case FMI_ID_STOP_STATUS_REQUEST: // 0x0210
1357  case FMI_ID_STOP_STATUS: // 0x0211
1358  {
1359  stop_status_data_type stopData;
1360 
1361  memset( &stopData, 0, sizeof( stopData ) );
1362  memcpy( &stopData, aFmiPayload, minval( aFmiPayloadSize, sizeof( stopData ) ) );
1363 
1364  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), stopData.unique_id );
1365  packet.AppendFormat( _T(" Status:\t\t %u\r\n"), stopData.stop_status );
1366  packet.AppendFormat( _T(" Index in List:\t %u\r\n"), stopData.stop_index_in_list );
1367  break;
1368  }
1369 
1370  case FMI_ID_STOP_STATUS_RCPT: //0x0212
1371  {
1373  memset( &receipt, 0, sizeof( receipt ) );
1374  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1375  packet.AppendFormat( _T(" Unique ID:\t 0x%08x\r\n"), receipt.unique_id );
1376  break;
1377  }
1378 
1379  case FMI_ID_AUTO_ARRIVAL: //0x0220
1380  {
1381  auto_arrival_data_type autoArrival;
1382 
1383  memset( &autoArrival, 0, sizeof( autoArrival ) );
1384  memcpy( &autoArrival, aFmiPayload, minval( aFmiPayloadSize, sizeof( autoArrival ) ) );
1385 
1386  packet.AppendFormat( _T(" Stop Time:\t 0x%08x\r\n"), autoArrival.stop_time );
1387  packet.AppendFormat( _T(" Stop Dist:\t 0x%08x\r\n"), autoArrival.stop_distance );
1388  break;
1389  }
1390 
1391  case FMI_ID_DATA_DELETION: //0x0230
1392  {
1393  data_deletion_data_type delData;
1394 
1395  memset( &delData, 0, sizeof( delData ) );
1396  memcpy( &delData, aFmiPayload, minval( aFmiPayloadSize, sizeof( delData ) ) );
1397 
1398  packet.AppendFormat( _T(" Data Type:\t %u\r\n"), delData.data_type );
1399  break;
1400  }
1401 #endif
1402 
1403 #if( FMI_SUPPORT_A604 )
1404  case FMI_ID_USER_INTERFACE_TEXT: // 0x0240
1405  {
1407 
1408  memset( &uiText, 0, sizeof( uiText ) );
1409  memcpy( &uiText, aFmiPayload, minval( aFmiPayloadSize, sizeof( uiText ) ) );
1410 
1411  packet.AppendFormat( _T(" Element ID:\t %u\r\n"), uiText.text_element_id );
1412  packet.AppendFormat( _T(" New Text:\t %s\r\n"), formatText( uiText.new_text, sizeof( uiText.new_text ) ) );
1413  break;
1414  }
1415 
1416  case FMI_ID_USER_INTERFACE_TEXT_RCPT: // 0x0241
1417  {
1419  memset( &receipt, 0, sizeof( receipt ) );
1420  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1421  packet.AppendFormat( _T(" Element ID:\t %u\r\n"), receipt.text_element_id );
1422  packet.AppendFormat( _T(" Success:\t %s\r\n"), receipt.result_code ? _T("TRUE") : _T("FALSE") );
1423  break;
1424  }
1425 
1426  case FMI_ID_MSG_THROTTLING_COMMAND: // 0x0250
1427  case FMI_ID_MSG_THROTTLING_RESPONSE: // 0x0251
1428  {
1430 
1431  memset( &throttle, 0, sizeof( throttle ) );
1432  memcpy( &throttle, aFmiPayload, minval( aFmiPayloadSize, sizeof( throttle ) ) );
1433 
1434  packet.AppendFormat
1435  (
1436  _T(" Throttle ID:\t 0x%04x (%s)\r\n"),
1437  throttle.packet_id,
1438  ( mFmiPacketNames.find( throttle.packet_id ) != mFmiPacketNames.end() )
1439  ? mFmiPacketNames[throttle.packet_id]
1440  : _T("Unknown FMI Protocol")
1441  );
1442 
1443  packet.Append( _T(" New State:\t ") );
1444  switch( throttle.new_state )
1445  {
1447  packet.Append( _T("Enabled\r\n") );
1448  break;
1450  packet.Append( _T("Disabled\r\n") );
1451  break;
1453  packet.Append( _T("Error\r\n") );
1454  break;
1455  default:
1456  packet.Append( _T("Unknown\r\n") );
1457  break;
1458  }
1459  break;
1460  }
1461 #endif
1462 
1463 #if( FMI_SUPPORT_A605 )
1465  // no FMI payload associated with this packet
1466  break;
1467 
1469  {
1471  uint16 i;
1472 
1473  memset( &list, 0, sizeof( list ) );
1474  memcpy( &list, aFmiPayload, minval( aFmiPayloadSize, sizeof( list ) ) );
1475 
1476  packet.AppendFormat( _T(" Count:\t\t %u\r\n"), list.response_count );
1477 
1478  for( i = 0; i < list.response_count; i++ )
1479  {
1480  packet.AppendFormat
1481  (
1482  _T(" Protocol:\t %s is %s\r\n"),
1483  ( mFmiPacketNames.find( list.response_list[i].packet_id ) != mFmiPacketNames.end() )
1484  ? mFmiPacketNames[ list.response_list[i].packet_id ]
1485  : _T("Unknown FMI protocol"),
1486  list.response_list[i].new_state ? _T("enabled") : _T("disabled")
1487  );
1488  }
1489  break;
1490  }
1491 #endif
1492 
1493 #if( FMI_SUPPORT_A604 )
1494  case FMI_ID_PING:
1495  //no FMI payload associated with this packet
1496  break;
1497 
1498  case FMI_ID_PING_RESPONSE:
1499  //no FMI payload associated with this packet
1500  break;
1501 
1502  case FMI_ID_FILE_TRANSFER_START: // 0x0400
1503  case FMI_ID_GPI_FILE_INFORMATION: // 0x0407
1504  {
1505  file_info_data_type fileInfo;
1506 
1507  memset( &fileInfo, 0, sizeof( fileInfo ) );
1508  memcpy( &fileInfo, aFmiPayload, minval( aFmiPayloadSize, sizeof( fileInfo ) ) );
1509 
1510  packet.AppendFormat( _T(" File Size:\t %u\r\n"), fileInfo.file_size );
1511  packet.AppendFormat( _T(" Version Len:\t %u\r\n"), fileInfo.file_version_length );
1512  packet.AppendFormat( _T(" Type:\t\t %u\r\n"), fileInfo.file_type );
1513  packet.AppendFormat( _T(" Version (hex):\t %s\r\n"), formatMessageId( fileInfo.file_version, fileInfo.file_version_length ) );
1514  break;
1515  }
1516 
1517  case FMI_ID_FILE_DATA_PACKET: //0x0401
1518  {
1519  file_packet_data_type fileData;
1520 
1521  memset( &fileData, 0, sizeof( fileData ) );
1522  memcpy( &fileData, aFmiPayload, minval( aFmiPayloadSize, sizeof( fileData ) ) );
1523  packet.AppendFormat( _T(" Offset:\t\t %u\r\n"), fileData.offset );
1524  packet.AppendFormat( _T(" Data Length:\t %u\r\n"), fileData.data_length );
1525 
1526  int length = minval( 245, fileData.data_length );
1527  packet.Append( _T(" Data (hex):\t") );
1528  packet.Append( formatMultiLineHex( length, fileData.file_data ) );
1529  packet.Append( _T("\r\n") );
1530  break;
1531  }
1532 
1533  case FMI_ID_FILE_TRANSFER_END: //0x0402
1534  {
1535  file_end_data_type fileEndData;
1536 
1537  memset( &fileEndData, 0, sizeof( fileEndData ) );
1538  memcpy( &fileEndData, aFmiPayload, minval( aFmiPayloadSize, sizeof( fileEndData ) ) );
1539  packet.AppendFormat( _T(" CRC:\t\t 0x%08x\r\n"), fileEndData.crc );
1540  break;
1541  }
1542 
1543  case FMI_ID_FILE_START_RCPT: //0x0403
1544  case FMI_ID_FILE_END_RCPT: //0x0405
1545  {
1546  uint8 result_code = 0;
1547  if ( transmitted || FMI_ID_FILE_START_RCPT == aFmiPacketId )
1548  {
1550 
1551  memset( &receipt, 0, sizeof( receipt ) );
1552  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1553 
1554  packet.AppendFormat( _T(" File Type:\t %u\r\n"), receipt.file_type );
1555 
1556  result_code = receipt.result_code;
1557  }
1558  else
1559  {
1560  file_receipt_data_type receipt;
1561 
1562  memset( &receipt, 0, sizeof( receipt ) );
1563  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1564  packet.AppendFormat( _T(" Error Code/File Type (1 byte):\t %u\r\n"), receipt.error_code_or_file_type_when_gpi );
1565  packet.AppendFormat( _T(" Record Count/Reserved Bytes (2 bytes):\t %u\r\n"), receipt.record_count_or_reserved_when_gpi );
1566 
1567  result_code = receipt.result_code;
1568  }
1569 
1570  switch( result_code )
1571  {
1573  {
1574  packet.AppendFormat( _T(" Result Code:\t %u - Success\r\n"), result_code );
1575  break;
1576  }
1578  {
1579  packet.AppendFormat( _T(" Result Code:\t %u - CRC Error\r\n"), result_code );
1580  break;
1581  }
1583  {
1584  packet.AppendFormat( _T(" Result Code:\t %u - Low Memory\r\n"), result_code );
1585  break;
1586  }
1588  {
1589  packet.AppendFormat( _T(" Result Code:\t %u - Invalid File\r\n"), result_code );
1590  break;
1591  }
1593  {
1594  packet.AppendFormat( _T(" Result Code:\t %u - No Transfer\r\n"), result_code );
1595  break;
1596  }
1598  {
1599  packet.AppendFormat( _T(" Result Code:\t %u - Severe Error\r\n"), result_code );
1600  break;
1601  }
1603  {
1604  packet.AppendFormat( _T(" Result Code:\t %u - Invalid File Type\r\n"), result_code );
1605  break;
1606  }
1608  {
1609  packet.AppendFormat( _T(" Result Code:\t %u - Invalid GPI File\r\n"), result_code );
1610  break;
1611  }
1613  {
1614  packet.AppendFormat( _T(" Result Code:\t %u - Error on Opening\r\n"), result_code );
1615  break;
1616  }
1618  {
1619  packet.AppendFormat( _T(" Result Code:\t %u - Error on Closing\r\n"), result_code );
1620  break;
1621  }
1623  {
1624  packet.AppendFormat( _T(" Result Code:\t %u - Finalizing Error\r\n"), result_code );
1625  break;
1626  }
1628  {
1629  packet.AppendFormat( _T(" Result Code:\t %u - Result Not Processed\r\n"), result_code );
1630  break;
1631  }
1633  {
1634  packet.AppendFormat( _T(" Result Code:\t %u - GZIP Error\r\n"), result_code );
1635  break;
1636  }
1637  case FMI_FILE_RESULT_BUSY:
1638  {
1639  packet.AppendFormat( _T(" Result Code:\t %u - Busy\r\n"), result_code );
1640  break;
1641  }
1642  default:
1643  {
1644  packet.AppendFormat( _T("Result Code:\t %u - Unrecognized\r\n"), result_code );
1645  }
1646  }
1647  break;
1648  }
1649 
1650  case FMI_ID_FILE_PACKET_RCPT: //0x0404
1651  {
1652  packet_receipt_data_type receipt;
1653  memset( &receipt, 0, sizeof( receipt ) );
1654  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1655  packet.AppendFormat( _T(" Offset:\t\t %u\r\n"), receipt.offset );
1656  packet.AppendFormat( _T(" Next Offset:\t %u\r\n"), receipt.next_offset );
1657  break;
1658  }
1659 
1660  case FMI_ID_GPI_FILE_INFORMATION_REQUEST: // 0x0406
1661  //no FMI payload associated with this packet
1662  break;
1663 
1664  case FMI_ID_SET_DRIVER_STATUS_LIST_ITEM: // 0x0800
1665  {
1667 
1668  memset( &item, 0, sizeof( item ) );
1669  memcpy( &item, aFmiPayload, minval( aFmiPayloadSize, sizeof( item ) ) );
1670 
1671  packet.AppendFormat( _T(" ID:\t\t 0x%08x\r\n"), item.status_id );
1672  packet.AppendFormat( _T(" Status:\t\t %s\r\n"), formatText( item.status, sizeof( item.status ) ) );
1673  break;
1674  }
1675 
1677  {
1679 
1680  memset( &item, 0, sizeof( item ) );
1681  memcpy( &item, aFmiPayload, minval( aFmiPayloadSize, sizeof( item ) ) );
1682 
1683  packet.AppendFormat( _T(" ID:\t\t 0x%08x\r\n"), item.status_id );
1684  break;
1685  }
1686 
1689  {
1691 
1692  memset( &receipt, 0, sizeof( receipt ) );
1693  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1694 
1695  packet.AppendFormat( _T(" ID:\t\t 0x%08x\r\n"), receipt.status_id );
1696  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean( receipt.result_code ) );
1697  break;
1698  }
1699 
1701  //no FMI payload associated with this packet
1702  break;
1703 
1705  {
1706 #if( FMI_SUPPORT_A607 )
1707  // This packet only has a payload when A607 support is enabled
1709 
1710  memset( &request, 0, sizeof( request ) );
1711  memcpy( &request, aFmiPayload, minval( aFmiPayloadSize, sizeof( request ) ) );
1712 
1713  packet.AppendFormat( _T(" Driver Index:\t %u\r\n"), request.driver_idx );
1714 #endif
1715  break;
1716  }
1717 
1718  case FMI_ID_DRIVER_ID_UPDATE: //0x0811
1719  {
1720  driver_id_data_type driverId;
1721 
1722  memset( &driverId, 0, sizeof( driverId ) );
1723  memcpy( &driverId, aFmiPayload, minval( aFmiPayloadSize, sizeof( driverId ) ) );
1724 
1725  packet.AppendFormat( _T(" Change ID:\t 0x%08x\r\n"), driverId.status_change_id );
1726  packet.AppendFormat( _T(" Change Time:\t 0x%08x\r\n"), driverId.status_change_time );
1727  packet.AppendFormat( _T(" Driver ID:\t %s\r\n"), formatText( driverId.driver_id, sizeof( driverId.driver_id ) ) );
1728  break;
1729  }
1730 
1731  case FMI_ID_DRIVER_ID_RCPT: //0x0812
1732  {
1734 
1735  memset( &receipt, 0, sizeof( receipt ) );
1736  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1737 
1738  packet.AppendFormat( _T(" Change ID:\t 0x%08x\r\n"), receipt.status_change_id );
1739  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean( receipt.result_code ) );
1740  packet.AppendFormat( _T(" Driver Index:\t %u\r\n"), receipt.driver_idx );
1741  break;
1742  }
1743 
1744 #if( FMI_SUPPORT_A607 )
1746  {
1747  driver_id_D607_data_type driverId;
1748 
1749  memset( &driverId, 0, sizeof( driverId ) );
1750  memcpy( &driverId, aFmiPayload, minval( aFmiPayloadSize, sizeof( driverId ) ) );
1751 
1752  packet.AppendFormat( _T(" Change ID:\t 0x%08x\r\n"), driverId.status_change_id );
1753  packet.AppendFormat( _T(" Change Time:\t 0x%08x\r\n"), driverId.status_change_time );
1754  packet.AppendFormat( _T(" Driver Index:\t %u\r\n"), driverId.driver_idx );
1755  packet.AppendFormat( _T(" Driver ID:\t %s\r\n"), formatText( driverId.driver_id, sizeof( driverId.driver_id ) ) );
1756 
1757  if( offset_of( driver_id_D607_data_type, password ) < aFmiPayloadSize )
1758  {
1759  packet.AppendFormat( _T(" Password:\t %s\r\n"), formatText( driverId.password, sizeof( driverId.password ) ) );
1760  }
1761  break;
1762  }
1763 #endif
1764 
1765  case FMI_ID_DRIVER_STATUS_REQUEST: // 0x0820
1766  {
1767 #if( FMI_SUPPORT_A607 )
1768  // This packet only has a payload when A607 support is enabled
1770 
1771  memset( &request, 0, sizeof( request ) );
1772  memcpy( &request, aFmiPayload, minval( aFmiPayloadSize, sizeof( request ) ) );
1773 
1774  packet.AppendFormat( _T(" Driver Index:\t %u\r\n"), request.driver_idx );
1775 #endif
1776  break;
1777  }
1778 
1779  case FMI_ID_DRIVER_STATUS_UPDATE: // 0x0821
1780  {
1781  driver_status_data_type status;
1782 
1783  memset( &status, 0, sizeof( status ) );
1784  memcpy( &status, aFmiPayload, minval( aFmiPayloadSize, sizeof( status ) ) );
1785 
1786  packet.AppendFormat( _T(" Change ID:\t 0x%08x\r\n"), status.status_change_id );
1787  packet.AppendFormat( _T(" Change Time:\t 0x%08x\r\n"), status.status_change_time );
1788  packet.AppendFormat( _T(" Status ID:\t 0x%08x\r\n"), status.driver_status );
1789  break;
1790  }
1791 
1792  case FMI_ID_DRIVER_STATUS_RCPT: // 0x0822
1793  {
1795 
1796  memset( &receipt, 0, sizeof( receipt ) );
1797  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1798 
1799  packet.AppendFormat( _T(" Change ID:\t 0x%08x\r\n"), receipt.status_change_id );
1800  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean( receipt.result_code ) );
1801  packet.AppendFormat( _T(" Driver Index:\t %u\r\n"), receipt.driver_idx );
1802  break;
1803  }
1804 #endif //FMI_SUPPORT_A604
1805 
1806 #if( FMI_SUPPORT_A607 )
1807  case FMI_ID_DRIVER_STATUS_UPDATE_D607: // 0x0823
1808  {
1810 
1811  memset( &status, 0, sizeof( status ) );
1812  memcpy( &status, aFmiPayload, minval( aFmiPayloadSize, sizeof( status ) ) );
1813 
1814  packet.AppendFormat( _T(" Change ID:\t 0x%08x\r\n"), status.status_change_id );
1815  packet.AppendFormat( _T(" Change Time:\t 0x%08x\r\n"), status.status_change_time );
1816  packet.AppendFormat( _T(" Driver Index:\t %u\r\n"), status.driver_idx );
1817  packet.AppendFormat( _T(" Status ID:\t 0x%08x\r\n"), status.driver_status );
1818  break;
1819  }
1820 #endif
1821 
1822 #if( FMI_SUPPORT_A606 )
1823  case FMI_SAFE_MODE: //0x0900
1824  {
1825  safe_mode_speed_data_type request;
1826 
1827  memset( &request, 0, sizeof( request ) );
1828  memcpy( &request, aFmiPayload, minval( aFmiPayloadSize, sizeof( request ) ) );
1829 
1830  if( request.speed < 0 )
1831  {
1832  packet.AppendFormat( _T(" FMI Safe Mode:\tTurn Off\r\n") );
1833  }
1834  else
1835  {
1836  packet.AppendFormat( _T(" Speed(m/s):\tTurn On\r\n") );
1837  }
1838  packet.AppendFormat( _T(" Speed(m/s):\t%f\r\n"),request.speed );
1839  break;
1840  }
1841  case FMI_SAFE_MODE_RESP: //0x0901
1842  {
1844 
1845  memset( &receipt, 0, sizeof( receipt ) );
1846  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1847 
1848  packet.AppendFormat( _T(" Success:\t %s\r\n"), formatBoolean( receipt.result_code ) );
1849  break;
1850  }
1851 #endif
1852 
1853 #if( FMI_SUPPORT_A608 )
1854  case FMI_SPEED_LIMIT_SET: //0X1000
1855  {
1856  speed_limit_data_type data;
1857 
1858  memset( &data, 0, sizeof( data ) );
1859  memcpy( &data, aFmiPayload, minval( aFmiPayloadSize, sizeof( data ) ) );
1860 
1861  CString mode;
1862  switch( data.mode )
1863  {
1864  case SPEED_LIMIT_MODE_CAR:
1865  mode.Format( _T("Car" ) );
1866  break;
1867  case SPEED_LIMIT_MODE_OFF:
1868  mode.Format( _T("Off") );
1869  break;
1871  mode.Format( _T("Truck") );
1872  break;
1873  default:
1874  mode.Format( _T("Unknown") );
1875  break;
1876  }
1877 
1878  packet.AppendFormat( _T(" Mode:\t\t %d - %s\r\n"), data.mode, mode );
1879  packet.AppendFormat( _T(" Time Over:\t%d(secs)\r\n"), data.time_over );
1880  packet.AppendFormat( _T(" Time Under:\t%d(secs)\r\n"), data.time_under );
1881  packet.AppendFormat( _T(" Alert User:\t%s\r\n"), formatBoolean( data.alert_user ) );
1882  packet.AppendFormat( _T(" Threshold:\t%f(m/s) - %.2f(mph) - %.2f(kph)\r\n"), data.threshold, data.threshold * cMsToMph, data.threshold * cMsToKph );
1883 
1884  break;
1885  }
1886  case FMI_SPEED_LIMIT_RCPT: //0X1001
1887  {
1889 
1890  memset( &receipt, 0, sizeof( receipt ) );
1891  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1892 
1893  CString result_code;
1894  switch( receipt.result_code )
1895  {
1897  result_code.Format( _T("Success") );
1898  break;
1900  result_code.Format( _T("Error") );
1901  break;
1903  result_code.Format( _T("Unsupported" ) );
1904  break;
1905  default:
1906  result_code.Format( _T("Unknown") );
1907  break;
1908  }
1909 
1910  packet.AppendFormat( _T(" Result Code:\t %d - %s\r\n"), receipt.result_code, result_code );
1911 
1912  break;
1913  }
1914  case FMI_SPEED_LIMIT_ALERT: //0X1002
1915  {
1917 
1918  memset( &alert, 0, sizeof( alert ) );
1919  memcpy( &alert, aFmiPayload, minval( aFmiPayloadSize, sizeof( alert ) ) );
1920 
1921  CString category;
1922  switch( alert.category )
1923  {
1925  category.Format( _T("Begin") );
1926  break;
1928  category.Format( _T("Change") );
1929  break;
1930  case SPEED_LIMIT_ALERT_END:
1931  category.Format( _T("End") );
1932  break;
1934  category.Format( _T("Error") );
1935  break;
1937  category.Format( _T("Invalid") );
1938  break;
1939  default:
1940  category.Format( _T("Unknown") );
1941  break;
1942  }
1943 
1944  packet.AppendFormat( _T(" Category:\t %d - %s\r\n"), alert.category, category );
1945  packet.AppendFormat( _T(" Lat:\t\t 0x%08x - %s\r\n"), alert.posn.lat, formatLatitude( alert.posn.lat ) );
1946  packet.AppendFormat( _T(" Lon:\t\t 0x%08x - %s\r\n"), alert.posn.lon, formatLongitude( alert.posn.lon ) );
1947  packet.AppendFormat( _T(" Timestamp:\t 0x%08x - %s\r\n"), alert.timestamp, formatTime( alert.timestamp ) );
1948  packet.AppendFormat( _T(" Speed:\t\t %f(m/s) - %.2f(mph) - %.2f(kph)\r\n"), alert.speed, alert.speed * cMsToMph, alert.speed * cMsToKph );
1949  packet.AppendFormat( _T(" Speed Limit:\t %f(m/s) - %.2f(mph) - %.2f(kph)\r\n"), alert.speed_limit, alert.speed_limit * cMsToMph, alert.speed_limit * cMsToKph );
1950  packet.AppendFormat( _T(" Max Speed:\t %f(m/s) - %.2f(mph) - %.2f(kph)\r\n"), alert.max_speed, alert.max_speed * cMsToMph, alert.max_speed * cMsToKph );
1951  break;
1952  }
1953  case FMI_SPEED_LIMIT_ALERT_RCPT: //0x1003
1954  {
1956 
1957  memset( &receipt, 0, sizeof( receipt ) );
1958  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
1959 
1960  packet.AppendFormat( _T(" Timestamp:\t 0x%08x - %s\r\n"), receipt.timestamp, formatTime( receipt.timestamp ) );
1961  break;
1962  }
1963 #endif
1964 
1965 #if( FMI_SUPPORT_A610 )
1966  case FMI_SET_ODOMETER_REQUEST: // 0x1100
1967  {
1969  memset( &data, 0, sizeof( data) );
1970  memcpy( &data, aFmiPayload, minval( sizeof( data), aFmiPayloadSize ) );
1971 
1972  packet.AppendFormat( _T(" Odometer Value:\t%d(mi)\r\n"), data.odometer_value );
1973  break;
1974  }
1975  case FMI_DRIVER_LOGIN_REQUEST: // 0x1101
1976  {
1978  memset( &data, 0, sizeof( data ) );
1979  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
1980 
1981  packet.AppendFormat( _T(" Driver ID:\t %s\r\n"), CString( data.driver_id ) );
1982  packet.AppendFormat( _T(" Driver Password:%s\r\n"), CString( data.driver_password ) );
1983  packet.AppendFormat( _T(" UI Timestamp:\t 0x%08x - %s\r\n"), data.ui_timestamp, formatTime( data.ui_timestamp ) );
1984  break;
1985  }
1986  case FMI_DRIVER_LOGIN_RESPONSE: // 0x1102
1987  {
1989  memset( &receipt, 0, sizeof( receipt ) );
1990  memcpy( &receipt, aFmiPayload, minval( sizeof( receipt ), aFmiPayloadSize ) );
1991 
1992  packet.AppendFormat( _T(" UI Timestamp:\t 0x%08x - %s\r\n"), receipt.ui_timestamp, formatTime( receipt.ui_timestamp ) );
1993  packet.AppendFormat( _T(" Result Code:\t %d\r\n"), receipt.result_code );
1994  break;
1995  }
1997  {
1999  memset( &data, 0, sizeof( data ) );
2000  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2001 
2002  packet.AppendFormat( _T(" Driver ID:\t %s\r\n"), CString( data.driver_id ) );
2003  break;
2004  }
2006  case FMI_DRIVER_PROFILE_UPDATE: //0x1105
2007  {
2009  memset( &receipt, 0, sizeof( receipt ) );
2010  memcpy( &receipt, aFmiPayload, minval( sizeof( receipt ), aFmiPayloadSize ) );
2011 
2012  packet.AppendFormat( _T(" PIN:\t\t %d\r\n"), receipt.pin );
2013  packet.AppendFormat( _T(" First Name:\t %s\r\n"), CString( receipt.first_name ) );
2014  packet.AppendFormat( _T(" Last Name:\t %s\r\n"), CString( receipt.last_name ) );
2015  packet.AppendFormat( _T(" Driver ID:\t %s\r\n"), CString( receipt.driver_id ) );
2016  packet.AppendFormat( _T(" Carrier Name:\t %s\r\n"), CString( receipt.carrier_name ) );
2017  packet.AppendFormat( _T(" Carrier ID:\t %s\r\n"), CString( receipt.carrier_id ) );
2018  packet.AppendFormat( _T(" Long Term Rule Set:\t %d\r\n"), receipt.long_term_rule_set );
2019  packet.AppendFormat( _T(" Time Zone:\t %d\r\n"), receipt.time_zone );
2020  packet.AppendFormat( _T(" Status:\t\t %d\r\n"), receipt.status );
2021  packet.AppendFormat( _T(" Result Code:\t %d\r\n"), receipt.result_code );
2022  break;
2023  }
2024  case FMI_DRIVER_PROFILE_UPDATE_RESPONSE: //0X110C
2025  {
2026  fmi_ack_type receipt;
2027  memset( &receipt, 0, sizeof( receipt ) );
2028  memcpy( &receipt, aFmiPayload, minval( sizeof( receipt ), aFmiPayloadSize ) );
2029 
2030  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( receipt.driver_id ) );
2031  switch( receipt.result_code )
2032  {
2033  case UPDATE_ACCEPT:
2034  packet.AppendFormat( _T(" Result Code:\t %d - Accepted\r\n"), receipt.result_code );
2035  break;
2036  case UPDATE_FAIL:
2037  packet.AppendFormat( _T(" Result Code:\t %d - Failed\r\n"), receipt.result_code );
2038  break;
2039  case UPDATE_DECLINE:
2040  packet.AppendFormat( _T(" Result Code:\t %d - Declined\r\n"), receipt.result_code );
2041  break;
2042  case UPDATE_NOT_READY:
2043  packet.AppendFormat( _T(" Result Code:\t %d - Not Ready\r\n"), receipt.result_code );
2044  break;
2045  case UPDATE_NO_DATA:
2046  packet.AppendFormat( _T(" Result Code:\t %d - No Data\r\n"), receipt.result_code );
2047  break;
2048  case UPDATE_STORAGE_ERROR:
2049  packet.AppendFormat( _T(" Result Code:\t %d - Storage Error\r\n"), receipt.result_code );
2050  break;
2051  case UPDATE_RESULT_ERROR:
2052  packet.AppendFormat( _T(" Result Code:\t %d - Result Error\r\n"), receipt.result_code );
2053  break;
2055  packet.AppendFormat( _T(" Result Code:\t %d - Interface Error\r\n"), receipt.result_code );
2056  break;
2057  }
2058  break;
2059  }
2060  case FMI_DRIVER_STATUS_UPDATE_REQUEST: //0X1106
2061  {
2063  memset( &data, 0, sizeof( data ) );
2064  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2065 
2066  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2067  break;
2068  }
2069  case FMI_DRIVER_STATUS_UPDATE_RESPONSE: //0X1107
2070  {
2072  memset( &receipt, 0, sizeof( receipt ) );
2073  memcpy( &receipt, aFmiPayload, minval( sizeof( receipt ), aFmiPayloadSize ) );
2074 
2075  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( receipt.driver_id ) );
2076  packet.AppendFormat( _T(" Result Code:\t %d\r\n"), receipt.result_code );
2077 
2078  break;
2079  }
2080  case FMI_DRIVER_STATUS_UPDATE_RECEIPT: //0X1108
2081  {
2083  memset( &data, 0, sizeof( data ) );
2084  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2085 
2086  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2087 
2088  switch( data.result_code )
2089  {
2090  case FMI_LOGIN_NO_ERRORS:
2091  {
2092  packet.AppendFormat( _T( " Result Code:\t %d - No Errors\r\n" ), data.result_code );
2093  break;
2094  }
2096  {
2097  packet.AppendFormat( _T( " Result Code:\t %d - Wrong ID Server Response\r\n" ), data.result_code );
2098  break;
2099  }
2101  {
2102  packet.AppendFormat( _T( " Result Code:\t %d - Invalid ID Server Response\r\n" ), data.result_code );
2103  break;
2104  }
2106  {
2107  packet.AppendFormat( _T( " Result Code:\t %d - Unexpected Response Packet\r\n" ), data.result_code );
2108  break;
2109  }
2111  {
2112  packet.AppendFormat( _T( " Result Code:\t %d - Shipment DB Error\r\n" ), data.result_code );
2113  break;
2114  }
2115  }
2116  break;
2117  }
2118  case FMI_DOWNLOAD_SHIPMENTS_REQUEST: //0X1109
2119  {
2121  memset( &data, 0, sizeof( data ) );
2122  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2123 
2124  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2125  break;
2126  }
2127  case FMI_SHIPMENT_DOWNLOAD_RESPONSE: //0X110A
2128  {
2130  memset( &data, 0, sizeof( data ) );
2131  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2132 
2133  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2134 
2135  switch( data.server_result_code )
2136  {
2137  case CONTAINS_DATA:
2138  {
2139  packet.AppendFormat( _T( " Result Code:\t %d - Next Shipment\r\n" ), data.server_result_code );
2140  packet.AppendFormat( _T( " Srvr Timestamp: 0x%08x - %s\r\n" ), data.server_timestamp, formatTime( data.server_timestamp ) );
2141  packet.AppendFormat( _T( " Srvr Start Time:\t 0x%08x - %s\r\n" ), data.server_start_time, formatTime( data.server_start_time ) );
2142  packet.AppendFormat( _T( " Srvr End Time:\t 0x%08x - %s\r\n" ), data.server_end_time, formatTime( data.server_end_time ) );
2143  packet.AppendFormat( _T( " Shipper Name:\t %s\r\n" ), CString( data.server_shipper_name ) );
2144  packet.AppendFormat( _T( " Document Num:\t %s\r\n" ), CString( data.server_doc_number ) );
2145  packet.AppendFormat( _T( " Commodity:\t %s\r\n" ), CString( data.server_commodity ) );
2146  break;
2147  }
2148  case EMPTY_DATA:
2149  {
2150  packet.AppendFormat( _T( " Result Code:\t %d - No Shipments\r\n" ), data.server_result_code );
2151  break;
2152  }
2153  case UNKNOWN_DRIVER:
2154  {
2155  packet.AppendFormat( _T( " Result Code:\t %d - Unknown Driver\r\n" ), data.server_result_code );
2156  break;
2157  }
2158  case UNSUPPORTED:
2159  {
2160  packet.AppendFormat( _T( " Result Code:\t %d - Unsupported\r\n" ), data.server_result_code );
2161  break;
2162  }
2163  }
2164  break;
2165  }
2166  case FMI_SHIPMENT_DOWNLOAD_RECEIPT: //0X110B
2167  {
2169  memset( &data, 0, sizeof( data ) );
2170  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2171 
2172  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2173 
2174  switch( data.result_code )
2175  {
2176  case FMI_LOGIN_NO_ERRORS:
2177  {
2178  packet.AppendFormat( _T( " Result Code:\t %d - No Errors\r\n" ), data.result_code );
2179  break;
2180  }
2182  {
2183  packet.AppendFormat( _T( " Result Code:\t %d - Wrong ID Server Response\r\n" ), data.result_code );
2184  break;
2185  }
2187  {
2188  packet.AppendFormat( _T( " Result Code:\t %d - Invalid ID Server Response\r\n" ), data.result_code );
2189  break;
2190  }
2192  {
2193  packet.AppendFormat( _T( " Result Code:\t %d - Unexpected Response Packet\r\n" ), data.result_code );
2194  break;
2195  }
2197  {
2198  packet.AppendFormat( _T( " Result Code:\t %d - Shipment DB Error\r\n" ), data.result_code );
2199  break;
2200  }
2201  }
2202  break;
2203  }
2204  case FMI_ANNOTATION_DOWNLOAD_REQUEST: //0X110D
2205  {
2207  memset( &data, 0, sizeof( data ) );
2208  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2209 
2210  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2211  break;
2212  }
2213  case FMI_ANNOTATION_DOWNLOAD_RESPONSE: //0X110E
2214  {
2216  memset( &data, 0, sizeof( data ) );
2217  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2218 
2219  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2220 
2221  switch( data.server_result_code )
2222  {
2223  case CONTAINS_DATA:
2224  {
2225  packet.AppendFormat( _T( " Result Code:\t %d - Next Annotation\r\n" ), data.server_result_code );
2226  packet.AppendFormat( _T( " Srvr Timestamp: 0x%08x - %s\r\n" ), data.server_timestamp, formatTime( data.server_timestamp ) );
2227  packet.AppendFormat( _T( " Srvr Start Time:\t 0x%08x - %s\r\n" ), data.server_start_time, formatTime( data.server_start_time ) );
2228  packet.AppendFormat( _T( " Srvr End Time:\t 0x%08x - %s\r\n" ), data.server_end_time, formatTime( data.server_end_time ) );
2229  packet.AppendFormat( _T( " Annotation:\t%s\r\n" ), data.server_annotation );
2230  break;
2231  }
2232  case EMPTY_DATA:
2233  {
2234  packet.AppendFormat( _T( " Result Code:\t %d - No Annotations\r\n" ), data.server_result_code );
2235  break;
2236  }
2237  case UNKNOWN_DRIVER:
2238  {
2239  packet.AppendFormat( _T( " Result Code:\t %d - Unknown Driver\r\n" ), data.server_result_code );
2240  break;
2241  }
2242  case UNSUPPORTED:
2243  {
2244  packet.AppendFormat( _T( " Result Code:\t %d - Unsupported\r\n" ), data.server_result_code );
2245  break;
2246  }
2247  }
2248  break;
2249  }
2250  case FMI_ANNOTATION_DOWNLOAD_RECEIPT: //0X110F
2251  {
2253  memset( &data, 0, sizeof( data ) );
2254  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2255 
2256  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( data.driver_id ) );
2257 
2258  switch( data.result_code )
2259  {
2260  case FMI_LOGIN_NO_ERRORS:
2261  {
2262  packet.AppendFormat( _T( " Result Code:\t %d - No Errors\r\n" ), data.result_code );
2263  break;
2264  }
2266  {
2267  packet.AppendFormat( _T( " Result Code:\t %d - Wrong ID Server Response\r\n" ), data.result_code );
2268  break;
2269  }
2271  {
2272  packet.AppendFormat( _T( " Result Code:\t %d - Invalid ID Server Response\r\n" ), data.result_code );
2273  break;
2274  }
2276  {
2277  packet.AppendFormat( _T( " Result Code:\t %d - Unexpected Response Packet\r\n" ), data.result_code );
2278  break;
2279  }
2281  {
2282  packet.AppendFormat( _T( " Result Code:\t %d - Annotation DB Error\r\n" ), data.result_code );
2283  break;
2284  }
2285  }
2286  break;
2287  }
2288 #endif
2289 
2290 #if( FMI_SUPPORT_A615 )
2291  case FMI_IFTA_DATA_FETCH_REQUEST: //0x0006
2292  {
2294  memset( &data, 0, sizeof( data ) );
2295  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2296 
2297  packet.AppendFormat( _T( " Start Time:\t 0x%08x - %s\r\n" ), data.start_time, formatTime( data.start_time ) );
2298  packet.AppendFormat( _T( " End Time:\t 0x%08x - %s\r\n" ), data.end_time, formatTime( data.end_time ) );
2299 
2300  break;
2301  }
2302  case FMI_IFTA_DATA_FETCH_RECEIPT: //0x0007
2303  {
2305  memset( &data, 0, sizeof( data ) );
2306  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2307 
2308  appendIFTADataModResultCode( packet, data.result_code );
2309 
2310  break;
2311  }
2312  case FMI_IFTA_DATA_DELETE_REQUEST: //0x0008
2313  {
2315  memset( &data, 0, sizeof( data ) );
2316  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2317 
2318  packet.AppendFormat( _T( " Start Time:\t 0x%08x - %s\r\n" ), data.start_time, formatTime( data.start_time ) );
2319  packet.AppendFormat( _T( " End Time:\t 0x%08x - %s\r\n" ), data.end_time, formatTime( data.end_time ) );
2320 
2321  break;
2322  }
2323  case FMI_IFTA_DATA_DELETE_RECEIPT: //0x0009
2324  {
2326  memset( &data, 0, sizeof( data ) );
2327  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2328 
2329  appendIFTADataModResultCode( packet, data.result_code );
2330 
2331  break;
2332  }
2334  case FMI_DRIVER_PROFILE_UPDATE_V2: //0x1111
2335  {
2337  memset( &receipt, 0, sizeof( receipt ) );
2338  memcpy( &receipt, aFmiPayload, minval( sizeof( receipt ), aFmiPayloadSize ) );
2339 
2340  packet.AppendFormat( _T( " First Name:\t %s\r\n" ), CString( receipt.first_name ) );
2341  packet.AppendFormat( _T( " Last Name:\t %s\r\n" ), CString( receipt.last_name ) );
2342  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( receipt.driver_id ) );
2343  packet.AppendFormat( _T( " Carrier Name:\t %s\r\n" ), CString( receipt.carrier_name ) );
2344  packet.AppendFormat( _T( " Carrier ID:\t %s\r\n" ), CString( receipt.carrier_id ) );
2345  packet.AppendFormat( _T( " Long Term Rule Set:\t %d\r\n" ), receipt.long_term_rule_set );
2346  packet.AppendFormat( _T( " Load Type Rule Set:\t %d\r\n" ), receipt.load_type_rule_set );
2347  packet.AppendFormat( _T( " Time Zone:\t %d\r\n" ), receipt.time_zone );
2348  packet.AppendFormat( _T( " Adverse Cond. Time:\t 0x%08x - %s\r\n" ), receipt.adverse_condition_time, formatTime( receipt.adverse_condition_time ) );
2349  packet.AppendFormat( _T( " Status:\t\t %d\r\n" ), receipt.status );
2350  packet.AppendFormat( _T( " Result Code:\t %d\r\n" ), receipt.result_code );
2351  break;
2352  }
2354  {
2356  memset( &data, 0, sizeof( data ) );
2357  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2358 
2359  packet.AppendFormat( _T( " Enable:\t\t %d\r\n" ), data.enable );
2360  packet.AppendFormat( _T( " Threshold:\t %d second(s)\r\n" ), data.stop_moving_threshold );
2361  break;
2362  }
2364  {
2366  memset( &data, 0, sizeof( data ) );
2367  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2368 
2369  packet.AppendFormat( _T( " Enable:\t\t %d\r\n" ), data.enable );
2370  packet.AppendFormat( _T( " Threshold:\t %d second(s)\r\n" ), data.stop_moving_threshold );
2371  switch( data.result_type )
2372  {
2374  {
2375  packet.Append( _T( " Result Type:\t OK\r\n" ) );
2376  break;
2377  }
2379  {
2380  packet.Append( _T( " Result Type:\t Threshold set to Minimum\r\n" ) );
2381  break;
2382  }
2384  {
2385  packet.Append( _T( " Result Type:\t Threshold set to Maximum\r\n" ) );
2386  break;
2387  }
2389  {
2390  packet.Append( _T( " Result Type:\t Failure\r\n" ) );
2391  break;
2392  }
2393  }
2394  break;
2395  }
2396  case FMI_HOS_8_HOUR_RULE_ENABLE_REQUEST: // 0X1312
2397  case FMI_HOS_8_HOUR_RULE_ENABLE_RECEIPT: // 0X1313
2398  {
2399  boolean data;
2400  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2401 
2402  packet.AppendFormat( _T( " Enable:\t\t %s\r\n" ), data ? _T( "true" ) : _T( "false" ) );
2403  break;
2404  }
2405 #endif // end FMI_SUPPORT_A615
2406 
2407 #if( FMI_SUPPORT_A612 )
2408  case FMI_CUSTOM_FORM_DEL_REQUEST: // 0x1200
2409  case FMI_CUSTOM_FORM_GET_POS_REQUEST: // 0x1204
2410  {
2411  uint32 form_id = 0;
2412 
2413  memcpy( &form_id, aFmiPayload, minval( aFmiPayloadSize, sizeof( form_id ) ) );
2414 
2415  packet.AppendFormat( _T( " Form ID:\t %d\r\n" ), form_id );
2416 
2417  break;
2418  }
2419  case FMI_CUSTOM_FORM_DEL_RECEIPT: // 0x1201
2420  {
2422 
2423  memset( &message, 0, sizeof( message ) );
2424  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2425 
2426  packet.AppendFormat( _T( " Form ID:\t %d\r\n" ), message.form_id );
2427  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), message.return_code, CString( getCustomFormErrorMsg( (FMI_cf_rcode) message.return_code ) ) );
2428 
2429  break;
2430  }
2431  case FMI_CUSTOM_FORM_MOVE_REQUEST: // 0x1202
2432  {
2433  custom_form_move_type message;
2434 
2435  memset( &message, 0, sizeof( message ) );
2436  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2437 
2438  packet.AppendFormat( _T( " Form ID:\t %d\r\n" ), message.form_id );
2439  packet.AppendFormat( _T( " To Position:\t %d\r\n" ), message.new_position );
2440 
2441  break;
2442  }
2443  case FMI_CUSTOM_FORM_MOVE_RECEIPT: // 0x1203
2444  case FMI_CUSTOM_FORM_GET_POS_RECEIPT: // 0x1205
2445  {
2447 
2448  memset( &message, 0, sizeof( message ) );
2449  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2450 
2451  packet.AppendFormat( _T( " Form ID:\t %d\r\n" ), message.form_id );
2452  packet.AppendFormat( _T( " Position:\t %d\r\n" ), message.current_position );
2453  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), message.return_code, CString( getCustomFormErrorMsg( (FMI_cf_rcode) message.return_code ) ) );
2454 
2455  break;
2456  }
2457 #endif
2458 
2459 #if( FMI_SUPPORT_A621 )
2460  case FMI_CUSTOM_FORM_SHOW_REQUEST: // 0x1206
2461  {
2462  uint32 form_id = 0;
2463 
2464  memcpy( &form_id, aFmiPayload, minval( aFmiPayloadSize, sizeof( form_id ) ) );
2465 
2466  packet.AppendFormat( _T( " Form ID:\t %d\r\n" ), form_id );
2467 
2468  break;
2469  }
2470  case FMI_CUSTOM_FORM_SHOW_RECEIPT: // 0x1207
2471  {
2472  custom_form_show_ack_type message;
2473 
2474  memset( &message, 0, sizeof( message ) );
2475  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2476 
2477  packet.AppendFormat( _T( " Form ID:\t %d\r\n" ), message.form_id );
2478  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), message.return_code, CString( getCustomFormErrorMsg( (FMI_cf_rcode) message.return_code ) ) );
2479 
2480  break;
2481  }
2482 #endif
2483 
2484 
2485 #if( FMI_SUPPORT_A614 )
2486  case FMI_STOP_CALC_ACK_REQUEST: // 0x1220
2487  {
2488  stop_calc_ack_type message;
2489 
2490  memset( &message, 0, sizeof( message ) );
2491  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2492 
2493  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), message.unique_id );
2494  packet.AppendFormat( _T( " Distance:\t 0x%08x\r\n" ), message.distance );
2495  switch ( message.result_code )
2496  {
2497  case 0:
2498  {
2499  packet.AppendFormat( _T( " Result:\t\t %d - Success\r\n" ), message.result_code );
2500  break;
2501  }
2502  default:
2503  {
2504  packet.AppendFormat( _T( " Result:\t\t %d - Failure\r\n" ), message.result_code );
2505  break;
2506  }
2507  }
2508  break;
2509  }
2510  case FMI_STOP_CALC_ACK_RECEIPT: // 0x1221
2511  {
2512  stop_calc_ack_rcpt_type message;
2513 
2514  memset( &message, 0, sizeof( message ) );
2515  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2516 
2517  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), message.unique_id );
2518  break;
2519  }
2520 #endif
2521 #if( FMI_SUPPORT_A613 )
2522  case FMI_CUSTOM_AVOID_ADD_REQUEST: // 0x1230
2523  {
2524  custom_avoid_type message;
2525 
2526  memset( &message, 0, sizeof( message ) );
2527  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2528 
2529  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), message.unique_id );
2530  packet.AppendFormat( _T( " North:\t\t %08.6f\t(%d)\r\n" ), UTIL_convert_semicircles_to_degrees( message.point1.lat ), message.point1.lat );
2531  packet.AppendFormat( _T( " East:\t\t %08.6f\t(%d)\r\n" ), UTIL_convert_semicircles_to_degrees( message.point1.lon ), message.point1.lon );
2532  packet.AppendFormat( _T( " South:\t\t %08.6f\t(%d)\r\n" ), UTIL_convert_semicircles_to_degrees( message.point2.lat ), message.point2.lat );
2533  packet.AppendFormat( _T( " West:\t\t %08.6f\t(%d)\r\n" ), UTIL_convert_semicircles_to_degrees( message.point2.lon ), message.point2.lon );
2534  packet.AppendFormat( _T( " Enabled:\t %s\r\n" ), message.enable ? _T( "true" ) : _T( "false" ) );
2535  packet.AppendFormat( _T( " Name:\t\t %s\r\n" ), formatText( message.name, sizeof( message.name ) ) );
2536 
2537  break;
2538  }
2539  case FMI_CUSTOM_AVOID_DEL_REQUEST: // 0x1232
2540  {
2541  custom_avoid_delete_type message;
2542  memset( &message, 0, sizeof( message ) );
2543  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2544 
2545  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), message.unique_id );
2546 
2547  break;
2548  }
2549  case FMI_CUSTOM_AVOID_TOGGLE_REQUEST: // 0x1235
2550  {
2551  custom_avoid_enable_type message;
2552  memset( &message, 0, sizeof( message ) );
2553  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2554 
2555  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), message.unique_id );
2556  packet.AppendFormat( _T( " Enabled:\t %s\r\n" ), message.enable == 1 ? _T( "true" ) : _T( "false" ) );
2557 
2558  break;
2559  }
2562  {
2564  memset( &message, 0, sizeof( message ) );
2565  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2566 
2567  packet.AppendFormat( _T( " Orig Time:\t 0x%08x\r\n" ), message.origination_time );
2568  packet.AppendFormat( _T( " Orig Time:\t 0x%08x - %s\r\n"), message.origination_time, formatTime( message.origination_time ) );
2569  packet.AppendFormat( _T( " Enabled:\t %s\r\n" ), message.enable == 1 ? _T( "true" ) : _T( "false" ) );
2570 
2571  break;
2572  }
2573  case FMI_CUSTOM_AVOID_ADD_RECEIPT: // 0x1231
2574  case FMI_CUSTOM_AVOID_DEL_RECEIPT: // 0x1233
2575  case FMI_CUSTOM_AVOID_TOGGLE_RECEIPT: // 0x1235
2576  {
2577  custom_avoid_rcpt_type receipt;
2578  memset( &receipt, 0, sizeof( receipt ) );
2579  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
2580 
2581  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), receipt.unique_id );
2582  switch ( receipt.result_code ) {
2583  case CUSTOM_AVOID_SUCCESS:
2584  {
2585  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Success") );
2586  break;
2587  }
2589  {
2590  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Error - ID not found") );
2591  break;
2592  }
2593  case CUSTOM_AVOID_ERR_FULL:
2594  {
2595  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Error - Full") );
2596  break;
2597  }
2598  case CUSTOM_AVOID_ERR_NV:
2599  {
2600  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Error - NV") );
2601  break;
2602  }
2604  {
2605  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Error - NM in use") );
2606  break;
2607  }
2609  {
2610  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Error - ID out of range") );
2611  break;
2612  }
2614  {
2615  packet.AppendFormat( _T( " Result:\t\t %d - %s\r\n" ), receipt.result_code, _T( "Error - Custom Avoidance feature is not enabled") );
2616  break;
2617  }
2618  }
2619 
2620  break;
2621  }
2622 #endif
2623 #if( FMI_SUPPORT_A615 )
2624  case FMI_AOBRD_DRIVER_LOGOFF_REQUEST: // 0x1310
2625  {
2626  fmi_logoff_driver_request message;
2627 
2628  memset( &message, 0, sizeof( message ) );
2629  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
2630 
2631  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( message.driver_id ) );
2632  break;
2633  }
2634  case FMI_AOBRD_DRIVER_LOGOFF_RECEIPT: // 0x1311
2635  {
2636  fmi_logoff_driver_receipt receipt;
2637 
2638  memset( &receipt, 0, sizeof( receipt ) );
2639  memcpy( &receipt, aFmiPayload, minval( aFmiPayloadSize, sizeof( receipt ) ) );
2640 
2641  packet.AppendFormat( _T( " Driver ID:\t %s\r\n" ), CString( receipt.driver_id ) );
2642  packet.AppendFormat( _T( " Status:\t\t %u\r\n" ), receipt.status );
2643  packet.AppendFormat( _T( " Result code:\t %u\r\n" ), receipt.result_code );
2644  break;
2645  }
2646 #endif
2647 
2648 #if( FMI_SUPPORT_A616 )
2649 
2650  case FMI_SET_BAUD_REQUEST: //0x0011
2651  {
2652  fmi_set_baud_request data;
2653  memset( &data, 0, sizeof( data ) );
2654  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2655 
2656  switch( data.request_type )
2657  {
2659  {
2660  packet.Append( _T( " Request Type:\t New Rate\r\n" ) );
2661  break;
2662  }
2664  {
2665  packet.Append( _T( " Request Type:\t Rate Sync\r\n" ) );
2666  break;
2667  }
2668  }
2669  switch( data.baud_rate_type )
2670  {
2671  case FMI_BAUD_RATE_9600:
2672  {
2673  packet.Append( _T( " Baud Rate:\t 9600\r\n" ) );
2674  break;
2675  }
2676  case FMI_BAUD_RATE_38400:
2677  {
2678  packet.Append( _T( " Baud Rate:\t 38400\r\n" ) );
2679  break;
2680  }
2681  case FMI_BAUD_RATE_57600:
2682  {
2683  packet.Append( _T( " Baud Rate:\t 57600\r\n" ) );
2684  break;
2685  }
2686  }
2687  break;
2688  }
2689  case FMI_SET_BAUD_RECEIPT: //0x0012
2690  {
2691  fmi_set_baud_receipt data;
2692  memset( &data, 0, sizeof( data ) );
2693  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2694 
2695  switch( data.request_type )
2696  {
2698  {
2699  packet.Append( _T( " Request Type:\t New Rate\r\n" ) );
2700  break;
2701  }
2703  {
2704  packet.Append( _T( " Request Type:\t Rate Sync\r\n" ) );
2705  break;
2706  }
2707  }
2708  switch( data.baud_rate_type )
2709  {
2710  case FMI_BAUD_RATE_9600:
2711  {
2712  packet.Append( _T( " Baud Rate:\t 9600\r\n" ) );
2713  break;
2714  }
2715  case FMI_BAUD_RATE_38400:
2716  {
2717  packet.Append( _T( " Baud Rate:\t 38400\r\n" ) );
2718  break;
2719  }
2720  case FMI_BAUD_RATE_57600:
2721  {
2722  packet.Append( _T( " Baud Rate:\t 57600\r\n" ) );
2723  break;
2724  }
2725  }
2726  switch( data.result_code )
2727  {
2728  case FMI_BAUD_RATE_OK:
2729  {
2730  packet.Append( _T( " Result Code:\t Ok\r\n" ) );
2731  break;
2732  }
2734  {
2735  packet.Append( _T( " Result Code:\t Server Error (Request Type)\r\n" ) );
2736  break;
2737  }
2739  {
2740  packet.Append( _T( " Result Code:\t Server Error (Rate)\r\n" ) );
2741  break;
2742  }
2744  {
2745  packet.Append( _T( " Result Code:\t Feature Disabled\r\n" ) );
2746  break;
2747  }
2749  {
2750  packet.Append( _T( " Result Code:\t Client Error\r\n" ) );
2751  break;
2752  }
2753  case FMI_BAUD_SET_ERROR:
2754  {
2755  packet.Append( _T( " Result Code:\t Baud Set Error\r\n" ) );
2756  break;
2757  }
2759  {
2760  packet.Append( _T( " Result Code:\t Plug ID Error\r\n" ) );
2761  break;
2762  }
2763  }
2764  break;
2765  }
2766 #endif
2767 #if( FMI_SUPPORT_A617 )
2768  case FMI_ALERT_POPUP_REQUEST: //0x1400
2769  {
2771  memset( &data, 0, sizeof( data ) );
2772  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2773 
2774  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), data.unique_id );
2775 
2776  switch( data.icon )
2777  {
2778  case FMI_ALERT_ICON_NONE:
2779  {
2780  packet.Append( _T( " Icon:\t\t none\r\n" ) );
2781  break;
2782  }
2784  {
2785  packet.Append( _T( " Icon:\t\t Driver Behavior\r\n" ) );
2786  break;
2787  }
2789  {
2790  packet.Append( _T( " Icon:\t\t Tier Pressure\r\n" ) );
2791  break;
2792  }
2794  {
2795  packet.Append( _T( " Icon:\t\t Temperature\r\n" ) );
2796  break;
2797  }
2799  {
2800  packet.Append( _T( " Icon:\t\t Door Sensor\r\n" ) );
2801  break;
2802  }
2804  {
2805  packet.Append( _T( " Icon:\t\t Vehicle Maintenance\r\n" ) );
2806  break;
2807  }
2809  {
2810  packet.Append( _T( " Icon:\t\t OBD-II Generic Sensor\r\n" ) );
2811  break;
2812  }
2814  {
2815  packet.Append( _T( " Icon:\t\t Generic Sensor 1\r\n" ) );
2816  break;
2817  }
2819  {
2820  packet.Append( _T( " Icon:\t\t Generic Sensor 2\r\n" ) );
2821  break;
2822  }
2824  {
2825  packet.Append( _T( " Icon:\t\t Generic Sensor 3\r\n" ) );
2826  break;
2827  }
2829  {
2830  packet.Append( _T( " Icon:\t\t General Connectivity\r\n" ) );
2831  break;
2832  }
2834  {
2835  packet.Append( _T( " Icon:\t\t Daily Hours Counter\r\n" ) );
2836  break;
2837  }
2839  {
2840  packet.Append( _T( " Icon:\t\t Weekly Hours Counter\r\n" ) );
2841  break;
2842  }
2844  {
2845  packet.Append( _T( " Icon:\t\t Rest Hours Counter\r\n" ) );
2846  break;
2847  }
2849  {
2850  packet.Append( _T( " Icon:\t\t Break Hours Counter\r\n" ) );
2851  break;
2852  }
2853  case FMI_ALERT_ICON_TASKS:
2854  {
2855  packet.Append( _T( " Icon:\t\t Tasks\r\n" ) );
2856  break;
2857  }
2858  case FMI_ALERT_ICON_WEIGHT:
2859  {
2860  packet.Append( _T( " Icon:\t\t Weight\r\n" ) );
2861  break;
2862  }
2864  {
2865  packet.Append( _T( " Icon:\t\t Information\r\n" ) );
2866  break;
2867  }
2868  case FMI_ALERT_ICON_FUEL:
2869  {
2870  packet.Append( _T( " Icon:\t\t Fuel\r\n" ) );
2871  break;
2872  }
2874  {
2875  packet.Append( _T( " Icon:\t\t EU Available\r\n" ) );
2876  break;
2877  }
2879  {
2880  packet.Append( _T( " Icon:\t\t EU Driving\r\n" ) );
2881  break;
2882  }
2884  {
2885  packet.Append( _T( " Icon:\t\t EU Rest\r\n" ) );
2886  break;
2887  }
2889  {
2890  packet.Append( _T( " Icon:\t\t EU Work\r\n" ) );
2891  break;
2892  }
2893  default:
2894  {
2895  packet.Append( _T( " Icon:\t\t RESERVED\r\n" ) );
2896  break;
2897  }
2898  }
2899 
2900  packet.AppendFormat( _T( " Timeout:\t %d\r\n" ), data.timeout );
2901  packet.AppendFormat( _T( " Severity:\t %d\r\n" ), data.severity );
2902  packet.AppendFormat( _T( " Play sound:\t %s\r\n" ), data.play_sound ? _T( "true" ) : _T( "false" ) );
2903  packet.AppendFormat( _T( " Text:\t\t %s\r\n" ), CString( data.alert_text ) );
2904  break;
2905  }
2906 
2907  case FMI_ALERT_POPUP_RECEIPT: //0x1401
2908  {
2910  memset( &data, 0, sizeof( data ) );
2911  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2912 
2913  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), data.unique_id );
2914 
2915  switch( data.result_code )
2916  {
2918  {
2919  packet.Append( _T( " Result:\t Success\r\n" ) );
2920  break;
2921  }
2923  {
2924  packet.Append( _T( " Result:\t Text too long\r\n" ) );
2925  break;
2926  }
2928  {
2929  packet.Append( _T( " Result:\t Icon number out of range (alert will be displayed with no icon)\r\n" ) );
2930  break;
2931  }
2933  {
2934  packet.Append( _T( " Result:\t No text or icon (at least one is required)\r\n" ) );
2935  break;
2936  }
2938  {
2939  packet.Append( _T( " Result:\t Severity out of range\r\n" ) );
2940  break;
2941  }
2943  {
2944  packet.Append( _T( " Result:\t Timeout out of range\r\n" ) );
2945  break;
2946  }
2947  }
2948  break;
2949  }
2950  case FMI_SENSOR_CONFIG_REQUEST: //0x1402
2951  {
2953  memset( &data, 0, sizeof( data ) );
2954  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
2955 
2956  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), data.change_id );
2957  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), data.unique_id );
2958  packet.AppendFormat( _T( " Name:\t\t %s\r\n" ), CString( data.name ) );
2959 
2960  switch( data.icon )
2961  {
2962  case FMI_ALERT_ICON_NONE:
2963  {
2964  packet.Append( _T( " Icon:\t\t none\r\n" ) );
2965  break;
2966  }
2968  {
2969  packet.Append( _T( " Icon:\t\t Driver Behavior\r\n" ) );
2970  break;
2971  }
2973  {
2974  packet.Append( _T( " Icon:\t\t Tier Pressure\r\n" ) );
2975  break;
2976  }
2978  {
2979  packet.Append( _T( " Icon:\t\t Temperature\r\n" ) );
2980  break;
2981  }
2983  {
2984  packet.Append( _T( " Icon:\t\t Door Sensor\r\n" ) );
2985  break;
2986  }
2988  {
2989  packet.Append( _T( " Icon:\t\t Vehicle Maintenance\r\n" ) );
2990  break;
2991  }
2993  {
2994  packet.Append( _T( " Icon:\t\t OBD-II Generic Sensor\r\n" ) );
2995  break;
2996  }
2998  {
2999  packet.Append( _T( " Icon:\t\t Generic Sensor 1\r\n" ) );
3000  break;
3001  }
3003  {
3004  packet.Append( _T( " Icon:\t\t Generic Sensor 2\r\n" ) );
3005  break;
3006  }
3008  {
3009  packet.Append( _T( " Icon:\t\t Generic Sensor 3\r\n" ) );
3010  break;
3011  }
3013  {
3014  packet.Append( _T( " Icon:\t\t General Connectivity\r\n" ) );
3015  break;
3016  }
3018  {
3019  packet.Append( _T( " Icon:\t\t Daily Hours Counter\r\n" ) );
3020  break;
3021  }
3023  {
3024  packet.Append( _T( " Icon:\t\t Weekly Hours Counter\r\n" ) );
3025  break;
3026  }
3028  {
3029  packet.Append( _T( " Icon:\t\t Rest Hours Counter\r\n" ) );
3030  break;
3031  }
3033  {
3034  packet.Append( _T( " Icon:\t\t Break Hours Counter\r\n" ) );
3035  break;
3036  }
3037  case FMI_ALERT_ICON_TASKS:
3038  {
3039  packet.Append( _T( " Icon:\t\t Tasks\r\n" ) );
3040  break;
3041  }
3042  case FMI_ALERT_ICON_WEIGHT:
3043  {
3044  packet.Append( _T( " Icon:\t\t Weight\r\n" ) );
3045  break;
3046  }
3048  {
3049  packet.Append( _T( " Icon:\t\t Information\r\n" ) );
3050  break;
3051  }
3052  case FMI_ALERT_ICON_FUEL:
3053  {
3054  packet.Append( _T( " Icon:\t\t Fuel\r\n" ) );
3055  break;
3056  }
3058  {
3059  packet.Append( _T( " Icon:\t\t EU Available\r\n" ) );
3060  break;
3061  }
3063  {
3064  packet.Append( _T( " Icon:\t\t EU Driving\r\n" ) );
3065  break;
3066  }
3068  {
3069  packet.Append( _T( " Icon:\t\t EU Rest\r\n" ) );
3070  break;
3071  }
3073  {
3074  packet.Append( _T( " Icon:\t\t EU Work\r\n" ) );
3075  break;
3076  }
3077  default:
3078  {
3079  packet.Append( _T( " Icon:\t\t RESERVED\r\n" ) );
3080  break;
3081  }
3082  }
3083 
3084  packet.AppendFormat( _T( " Display index:\t %d\r\n" ), data.display_index );
3085  break;
3086  }
3087  case FMI_SENSOR_CONFIG_RECEIPT: //0x1403
3088  case FMI_SENSOR_DELETE_RECEIPT: //0x1405
3089  {
3090  fmi_sensor_receipt data;
3091  memset( &data, 0, sizeof( data ) );
3092  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3093 
3094  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), data.change_id );
3095 
3096  switch( data.result_code )
3097  {
3098  case FMI_SENSOR_SUCCESS:
3099  {
3100  packet.Append( _T( " Result:\t\t Success\r\n" ) );
3101  break;
3102  }
3104  {
3105  packet.Append( _T( " Result:\t\t Name too long\r\n" ) );
3106  break;
3107  }
3109  {
3110  packet.Append( _T( " Result:\t\t Icon number out of range (alert will be displayed with no icon)\r\n" ) );
3111  break;
3112  }
3114  {
3115  packet.Append( _T( " Result:\t\t Sensor name must be specified\r\n" ) );
3116  break;
3117  }
3119  {
3120  packet.Append( _T( " Result:\t\t Severity out of range\r\n" ) );
3121  break;
3122  }
3124  {
3125  packet.Append( _T( " Result:\t\t Status too long\r\n" ) );
3126  break;
3127  }
3129  {
3130  packet.Append( _T( " Result:\t\t Description too long\r\n" ) );
3131  break;
3132  }
3134  {
3135  packet.Append( _T( " Result:\t\t Too many sensors\r\n" ) );
3136  break;
3137  }
3139  {
3140  packet.Append( _T( " Result:\t\t Unique ID not found\r\n" ) );
3141  break;
3142  }
3143  case FMI_SENSOR_ERR_DB:
3144  {
3145  packet.Append( _T( " Result:\t\t Error saving to database\r\n" ) );
3146  break;
3147  }
3148  }
3149  switch ( data.operation_mode )
3150  {
3151  case 0:
3152  {
3153  packet.Append( _T( " Operation:\t delete\r\n" ) );
3154  break;
3155  }
3156  case 1:
3157  {
3158  packet.Append( _T( " Operation:\t add\r\n" ) );
3159  break;
3160  }
3161  case 2:
3162  {
3163  packet.Append( _T( " Operation:\t modify\r\n" ) );
3164  break;
3165  }
3166  }
3167  break;
3168  }
3169  case FMI_SENSOR_DELETE_REQUEST: //0x1404
3170  {
3172  memset( &data, 0, sizeof( data ) );
3173  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3174 
3175  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), data.change_id );
3176  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), data.unique_id );
3177  break;
3178  }
3179  case FMI_SENSOR_UPDATE_REQUEST: //0X1406
3180  {
3182  memset( &data, 0, sizeof( data ) );
3183  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3184 
3185  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), data.change_id );
3186  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), data.unique_id );
3187  packet.AppendFormat( _T( " Severity:\t %d\r\n" ), data.severity );
3188  packet.AppendFormat( _T( " Play sound:\t %s\r\n" ), data.play_sound ? _T( "true" ) : _T( "false" ) );
3189  packet.AppendFormat( _T( " Record:\t %s\r\n" ), data.record_sensor ? _T( "true" ) : _T( "false" ) );
3190  packet.AppendFormat( _T( " Status:\t\t %s\r\n" ), CString( data.status ) );
3191  packet.AppendFormat( _T( " Description:\t %s\r\n" ), CString( data.description ) );
3192  break;
3193  }
3195  {
3197  memset( &data, 0, sizeof( data ) );
3198  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3199 
3200  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), data.change_id );
3201  packet.AppendFormat( _T( " Unique ID:\t %d\r\n" ), data.unique_id );
3202  break;
3203  }
3205  {
3207  memset( &data, 0, sizeof( data ) );
3208  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3209 
3210  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), data.change_id );
3211 
3212  switch( data.result_code )
3213  {
3214  case FMI_SENSOR_SUCCESS:
3215  {
3216  packet.Append( _T( " Result:\t\t Success\r\n" ) );
3217  break;
3218  }
3220  {
3221  packet.Append( _T( " Result:\t\t Name too long\r\n" ) );
3222  break;
3223  }
3225  {
3226  packet.Append( _T( " Result:\t\t Icon number out of range (alert will be displayed with no icon)\r\n" ) );
3227  break;
3228  }
3230  {
3231  packet.Append( _T( " Result:\t\t Sensor name must be specified\r\n" ) );
3232  break;
3233  }
3235  {
3236  packet.Append( _T( " Result:\t\t Severity out of range\r\n" ) );
3237  break;
3238  }
3240  {
3241  packet.Append( _T( " Result:\t\t Status too long\r\n" ) );
3242  break;
3243  }
3245  {
3246  packet.Append( _T( " Result:\t\t Description too long\r\n" ) );
3247  break;
3248  }
3250  {
3251  packet.Append( _T( " Result:\t\t Too many sensors\r\n" ) );
3252  break;
3253  }
3255  {
3256  packet.Append( _T( " Result:\t\t Unique ID not found\r\n" ) );
3257  break;
3258  }
3259  case FMI_SENSOR_ERR_DB:
3260  {
3261  packet.Append( _T( " Result:\t\t Error saving to database\r\n" ) );
3262  break;
3263  }
3264  }
3265  packet.AppendFormat( _T( " Display Index:\t %d\r\n" ), data.display_index );
3266  break;
3267  }
3268 #endif
3269 #if( FMI_SUPPORT_A619 )
3270  case FMI_HOS_SET_SETTING_DATA_REQUEST: //0X1500
3271  {
3273  memset( &data, 0, sizeof( data ) );
3274  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3275 
3276  switch( data.tag )
3277  {
3279  {
3280  packet.Append( _T( " Tag:\t\t Stop Moving Threshold\r\n" ) );
3281  break;
3282  }
3284  {
3285  packet.Append( _T( " Tag:\t\t 8 Hour Rule\r\n" ) );
3286  break;
3287  }
3289  {
3290  packet.Append( _T( " Tag:\t\t Periodic Status Interval\r\n" ) );
3291  break;
3292  }
3294  {
3295  packet.Append( _T( " Tag:\t\t Start Time of Day\r\n" ) );
3296  break;
3297  }
3298  }
3299  packet.AppendFormat( _T( " Value:\t\t %d\r\n" ), data.settings_value );
3300  packet.AppendFormat( _T( " Enabled:\t %s\r\n" ), data.enable ? _T( "true" ) : _T( "false" ) );
3301  break;
3302  }
3303  case FMI_HOS_SET_SETTING_DATA_RECEIPT: //0X1501
3304  {
3306  memset( &data, 0, sizeof( data ) );
3307  memcpy( &data, aFmiPayload, minval( sizeof( data ), aFmiPayloadSize ) );
3308 
3309  switch( data.tag )
3310  {
3312  {
3313  packet.Append( _T( " Tag:\t\t Stop Moving Threshold\r\n" ) );
3314  break;
3315  }
3317  {
3318  packet.Append( _T( " Tag:\t\t 8 Hour Rule\r\n" ) );
3319  break;
3320  }
3322  {
3323  packet.Append( _T( " Tag:\t\t Periodic Status Interval\r\n" ) );
3324  break;
3325  }
3327  {
3328  packet.Append( _T( " Tag:\t\t Start Time of Day\r\n" ) );
3329  break;
3330  }
3331  }
3332  packet.AppendFormat( _T( " Value:\t\t %d\r\n" ), data.settings_value );
3333  packet.AppendFormat( _T( " Enabled:\t %s\r\n" ), data.enabled ? _T( "true" ) : _T( "false" ) );
3334  switch( data.result_code )
3335  {
3337  {
3338  packet.Append( _T( " Result Code:\t OK\r\n" ) );
3339  break;
3340  }
3342  {
3343  packet.Append( _T( " Result Code:\t Threshold set to Minimum\r\n" ) );
3344  break;
3345  }
3347  {
3348  packet.Append( _T( " Result Code:\t Threshold set to Maximum\r\n" ) );
3349  break;
3350  }
3352  {
3353  packet.Append( _T( " Result Code:\t Failure\r\n" ) );
3354  break;
3355  }
3356  }
3357  break;
3358  }
3359 #endif
3360 #if( FMI_SUPPORT_A622 )
3361  case FMI_DASHCAM_SETTINGS_LOCK_REQUEST: //0X1600
3362  {
3364 
3365  memset( &message, 0, sizeof( message ) );
3366  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3367 
3368  packet.AppendFormat( _T( " Orig Time:\t 0x%08x - %s\r\n" ), message.origination_time, formatTime( message.origination_time ) );
3369  packet.AppendFormat( _T( " Lock Settings:\t %s\r\n" ), message.lock_change ? _T( "true" ) : _T( "false" ) );
3370  packet.AppendFormat( _T( " Lock Advanced Driver Assistance Settings:\t %s\r\n" ), message.lock_change_adas ? _T( "true" ) : _T( "false" ) );
3371  break;
3372  }
3373  case FMI_DASHCAM_CONFIG_REQUEST: //0X1602
3374  {
3376 
3377  memset( &message, 0, sizeof( message ) );
3378  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3379 
3380  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3381  packet.AppendFormat( _T( " Settings Count:\t %d\r\n" ), message.settings_count );
3382 
3383  for( int i=0; i<message.settings_count; i++ )
3384  {
3385  switch( message.settings_list[i].setting_id )
3386  {
3388  {
3389  packet.AppendFormat( _T( " Forward Collision:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3390  break;
3391  }
3393  {
3394  if( 0 == message.settings_list[i].new_value )
3395  {
3396  packet.AppendFormat( _T( " Collision Sensitivity:\t\t Low\r\n" ) );
3397  }
3398  else if( 1 == message.settings_list[i].new_value )
3399  {
3400  packet.AppendFormat( _T( " Collision Sensitivity:\t\t Medium\r\n" ) );
3401  }
3402  else
3403  {
3404  packet.AppendFormat( _T( " Collision Sensitivity:\t\t High\r\n" ) );
3405  }
3406  break;
3407  }
3409  {
3410  packet.AppendFormat( _T( " Lane Departure:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3411  break;
3412  }
3414  {
3415  packet.AppendFormat( _T( " Record on Startup:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3416  break;
3417  }
3419  {
3420  packet.AppendFormat( _T( " Incident Detection:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3421  break;
3422  }
3423  case DASHCAM_RECORD_AUDIO:
3424  {
3425  packet.AppendFormat( _T( " Record Audio:\t\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3426  break;
3427  }
3429  {
3430  packet.AppendFormat( _T( " Data Overlay Date/Time:\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3431  break;
3432  }
3434  {
3435  packet.AppendFormat( _T( " Data Overlay Location/Speed:\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enable" ) : _T( "Disable" ) );
3436  break;
3437  }
3439  {
3440  packet.AppendFormat( _T( " Video Resolution:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Medium" ) : _T( "High" ) );
3441  break;
3442  }
3444  {
3445  if( 0 == message.settings_list[i].new_value )
3446  {
3447  packet.AppendFormat( _T( " Record After Power Loss:\t 5 Min\r\n" ) );
3448  }
3449  else if( 1 == message.settings_list[i].new_value )
3450  {
3451  packet.AppendFormat( _T( " Record After Power Loss:\t 3 Min\r\n" ) );
3452  }
3453  else if( 2 == message.settings_list[i].new_value )
3454  {
3455  packet.AppendFormat( _T( " Record After Power Loss:\t 1 Min\r\n" ) );
3456  }
3457  else if( 3 == message.settings_list[i].new_value )
3458  {
3459  packet.AppendFormat( _T( " Record After Power Loss:\t 30 Sec\r\n" ) );
3460  }
3461  else if( 4 == message.settings_list[i].new_value )
3462  {
3463  packet.AppendFormat( _T( " Record After Power Loss:\t 15 Sec\r\n" ) );
3464  }
3465  break;
3466  }
3467  }
3468  }
3469  break;
3470  }
3471  case FMI_DASHCAM_SETTINGS_LOCK_RECEIPT: //0X1601
3472  case FMI_DASHCAM_CONFIG_RECEIPT: //0X1603
3473  case FMI_DASHCAM_SET_NTFCTN_RECEIPT: //0X1607
3474  {
3476 
3477  memset( &message, 0, sizeof( message ) );
3478  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3479 
3480  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3481  packet.AppendFormat( _T( " Result Code:\t %d\r\n" ), message.result_code );
3482  break;
3483  }
3484  case FMI_DASHCAM_GET_SETTINGS_REQUEST: //0X1604
3486  {
3488 
3489  memset( &message, 0, sizeof( message ) );
3490  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3491 
3492  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3493  break;
3494  }
3495  case FMI_DASHCAM_GET_SETTINGS_RESPONSE: //0X1605
3496  {
3498 
3499  memset( &message, 0, sizeof( message ) );
3500  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3501 
3502  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3503  packet.AppendFormat( _T( " Result Code:\t %d\r\n" ), message.result_code );
3504  packet.AppendFormat( _T( " Settings Count:\t %d\r\n" ), message.settings_count );
3505 
3506  for( int i=0; i<message.settings_count; i++ )
3507  {
3508  switch( message.settings_list[i].setting_id )
3509  {
3511  {
3512  packet.AppendFormat( _T( " Forward Collision:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3513  break;
3514  }
3516  {
3517  if( 0 == message.settings_list[i].new_value )
3518  {
3519  packet.AppendFormat( _T( " Collision Sensitivity:\t\t Low\r\n" ) );
3520  }
3521  else if( 1 == message.settings_list[i].new_value )
3522  {
3523  packet.AppendFormat( _T( " Collision Sensitivity:\t\t Medium\r\n" ) );
3524  }
3525  else
3526  {
3527  packet.AppendFormat( _T( " Collision Sensitivity:\t\t High\r\n" ) );
3528  }
3529  break;
3530  }
3532  {
3533  packet.AppendFormat( _T( " Lane Departure:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3534  break;
3535  }
3537  {
3538  packet.AppendFormat( _T( " Record on Startup:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3539  break;
3540  }
3542  {
3543  packet.AppendFormat( _T( " Incident Detection:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3544  break;
3545  }
3546  case DASHCAM_RECORD_AUDIO:
3547  {
3548  packet.AppendFormat( _T( " Record Audio:\t\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3549  break;
3550  }
3552  {
3553  packet.AppendFormat( _T( " Data Overley Date/Time:\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3554  break;
3555  }
3557  {
3558  packet.AppendFormat( _T( " Data Overaly Location/Speed:\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Enabled" ) : _T( "Disabled" ) );
3559  break;
3560  }
3562  {
3563  packet.AppendFormat( _T( " Video Resolution:\t\t %s\r\n" ), message.settings_list[i].new_value ? _T( "Medium" ) : _T( "High" ) );
3564  break;
3565  }
3567  {
3568  if( 0 == message.settings_list[i].new_value )
3569  {
3570  packet.AppendFormat( _T( " Record After Power Loss:\t 5 Min\r\n" ) );
3571  }
3572  else if( 1 == message.settings_list[i].new_value )
3573  {
3574  packet.AppendFormat( _T( " Record After Power Loss:\t 3 Min\r\n" ) );
3575  }
3576  else if( 2 == message.settings_list[i].new_value )
3577  {
3578  packet.AppendFormat( _T( " Record After Power Loss:\t 1 Min\r\n" ) );
3579  }
3580  else if( 3 == message.settings_list[i].new_value )
3581  {
3582  packet.AppendFormat( _T( " Record After Power Loss:\t 30 Sec\r\n" ) );
3583  }
3584  else if( 4 == message.settings_list[i].new_value )
3585  {
3586  packet.AppendFormat( _T( " Record After Power Loss:\t 15 Sec\r\n" ) );
3587  }
3588  break;
3589  }
3590  }
3591  }
3592  break;
3593  }
3594  case FMI_DASHCAM_SET_NTFCTN_REQUEST: //0X1606
3595  {
3597 
3598  memset( &message, 0, sizeof( message ) );
3599  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3600 
3601  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3602  packet.AppendFormat( _T( " FWD Collision Ntfctn:\t %s\r\n" ), message.enable_fcw_ntfctn ? _T( "Enable" ) : _T( "Disable" ) );
3603  packet.AppendFormat( _T( " Lane Departure Ntfctn:\t %s\r\n" ), message.enable_lane_departure_ntfctn ? _T( "Enable" ) : _T( "Disable" ) );
3604  packet.AppendFormat( _T( " Incident Ntfctn:\t\t %s\r\n" ), message.enable_incident_ntfctn ? _T( "Enable" ) : _T( "Disable" ) );
3605  break;
3606  }
3608  {
3610 
3611  memset( &message, 0, sizeof( message ) );
3612  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3613 
3614  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3615  packet.AppendFormat( _T( " Result Code:\t %d\r\n" ), message.result_code);
3616  packet.AppendFormat( _T( " FWD Collision Ntfctn:\t %s\r\n" ), message.enable_fcw_ntfctn ? _T( "Enable" ) : _T( "Disable" ) );
3617  packet.AppendFormat( _T( " Lane Departure Ntfctn:\t %s\r\n" ), message.enable_lane_departure_ntfctn ? _T( "Enable" ) : _T( "Disable" ) );
3618  packet.AppendFormat( _T( " Incident Ntfctn:\t\t %s\r\n" ), message.enable_incident_ntfctn ? _T( "Enable" ) : _T( "Disable" ) );
3619  break;
3620  }
3621  case FMI_DASHCAM_NTFCTN_REQUEST: //0X160A
3622  {
3624 
3625  memset( &message, 0, sizeof( message ) );
3626  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3627 
3628  packet.AppendFormat( _T( " Orig Time:\t %d\r\n - %s\r\n" ), message.origination_time, formatTime( message.origination_time ) );
3629  packet.AppendFormat( _T( " Ntfctn Type:\t %d\r\n" ), message.ntfctn_type );
3630  packet.AppendFormat( _T(" Lat:\t\t 0x%08x - %s\r\n"), message.scposn.lat, formatLatitude( message.scposn.lat ) );
3631  packet.AppendFormat( _T(" Lon:\t\t 0x%08x - %s\r\n"), message.scposn.lon, formatLongitude( message.scposn.lon ) );
3632  break;
3633  }
3634  case FMI_DASHCAM_NTFCTN_RECEIPT: //0X160B
3636  {
3638 
3639  memset( &message, 0, sizeof( message ) );
3640  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3641 
3642  packet.AppendFormat( _T( " Change ID:\t %d\r\n" ), message.change_id );
3643  break;
3644  }
3646  {
3648 
3649  memset( &message, 0, sizeof( message ) );
3650  memcpy( &message, aFmiPayload, minval( aFmiPayloadSize, sizeof( message ) ) );
3651 
3652  packet.AppendFormat( _T( " Orig Time:\t %d\r\n - %s\r\n" ), message.origination_time, formatTime( message.origination_time ) );
3653  packet.AppendFormat( _T( " Ntfctn Type:\t %d\r\n" ), message.ntfctn_type );
3654  packet.AppendFormat( _T( " Lat:\t\t 0x%08x - %s\r\n" ), message.scposn.lat, formatLatitude( message.scposn.lat ) );
3655  packet.AppendFormat( _T( " Lon:\t\t 0x%08x - %s\r\n" ), message.scposn.lon, formatLongitude( message.scposn.lon ) );
3656  packet.AppendFormat( _T( " Incident File:\t %s\r\n" ), CString( message.incident_fname ) );
3657  break;
3658  }
3659 #endif
3660 
3661  default:
3662  break;
3663  }
3664 
3665  return packet;
3666 }
3667 
3668 //----------------------------------------------------------------------
3675 //----------------------------------------------------------------------
3677  (
3678  uint16 aPacketId
3679  )
3680 {
3681  CString packetName;
3682 
3683  if( mFmiPacketNames.find( aPacketId ) == mFmiPacketNames.end() )
3684  {
3685  packetName.Format( _T("Unknown FMI packet 0x%04x"), aPacketId );
3686  }
3687  else
3688  {
3689  packetName = mFmiPacketNames[aPacketId];
3690  }
3691 
3692  return packetName;
3693 }
3694 #endif //FMI_SUPPORT_A602
3695 
3696 #if( FMI_SUPPORT_A615 )
3699  uint16 aPacketId
3700  )
3701  {
3702  CString packetName;
3703 
3704  if( mHosartPacketNames.find( aPacketId ) == mHosartPacketNames.end() )
3705  {
3706  packetName.Format( _T("Unknown HOSART packet 0x%04x"), aPacketId );
3707  }
3708  else
3709  {
3710  packetName = mHosartPacketNames[aPacketId];
3711  }
3712 
3713  return packetName;
3714 }
3715 
3716 //----------------------------------------------------------------------
3725 //----------------------------------------------------------------------
3727  (
3728  BOOL /* transmitted */,
3729  uint16 aPacketId,
3730  uint8 * aPayload,
3731  uint8 aPayloadSize
3732  )
3733 {
3734  CString packet;
3735 
3736  switch( aPacketId )
3737  {
3738  case HOSART_CHANGE_STATUS: // 0x0000
3739  {
3740  hosart_change_status data;
3741  memset( &data, 0, sizeof( data ) );
3742  memcpy( &data, aPayload, minval( aPayloadSize, sizeof( data ) ) );
3743 
3744  packet.AppendFormat( _T( " Driver ID:\t %d\r\n" ), data.driver_id );
3745  packet.AppendFormat( _T( " New Status:\t %d\r\n" ), data.new_status );
3746  break;
3747  }
3748  case HOSART_CHANGE_TO_DRIVING_WARNING: // 0x0001
3749  {
3750  break;
3751  }
3752  case HOSART_WARNING_FOUND: // 0x0002
3753  {
3755  memset( &data, 0, sizeof( data ) );
3756  memcpy( &data, aPayload, minval( aPayloadSize, sizeof( data ) ) );
3757 
3758  packet.AppendFormat( _T( " Warning Type:\t %d\r\n" ), data.warning_type );
3759  packet.AppendFormat( _T( " Violation Type:\t %d\r\n" ), data.violation_type );
3760  packet.AppendFormat( _T( " Driver ID:\t %d\r\n" ), data.driver_id );
3761  packet.AppendFormat( _T( " Violation Time:\t 0x%08x - %s\r\n"), data.timestamp, formatTime( data.timestamp ) );
3762  break;
3763  }
3764  case HOSART_VIOLATION_FOUND: // 0x0003
3765  {
3767  memset( &data, 0, sizeof( data ) );
3768  memcpy( &data, aPayload, minval( aPayloadSize, sizeof( data ) ) );
3769 
3770  packet.AppendFormat( _T( " Violation Type:\t %d\r\n" ), data.violation_type );
3771  packet.AppendFormat( _T( " Driver ID:\t %d\r\n" ), data.driver_id );
3772  packet.AppendFormat( _T( " Violation Time:\t 0x%08x - %s\r\n"), data.timestamp, formatTime( data.timestamp ) );
3773  break;
3774  }
3775  case HOSART_SET_PS_TO_OFF: // 0x0004
3776  {
3777  uint32 data;
3778  memset( &data, 0, sizeof( data ) );
3779  memcpy( &data, aPayload, minval( aPayloadSize, sizeof( data ) ) );
3780  packet.AppendFormat( _T( " Seconds Moved:\t 0x%08x - %s\r\n"), data, formatTime( data ) );
3781  break;
3782  }
3783  }
3784 
3785  return packet;
3786 }
3787 #endif
3788 
3789 #if( CDT_SUPPORT )
3790 CString FmiLogParser::getCdtPacketName
3791 (
3792  uint8 aPacketId
3793  )
3794  {
3795  CString packetName;
3796 
3797  if( mCdtPacketNames.find( aPacketId ) == mCdtPacketNames.end() )
3798  {
3799  packetName.Format( _T("Unknown CDT packet 0x%04x"), aPacketId );
3800  }
3801  else
3802  {
3803  packetName = mCdtPacketNames[aPacketId];
3804  }
3805 
3806  return packetName;
3807  }
3808 
3809 //----------------------------------------------------------------------
3820 //----------------------------------------------------------------------
3821 CString FmiLogParser::formatCdtPacket
3822  (
3823  BOOL /* transmitted */,
3824  uint8 aPacketId,
3825  uint8 * aPayload,
3826  uint8 aPayloadSize
3827  )
3828 {
3829  CString packet;
3830 
3831  switch( aPacketId )
3832  {
3833  case CDT_DATA_TRANSFER: // 0x0000
3834  // this is a generic packet so the data format is defined by the user code
3835  break;
3836  case CDT_PING_REQUEST: // 0x0080
3837  // there is nothing extra
3838  break;
3839  case CDT_PING_RECEIPT: // 0x0081
3840  // there is nothing extra
3841  break;
3842  }
3843 
3844  return packet;
3845 }
3846 #endif
3847 
3848 //----------------------------------------------------------------------
3856 //----------------------------------------------------------------------
3858  (
3859  uint8 aPacketId
3860  )
3861 {
3862  CString packetName;
3863 
3864  if( mGarminPacketNames.find( aPacketId ) == mGarminPacketNames.end() )
3865  {
3866  packetName.Format( _T("Unknown Garmin packet 0x%02x"), aPacketId );
3867  }
3868  else
3869  {
3870  packetName = mGarminPacketNames[aPacketId];
3871  }
3872 
3873  return packetName;
3874 }
3875 
3876 //----------------------------------------------------------------------
3884 //----------------------------------------------------------------------
3886  (
3887  uint16 aCommandId
3888  )
3889 {
3890  CString commandName;
3891 
3892  if( mGarminCommandNames.find( aCommandId ) == mGarminCommandNames.end() )
3893  {
3894  commandName.Format( _T("Unknown Garmin command 0x%04x"), aCommandId );
3895  }
3896  else
3897  {
3898  commandName = mGarminCommandNames[aCommandId];
3899  }
3900 
3901  return commandName;
3902 }
3903 
3904 #if( FMI_SUPPORT_A615 )
3906  (
3907  CString & packet,
3908  uint8 result_code
3909  )
3910  {
3911  switch( result_code )
3912  {
3913  case FMI_IFTA_OK:
3914  {
3915  packet.AppendFormat( _T( " Result Code:\t %d - OK\r\n" ), result_code );
3916  break;
3917  }
3919  {
3920  packet.AppendFormat( _T( " Result Code:\t %d - No Data Found\r\n" ), result_code );
3921  break;
3922  }
3923  case FMI_IFTA_BUSY_ERROR:
3924  {
3925  packet.AppendFormat( _T( " Result Code:\t %d - Busy\r\n" ), result_code );
3926  break;
3927  }
3929  {
3930  packet.AppendFormat( _T( " Result Code:\t %d - NULL Input Pointer\r\n" ), result_code );
3931  break;
3932  }
3933  case FMI_IFTA_STATE_ERROR:
3934  {
3935  packet.AppendFormat( _T( " Result Code:\t %d - State error\r\n" ), result_code );
3936  break;
3937  }
3939  {
3940  packet.AppendFormat( _T( " Result Code:\t %d - Minimum Data Size error\r\n" ), result_code );
3941  break;
3942  }
3944  {
3945  packet.AppendFormat( _T( " Result Code:\t %d - Maximum Data Size error\r\n" ), result_code );
3946  break;
3947  }
3948  case FMI_IFTA_MALLOC_ERROR:
3949  {
3950  packet.AppendFormat( _T( " Result Code:\t %d - Malloc error\r\n" ), result_code );
3951  break;
3952  }
3953  case FMI_IFTA_GZIP_ERROR:
3954  {
3955  packet.AppendFormat( _T( " Result Code:\t %d - GZip error\r\n" ), result_code );
3956  break;
3957  }
3959  {
3960  packet.AppendFormat( _T( " Result Code:\t %d - GFS Open error\r\n" ), result_code );
3961  break;
3962  }
3964  {
3965  packet.AppendFormat( _T( " Result Code:\t %d - GFS Dir Open error\r\n" ), result_code );
3966  break;
3967  }
3969  {
3970  packet.AppendFormat( _T( " Result Code:\t %d - GFS FSTAT error\r\n" ), result_code );
3971  break;
3972  }
3974  {
3975  packet.AppendFormat( _T( " Result Code:\t %d - GFS Read error\r\n" ), result_code );
3976  break;
3977  }
3979  {
3980  packet.AppendFormat( _T( " Result Code:\t %d - GFS Remove error\r\n" ), result_code );
3981  break;
3982  }
3984  {
3985  packet.AppendFormat( _T( " Result Code:\t %d - Export Data error\r\n" ), result_code );
3986  break;
3987  }
3989  {
3990  packet.AppendFormat( _T( " Result Code:\t %d - GFS Write error\r\n" ), result_code );
3991  break;
3992  }
3993  case FMI_IFTA_TX_ERROR:
3994  {
3995  packet.AppendFormat( _T( " Result Code:\t %d - Transmission error\r\n" ), result_code );
3996  break;
3997  }
3998  }
3999  }
4000 #endif
4001 
4002 #if( FMI_SUPPORT_A602 )
4003 //----------------------------------------------------------------------
4006 //----------------------------------------------------------------------
4008 {
4009  mFmiPacketNames.clear();
4010 
4011  mFmiPacketNames[ FMI_ID_ENABLE ] = _T("Enable");
4012  mFmiPacketNames[ FMI_ID_PRODUCT_ID_SUPPORT_RQST ] = _T("Product ID and Support Request");
4013  mFmiPacketNames[ FMI_ID_PRODUCT_ID_DATA ] = _T("Product ID Data");
4014  mFmiPacketNames[ FMI_ID_PROTOCOL_DATA ] = _T("Protocol Data");
4015  mFmiPacketNames[ FMI_ID_TEXT_MSG_ACK ] = _T("Text Message ACK");
4016  mFmiPacketNames[ FMI_ID_SERVER_OPEN_TXT_MSG ] = _T("Text Message Open From Server");
4017  mFmiPacketNames[ FMI_ID_SERVER_OK_ACK_TXT_MSG ] = _T("Text Message Simple ACK");
4018  mFmiPacketNames[ FMI_ID_SERVER_YES_NO_CONFIRM_MSG ] = _T("Text Message Yes/No");
4019  mFmiPacketNames[ FMI_ID_A602_STOP ] = _T("A602 Stop");
4020 
4021 #if( FMI_SUPPORT_A603 )
4022  mFmiPacketNames[ FMI_ID_CLIENT_OPEN_TXT_MSG ] = _T("Text Message Open from Client");
4023  mFmiPacketNames[ FMI_ID_CLIENT_TXT_MSG_RCPT ] = _T("Text Message Receipt");
4024  mFmiPacketNames[ FMI_ID_A603_STOP ] = _T("A603 Stop");
4025  mFmiPacketNames[ FMI_ID_ETA_DATA_REQUEST ] = _T("ETA Data Request");
4026  mFmiPacketNames[ FMI_ID_ETA_DATA ] = _T("ETA Data");
4027  mFmiPacketNames[ FMI_ID_ETA_DATA_RCPT ] = _T("ETA Data Receipt");
4028  mFmiPacketNames[ FMI_ID_STOP_STATUS_REQUEST ] = _T("Stop Status Update/Request");
4029  mFmiPacketNames[ FMI_ID_STOP_STATUS ] = _T("Stop Status");
4030  mFmiPacketNames[ FMI_ID_STOP_STATUS_RCPT ] = _T("Stop Status Receipt");
4031  mFmiPacketNames[ FMI_ID_AUTO_ARRIVAL ] = _T("Auto Arrival Change");
4032  mFmiPacketNames[ FMI_ID_DATA_DELETION ] = _T("Data Deletion");
4033 #endif
4034 
4035 #if( FMI_SUPPORT_A604 )
4036  mFmiPacketNames[ FMI_ID_UNICODE_REQUEST ] = _T("Unicode Request");
4037  mFmiPacketNames[ FMI_ID_UNICODE_RESPONSE ] = _T("Unicode Response");
4038  mFmiPacketNames[ FMI_ID_SET_CANNED_RESP_LIST ] = _T("Set Canned Response List");
4039  mFmiPacketNames[ FMI_ID_CANNED_RESP_LIST_RCPT ] = _T("Canned Response List Receipt");
4040  mFmiPacketNames[ FMI_ID_A604_OPEN_TEXT_MSG ] = _T("A604 Open Text Message");
4041  mFmiPacketNames[ FMI_ID_A604_OPEN_TEXT_MSG_RCPT ] = _T("A604 Open Text Message Receipt");
4042  mFmiPacketNames[ FMI_ID_TEXT_MSG_ACK_RCPT ] = _T("Text Message ACK Receipt");
4043  mFmiPacketNames[ FMI_ID_SET_CANNED_RESPONSE ] = _T("Set Canned Response");
4044  mFmiPacketNames[ FMI_ID_DELETE_CANNED_RESPONSE ] = _T("Delete Canned Response");
4045  mFmiPacketNames[ FMI_ID_SET_CANNED_RESPONSE_RCPT ] = _T("Set Canned Response Receipt");
4046  mFmiPacketNames[ FMI_ID_DELETE_CANNED_RESPONSE_RCPT ] = _T("Delete Canned Response Receipt");
4047  mFmiPacketNames[ FMI_ID_REFRESH_CANNED_RESP_LIST ] = _T("Request Canned Response List Refresh");
4048  mFmiPacketNames[ FMI_ID_TEXT_MSG_STATUS_REQUEST ] = _T("Text Message Status Request");
4049  mFmiPacketNames[ FMI_ID_TEXT_MSG_STATUS ] = _T("Text Message Status");
4050  mFmiPacketNames[ FMI_ID_SET_CANNED_MSG ] = _T("Set Canned Message");
4051  mFmiPacketNames[ FMI_ID_SET_CANNED_MSG_RCPT ] = _T("Set Canned Message Receipt");
4052  mFmiPacketNames[ FMI_ID_DELETE_CANNED_MSG ] = _T("Delete Canned Message ");
4053  mFmiPacketNames[ FMI_ID_DELETE_CANNED_MSG_RCPT ] = _T("Delete Canned Message Receipt");
4054  mFmiPacketNames[ FMI_ID_REFRESH_CANNED_MSG_LIST ] = _T("Refresh Canned Message List");
4055  mFmiPacketNames[ FMI_ID_SORT_STOP_LIST ] = _T("Sort Stop List");
4056  mFmiPacketNames[ FMI_ID_SORT_STOP_LIST_ACK ] = _T("Sort Stop List ACK");
4057  mFmiPacketNames[ FMI_ID_USER_INTERFACE_TEXT ] = _T("User Interface Text Change");
4058  mFmiPacketNames[ FMI_ID_USER_INTERFACE_TEXT_RCPT ] = _T("User Interface Text Receipt");
4059  mFmiPacketNames[ FMI_ID_MSG_THROTTLING_COMMAND ] = _T("Message Throttling Command");
4060  mFmiPacketNames[ FMI_ID_MSG_THROTTLING_RESPONSE ] = _T("Message Throttling Response");
4061  mFmiPacketNames[ FMI_ID_PING ] = _T("Ping Request");
4062  mFmiPacketNames[ FMI_ID_PING_RESPONSE ] = _T("Ping Response");
4063  mFmiPacketNames[ FMI_ID_FILE_TRANSFER_START ] = _T("File Transfer Start");
4064  mFmiPacketNames[ FMI_ID_FILE_DATA_PACKET ] = _T("File Data Packet");
4065  mFmiPacketNames[ FMI_ID_FILE_TRANSFER_END ] = _T("File Transfer End");
4066  mFmiPacketNames[ FMI_ID_FILE_START_RCPT ] = _T("File Start Receipt");
4067  mFmiPacketNames[ FMI_ID_FILE_PACKET_RCPT ] = _T("Packet Receipt");
4068  mFmiPacketNames[ FMI_ID_FILE_END_RCPT ] = _T("File End Receipt");
4069  mFmiPacketNames[ FMI_ID_GPI_FILE_INFORMATION_REQUEST ] = _T("GPI File Information Request");
4070  mFmiPacketNames[ FMI_ID_GPI_FILE_INFORMATION ] = _T("GPI File Information");
4071  mFmiPacketNames[ FMI_ID_SET_DRIVER_STATUS_LIST_ITEM ] = _T("Set Driver Status List Item");
4072  mFmiPacketNames[ FMI_ID_DELETE_DRIVER_STATUS_LIST_ITEM ] = _T("Delete Driver Status List Item");
4073  mFmiPacketNames[ FMI_ID_SET_DRIVER_STATUS_LIST_ITEM_RCPT ] = _T("Set Driver Status List Item Receipt");
4074  mFmiPacketNames[ FMI_ID_DEL_DRIVER_STATUS_LIST_ITEM_RCPT ] = _T("Delete Driver Status List Item Receipt");
4075  mFmiPacketNames[ FMI_ID_DRIVER_STATUS_LIST_REFRESH ] = _T("Driver Status List Refresh");
4076  mFmiPacketNames[ FMI_ID_DRIVER_ID_REQUEST ] = _T("Request Driver ID");
4077  mFmiPacketNames[ FMI_ID_DRIVER_ID_UPDATE ] = _T("Driver ID Update");
4078  mFmiPacketNames[ FMI_ID_DRIVER_ID_RCPT ] = _T("Driver ID Receipt");
4079  mFmiPacketNames[ FMI_ID_DRIVER_STATUS_REQUEST ] = _T("Request Driver Status");
4080  mFmiPacketNames[ FMI_ID_DRIVER_STATUS_UPDATE ] = _T("Driver Status Update");
4081  mFmiPacketNames[ FMI_ID_DRIVER_STATUS_RCPT ] = _T("Driver Status Receipt");
4082 #endif
4083 
4084 #if( FMI_SUPPORT_A605 )
4085  mFmiPacketNames[ FMI_ID_MSG_THROTTLING_QUERY ] = _T("Message Throttling Query");
4086  mFmiPacketNames[ FMI_ID_MSG_THROTTLING_QUERY_RESPONSE ] = _T("Message Throttling Query Response");
4087 #endif
4088 
4089 #if (FMI_SUPPORT_A606)
4090  mFmiPacketNames[ FMI_SAFE_MODE ] = _T("Set Safe Mode Speed");
4091  mFmiPacketNames[ FMI_SAFE_MODE_RESP ] = _T("Set Safe Mode Speed Response");
4092 #endif
4093 
4094 #if( FMI_SUPPORT_A607 )
4095  mFmiPacketNames[ FMI_ID_A607_CLIENT_OPEN_TXT_MSG ] = _T("A607 Client to Server Text Message");
4096  mFmiPacketNames[ FMI_ID_WAYPOINT ] = _T("Create Waypoint");
4097  mFmiPacketNames[ FMI_ID_WAYPOINT_RCPT ] = _T("Create Waypoint Receipt");
4098  mFmiPacketNames[ FMI_ID_WAYPOINT_DELETE ] = _T("Delete Waypoint");
4099  mFmiPacketNames[ FMI_ID_WAYPOINT_DELETED ] = _T("Waypoint Deleted");
4100  mFmiPacketNames[ FMI_ID_WAYPOINT_DELETED_RCPT ] = _T("Waypoint Deleted Receipt");
4101  mFmiPacketNames[ FMI_ID_DELETE_WAYPOINT_CAT ] = _T("Delete Waypoints by Category");
4102  mFmiPacketNames[ FMI_ID_DELETE_WAYPOINT_CAT_RCPT ] = _T("Delete Waypoints by Category Receipt");
4103  mFmiPacketNames[ FMI_ID_CREATE_WAYPOINT_CAT ] = _T("Create Waypoint Category");
4104  mFmiPacketNames[ FMI_ID_CREATE_WAYPOINT_CAT_RCPT ] = _T("Create Waypoint Category Receipt");
4105  mFmiPacketNames[ FMI_ID_TEXT_MSG_DELETE_REQUEST ] = _T("Text Message Delete Request");
4106  mFmiPacketNames[ FMI_ID_TEXT_MSG_DELETE_RESPONSE ] = _T("Text Message Delete Response");
4107  mFmiPacketNames[ FMI_ID_DRIVER_ID_UPDATE_D607 ] = _T("Driver ID Update D607");
4108  mFmiPacketNames[ FMI_ID_DRIVER_STATUS_UPDATE_D607 ] = _T("Driver Status Update D607");
4109 #endif
4110 
4111 #if( FMI_SUPPORT_A608 )
4112  mFmiPacketNames[ FMI_SPEED_LIMIT_SET ] = _T("Set Speed Limit Alerts");
4113  mFmiPacketNames[ FMI_SPEED_LIMIT_RCPT ] = _T("Set Speed Limit Alerts Receipt");
4114  mFmiPacketNames[ FMI_SPEED_LIMIT_ALERT ] = _T("Speed Limit Alerts speeding alert");
4115  mFmiPacketNames[ FMI_SPEED_LIMIT_ALERT_RCPT ] = _T("Speed Limit Alerts speeding alert Receipt");
4116 #endif
4117 
4118 #if( FMI_SUPPORT_A609 )
4119  mFmiPacketNames[ FMI_REBOOT_DEVICE_REQUEST ] = _T("Remote Reboot Request");
4120 #endif
4121 
4122 #if( FMI_SUPPORT_A610 )
4123  mFmiPacketNames[ FMI_SET_ODOMETER_REQUEST ] = _T("AOBRD Set Odometer Request");
4124  mFmiPacketNames[ FMI_DRIVER_LOGIN_REQUEST ] = _T("AOBRD Driver Login Request");
4125  mFmiPacketNames[ FMI_DRIVER_LOGIN_RESPONSE ] = _T("AOBRD Driver Login Response");
4126  mFmiPacketNames[ FMI_DRIVER_PROFILE_DOWNLOAD_REQUEST ] = _T("AOBRD Driver Profile Download Request");
4127  mFmiPacketNames[ FMI_DRIVER_PROFILE_DOWNLOAD_RESPONSE ] = _T("AOBRD Driver Profile Download Response");
4128  mFmiPacketNames[ FMI_DRIVER_PROFILE_UPDATE ] = _T("AOBRD Driver Profile Update");
4129  mFmiPacketNames[ FMI_DRIVER_PROFILE_UPDATE_RESPONSE ] = _T("AOBRD Driver Profile Update Response");
4130  mFmiPacketNames[ FMI_DRIVER_STATUS_UPDATE_REQUEST ] = _T("AOBRD Driver Status Update Request");
4131  mFmiPacketNames[ FMI_DRIVER_STATUS_UPDATE_RESPONSE ] = _T("AOBRD Driver Status Update Response");
4132  mFmiPacketNames[ FMI_DRIVER_STATUS_UPDATE_RECEIPT ] = _T("AOBRD Driver Status Update Receipt");
4133  mFmiPacketNames[ FMI_DOWNLOAD_SHIPMENTS_REQUEST ] = _T("AOBRD Download Shipments Request");
4134  mFmiPacketNames[ FMI_SHIPMENT_DOWNLOAD_RESPONSE ] = _T("AOBRD Shipment Download Response");
4135  mFmiPacketNames[ FMI_SHIPMENT_DOWNLOAD_RECEIPT ] = _T("AOBRD Shipment Download Receipt");
4136  mFmiPacketNames[ FMI_ANNOTATION_DOWNLOAD_REQUEST ] = _T("AOBRD Annotation Download Request");
4137  mFmiPacketNames[ FMI_ANNOTATION_DOWNLOAD_RESPONSE ] = _T("AOBRD Annotation Download Response");
4138  mFmiPacketNames[ FMI_ANNOTATION_DOWNLOAD_RECEIPT ] = _T("AOBRD Annotation Download Receipt");
4139 #endif
4140 
4141 #if( FMI_SUPPORT_A611 )
4142  mFmiPacketNames[ FMI_ID_LONG_TEXT_MSG ] = _T("A611 Long Text Message");
4143  mFmiPacketNames[ FMI_ID_LONG_TEXT_MSG_RCPT ] = _T("A611 Long Text Message Receipt");
4144 #endif
4145 
4146 #if( FMI_SUPPORT_A612 )
4147  mFmiPacketNames[ FMI_CUSTOM_FORM_DEL_REQUEST ] = _T("A612 Delete Form");
4148  mFmiPacketNames[ FMI_CUSTOM_FORM_DEL_RECEIPT ] = _T("A612 Delete Form Receipt");
4149  mFmiPacketNames[ FMI_CUSTOM_FORM_MOVE_REQUEST ] = _T("A612 Move Form");
4150  mFmiPacketNames[ FMI_CUSTOM_FORM_MOVE_RECEIPT ] = _T("A612 Move Form Receipt");
4151  mFmiPacketNames[ FMI_CUSTOM_FORM_GET_POS_REQUEST ] = _T("A612 Request Position of Form");
4152  mFmiPacketNames[ FMI_CUSTOM_FORM_GET_POS_RECEIPT ] = _T("A612 Request Position of Form Receipt");
4153 #endif
4154 #if( FMI_SUPPORT_A614 )
4155  mFmiPacketNames[ FMI_STOP_CALC_ACK_REQUEST ] = _T("A614 Stop Route Calculation ACK");
4156  mFmiPacketNames[ FMI_STOP_CALC_ACK_RECEIPT ] = _T("A614 Stop Route Calculation ACK Receipt");
4157 #endif
4158 #if( FMI_SUPPORT_A613 )
4159  mFmiPacketNames[ FMI_CUSTOM_AVOID_ENABLE_FEATURE_REQUEST ] = _T("A613 Enable Custom Avoidances Feature Request");
4160  mFmiPacketNames[ FMI_CUSTOM_AVOID_ENABLE_FEATURE_RECEIPT ] = _T("A613 Enable Custom Avoidances Feature Receipt");
4161  mFmiPacketNames[ FMI_CUSTOM_AVOID_ADD_REQUEST ] = _T("A613 Add Custom Avoidance");
4162  mFmiPacketNames[ FMI_CUSTOM_AVOID_ADD_RECEIPT ] = _T("A613 Add Custom Avoidance Receipt");
4163  mFmiPacketNames[ FMI_CUSTOM_AVOID_DEL_REQUEST ] = _T("A613 Delete Custom Avoidance");
4164  mFmiPacketNames[ FMI_CUSTOM_AVOID_DEL_RECEIPT ] = _T("A613 Delete Custom Avoidance Receipt");
4165  mFmiPacketNames[ FMI_CUSTOM_AVOID_TOGGLE_REQUEST ] = _T("A613 Toggle Custom Avoidance");
4166  mFmiPacketNames[ FMI_CUSTOM_AVOID_TOGGLE_RECEIPT ] = _T("A613 Toggle Custom Avoidance Receipt");
4167 #endif
4168 #if( FMI_SUPPORT_A615 )
4169  mFmiPacketNames[ FMI_IFTA_DATA_FETCH_REQUEST ] = _T("A615 IFTA Data Fetch Request");
4170  mFmiPacketNames[ FMI_IFTA_DATA_FETCH_RECEIPT ] = _T("A615 IFTA Data Fetch Receipt");
4171  mFmiPacketNames[ FMI_IFTA_DATA_DELETE_REQUEST ] = _T("A615 IFTA Data Delete Request");
4172  mFmiPacketNames[ FMI_IFTA_DATA_DELETE_RECEIPT ] = _T("A615 IFTA Data Delete Receipt");
4173  mFmiPacketNames[ FMI_AOBRD_DRIVER_LOGOFF_REQUEST ] = _T("A615 AOBRD Remote Logoff Request");
4174  mFmiPacketNames[ FMI_AOBRD_DRIVER_LOGOFF_RECEIPT ] = _T("A615 AOBRD Remote Logoff Receipt");
4175  mFmiPacketNames[ FMI_DRIVER_PROFILE_UPDATE_V2 ] = _T("A615 AOBRD Driver Profile Update V2");
4176  mFmiPacketNames[ FMI_DRIVER_PROFILE_DOWNLOAD_RESPONSE_V2 ] = _T("A615 AOBRD Driver Profile Download Response V2");
4177  mFmiPacketNames[ FMI_HOS_AUTO_STATUS_FEATURE_REQUEST ] = _T("A615 HOS Auto Status Feature Request");
4178  mFmiPacketNames[ FMI_HOS_AUTO_STATUS_FEATURE_RECEIPT ] = _T("A615 HOS Auto Status Feature Receipt");
4179  mFmiPacketNames[ FMI_HOS_8_HOUR_RULE_ENABLE_REQUEST ] = _T("A615 HOS 8 Hour Rule Enable Request");
4180  mFmiPacketNames[ FMI_HOS_8_HOUR_RULE_ENABLE_RECEIPT ] = _T("A615 HOS 8 Hour Rule Enable Receipt");
4181  mHosartPacketNames[ HOSART_CHANGE_STATUS ] = _T("HOSART CHANGE STATUS");
4182  mHosartPacketNames[ HOSART_CHANGE_TO_DRIVING_WARNING ] = _T("HOSART CHANGE TO DRIVING WARNING");
4183  mHosartPacketNames[ HOSART_WARNING_FOUND ] = _T("HOSART WARNING FOUND");
4184  mHosartPacketNames[ HOSART_VIOLATION_FOUND ] = _T("HOSART VIOLATION FOUND");
4185  mHosartPacketNames[ HOSART_SET_PS_TO_OFF ] = _T("HOSART SET PS TO OFF");
4186 #endif
4187 #if( FMI_SUPPORT_A616 )
4188  mFmiPacketNames[ FMI_SET_BAUD_REQUEST ] = _T("A616 Set Baud Request");
4189  mFmiPacketNames[ FMI_SET_BAUD_RECEIPT ] = _T("A616 Set Baud Receipt");
4190 #endif
4191 #if( FMI_SUPPORT_A617 )
4192  mFmiPacketNames[ FMI_ALERT_POPUP_REQUEST ] = _T("A617 Create Alert Popup Request");
4193  mFmiPacketNames[ FMI_ALERT_POPUP_RECEIPT ] = _T("A617 Create Alert Popup Receipt");
4194  mFmiPacketNames[ FMI_SENSOR_CONFIG_REQUEST ] = _T("A617 Config Sensor Request");
4195  mFmiPacketNames[ FMI_SENSOR_CONFIG_RECEIPT ] = _T("A617 Config Sensor Receipt");
4196  mFmiPacketNames[ FMI_SENSOR_DELETE_REQUEST ] = _T("A617 Delete Sensor Request");
4197  mFmiPacketNames[ FMI_SENSOR_DELETE_RECEIPT ] = _T("A617 Delete Sensor Receipt");
4198  mFmiPacketNames[ FMI_SENSOR_UPDATE_REQUEST ] = _T("A617 Update Sensor Request");
4199  mFmiPacketNames[ FMI_SENSOR_QUERY_DISPLAY_INDEX_REQUEST ] = _T("A617 Query Sensor Display Index Request");
4200  mFmiPacketNames[ FMI_SENSOR_QUERY_DISPLAY_INDEX_RECEIPT ] = _T("A617 Query Sensor Display Index Receipt");
4201 #endif
4202 #if( FMI_SUPPORT_A619 )
4203  mFmiPacketNames[ FMI_HOS_SET_SETTING_DATA_REQUEST ] = _T("A619 HOS Set Setting Data Request");
4204  mFmiPacketNames[ FMI_HOS_SET_SETTING_DATA_RECEIPT ] = _T("A619 HOS Set Setting Data Receipt");
4205 #endif
4206 #if( CDT_SUPPORT )
4207  mCdtPacketNames[ CDT_DATA_TRANSFER ] = _T("CDT Data Transfer");
4208  mCdtPacketNames[ CDT_PING_REQUEST ] = _T("CDT Ping Request");
4209  mCdtPacketNames[ CDT_PING_RECEIPT ] = _T("CDT Ping Receipt");
4210 #endif
4211 #if( FMI_SUPPORT_A621 )
4212  mFmiPacketNames[ FMI_CUSTOM_FORM_SHOW_REQUEST ] = _T("A621 Request Show Form");
4213  mFmiPacketNames[ FMI_CUSTOM_FORM_SHOW_RECEIPT ] = _T("A621 Request Show Form Receipt");
4214 #endif
4215 #if( FMI_SUPPORT_A622 )
4216  mFmiPacketNames[ FMI_DASHCAM_SETTINGS_LOCK_REQUEST ] = _T("A622 Dashcam Setting Lock Request");
4217  mFmiPacketNames[ FMI_DASHCAM_SETTINGS_LOCK_RECEIPT ] = _T("A622 Dashcam Setting Lock Receipt");
4218  mFmiPacketNames[ FMI_DASHCAM_CONFIG_REQUEST ] = _T("A622 Dashcam Set Config Request");
4219  mFmiPacketNames[ FMI_DASHCAM_CONFIG_RECEIPT ] = _T("A622 Dashcam Set Config Receipt");
4220  mFmiPacketNames[ FMI_DASHCAM_GET_SETTINGS_REQUEST ] = _T("A622 Dashcam Get Settings Request");
4221  mFmiPacketNames[ FMI_DASHCAM_GET_SETTINGS_RESPONSE ] = _T("A622 Dashcam Get Settings Response");
4222  mFmiPacketNames[ FMI_DASHCAM_SET_NTFCTN_REQUEST ] = _T("A622 Dashcam Set Ntfctn Request");
4223  mFmiPacketNames[ FMI_DASHCAM_SET_NTFCTN_RECEIPT ] = _T("A622 Dashcam Set Ntfctn Receipt");
4224  mFmiPacketNames[ FMI_DASHCAM_GET_NTFCTN_SETTINGS_REQUEST ] = _T("A622 Dashcam Get Ntfctn Settings Request");
4225  mFmiPacketNames[ FMI_DASHCAM_GET_NTFCTN_SETTINGS_RESPONSE ] = _T("A622 Dashcam Get Ntfctn Settings Response");
4226  mFmiPacketNames[ FMI_DASHCAM_NTFCTN_REQUEST ] = _T("A622 Dashcam Ntfctn Request");
4227  mFmiPacketNames[ FMI_DASHCAM_NTFCTN_RECEIPT ] = _T("A622 Dashcam Ntfctn Receipt");
4228  mFmiPacketNames[ FMI_DASHCAM_INCDNT_FILE_NTFCTN_REQUEST ] = _T("A622 Dashcam Incident File Ntfctn Request");
4229  mFmiPacketNames[ FMI_DASHCAM_INCDNT_FILE_NTFCTN_RECEIPT ] = _T("A622 Dashcam Incident File Ntfctn Receipt");
4230 #endif
4231 #if( FMI_SUPPORT_A623 )
4232  mFmiPacketNames[ FMI_ID_ETA_MODE_REQUEST ] = _T("A623 ETA Mode Request");
4233  mFmiPacketNames[ FMI_ID_ETA_MODE_RCPT ] = _T("A623 ETA Mode Receipt");
4234 #endif
4235 }
4236 #endif
4237 
4238 #if( FMI_SUPPORT_A607 )
4239 //----------------------------------------------------------------------
4242 //----------------------------------------------------------------------
4244 {
4245  mFmiFeatureNames.clear();
4246 
4247  mFmiFeatureNames[ FEATURE_ID_UNICODE ] = _T("Unicode");
4248  mFmiFeatureNames[ FEATURE_ID_A607_SUPPORT ] = _T("A607 Support");
4249  mFmiFeatureNames[ FEATURE_ID_DRIVER_PASSWORDS ] = _T("Driver Password Support");
4250  mFmiFeatureNames[ FEATURE_ID_MULTIPLE_DRIVERS ] = _T("Multiple Drivers");
4251  mFmiFeatureNames[ FEATURE_ID_AOBRD_SUPPORT ] = _T("AOBRD Support");
4252 }
4253 #endif
4254 
4255 //----------------------------------------------------------------------
4257 //----------------------------------------------------------------------
4259 {
4260  mGarminPacketNames.clear();
4261  mGarminPacketNames[ ID_ACK_BYTE ] = _T("ACK");
4262  mGarminPacketNames[ ID_NAK_BYTE ] = _T("NAK");
4263  mGarminPacketNames[ ID_PVT_DATA ] = _T("PVT Data");
4264  mGarminPacketNames[ ID_UNIT_ID ] = _T("Unit ID Data");
4265  mGarminPacketNames[ ID_COMMAND_BYTE ] = _T("Command Packet");
4266  mGarminPacketNames[ ID_PRODUCT_DATA ] = _T("Legacy Product Data");
4267  mGarminPacketNames[ ID_PRODUCT_RQST ] = _T("Legacy Product Request");
4268  mGarminPacketNames[ ID_PROTOCOL_ARRAY ] = _T("Legacy Protocol Array");
4269 
4270 #if( FMI_SUPPORT_LEGACY )
4271  mGarminPacketNames[ ID_LEGACY_STOP_MSG ] = _T("Legacy Stop Message");
4272  mGarminPacketNames[ ID_LEGACY_TEXT_MSG ] = _T("Legacy Text Message");
4273 #endif
4274 
4275 #if( FMI_SUPPORT_A602 )
4276  mGarminPacketNames[ ID_FMI_PACKET ] = _T("FMI Packet");
4277 #endif
4278 
4279 #if( FMI_SUPPORT_A615 )
4280  mGarminPacketNames[ ID_HOSART_PACKET ] = _T("HOSART Packet");
4281  mGarminPacketNames[ ID_SET_TIME_PACKET ] = _T("Set Time Packet");
4282 #endif
4283 }
4284 
4285 //----------------------------------------------------------------------
4287 //----------------------------------------------------------------------
4289 {
4290  mGarminCommandNames.clear();
4291  mGarminCommandNames[ COMMAND_REQ_DATE_TIME ] = _T("Request Date/Time");
4292  mGarminCommandNames[ COMMAND_REQ_UNIT_ID ] = _T("Request Unit ID (ESN)");
4293  mGarminCommandNames[ COMMAND_TURN_ON_PVT_DATA ] = _T("Turn On PVT Data");
4294  mGarminCommandNames[ COMMAND_TURN_OFF_PVT_DATA ] = _T("Turn Off PVT Data");
4295 }
4296 
4297 //----------------------------------------------------------------------
4300 //----------------------------------------------------------------------
4302  (
4303  int aLineNumber
4304  )
4305 {
4306  int filenameLength = WideCharToMultiByte( CP_ACP, 0, mLogFilename, -1, NULL, 0, NULL, NULL );
4307  char *filenameAnsi = new char[filenameLength];
4308  WideCharToMultiByte( CP_ACP, 0, mLogFilename, -1, filenameAnsi, filenameLength, NULL, NULL );
4309  ifstream logFile( filenameAnsi, ios_base::in );
4310  delete[] filenameAnsi;
4311 
4312  if( logFile.good() )
4313  {
4314  std::string lineString;
4315  const char* line;
4316  uint8 packet[MAX_PACKET_SIZE];
4317  id_type packetId;
4318  uint8 payloadSize;
4319  uint8 payload[MAX_PAYLOAD_SIZE];
4320 
4321  int i = 0;
4322  logFile.seekg( mLineOffset[aLineNumber] );
4323  getline( logFile, lineString );
4324  line = lineString.c_str();
4325 
4326  while( line[i++] != '-' ); //skip time
4327 
4328  UTIL_hex_to_uint8( line + i, packet, MAX_PACKET_SIZE ); //transform to uint8
4329 
4330  i = 1; // point past DLE that starts the frame
4331  packetId = packet[i++];
4332  payloadSize = packet[i++];
4333  if( payloadSize == ID_DLE_BYTE )
4334  {
4335  i++; //size may be DLE stuffed
4336  }
4337 
4338  int payloadIdx = 0;
4339  for( payloadIdx = 0; payloadIdx < payloadSize; payloadIdx++ )
4340  {
4341  payload[payloadIdx] = packet[i++];
4342  if( payload[payloadIdx] == ID_DLE_BYTE )
4343  {
4344  i++;
4345  }
4346  }
4347  GarminTransportLayer::getInstance()->tx( new GarminPacket( packetId, payload, payloadSize ), FALSE );
4348  }
4349 }
char text_message[200]
Message text (variable length, null-terminated string)
Definition: fmi.h:1162
time_type origination_time
Time when the message was created by the client.
Definition: fmi.h:1178
uint32 status_change_id
unique identifier
Definition: fmi.h:1488
char text_message[LONG_TEXT_MSG_CHUNK_SIZE]
Definition: fmi.h:1894
boolean result_code
TRUE if the operation was successful, FALSE otherwise.
Definition: fmi.h:1702
uint32 msg_ack_type
The response selected by the user.
Definition: fmi.h:1151
Data type for the Server to Client Open Text Message Receipt Packet ID.
Definition: fmi.h:1342
uint8 id[16]
The message ID.
Definition: fmi.h:1546
virtual void tx(Packet *aPacket, bool aSendImmediate)
Transmit a Packet.
Data type for the Set Odometer Request Packed ID (0X1100) from server to client.
Definition: fmi.h:1736
struct date_time_data_type::_date date
virtual CString getPacketTitle(int aLineNumber)
Construct a packet title for the given log logLine.
Payload of FMI_ID_SERVER_OPEN_TXT_MSG packet.
Definition: fmi.h:1125
uint32 response_id[50]
List of responses that are allowed.
Definition: fmi.h:1384
Data type for Get Dashcam Notification Settings Packet ID (0X1609) from client to server...
Definition: fmi.h:2310
Payload for FMI_ID_ENABLE.
Definition: fmi.h:1115
uint8 id[16]
The message ID.
Definition: fmi.h:1728
uint8 second
second (0-59)
Definition: garmin_types.h:162
uint8 id_size
Number of significant bytes in the message ID.
Definition: fmi.h:1544
Data type for the Annotation Download Receipt Packet ID (0X110E) from client to server.
Definition: fmi.h:1862
uint8 result_code
Definition: fmi.h:1785
Data type for Alert Popup Receipt Packet ID (0x1401) from client to server.
Definition: fmi.h:2147
uint32 unique_id
Definition: fmi.h:1944
uint16 response_count
Number of protocols in the response_list.
Definition: fmi.h:1600
uint32 change_id
Definition: fmi.h:2169
Data type for Custom Avoidance Enable/Disable (0X1234) from server to client.
Definition: fmi.h:1995
#define MAX_PACKET_SIZE
Maximum packet size that can be transmitted.
Definition: garmin_types.h:31
char name[16+1]
Category name, null terminated.
Definition: fmi.h:1694
uint8 file_type
File type.
Definition: fmi.h:1278
char name[30+1]
Waypoint name, null-terminated.
Definition: fmi.h:1672
Data type for Configure/Update/Delete Sensor Receipt Packet IDs (0x1403,0x1405) from client to server...
Definition: fmi.h:2167
sc_position_type stop_position
Location of the stop.
Definition: fmi.h:1194
char server_shipper_name[40]
Definition: fmi.h:1826
char text_message[200]
Message text, variable length, null-terminated string, 200 bytes max.
Definition: fmi.h:1337
sc_position_type scposn
Definition: fmi.h:2331
uint8 request_type
Definition: fmi.h:2127
uint8 id_size
id_size from the canned_response_list_data_type
Definition: fmi.h:1399
Element of the array returned in Garmin ID_PROTOCOL_ARRAY (A001) or FMI_ID_PROTOCOL_DATA (A602) packe...
Definition: fmi.h:1108
Data type for the Delete Message Status Packet ID.
Definition: fmi.h:1723
char tag
Type of protocol (e.g., &#39;A&#39;, D&#39;)
Definition: fmi.h:1110
sc_position_type posn
Waypoint position.
Definition: fmi.h:1670
uint8 baud_rate_type
Definition: fmi.h:2128
Data type for Driver ID Update Packet ID.
Definition: fmi.h:1417
time_type timestamp
Time the alert was generated.
Definition: fmi.h:1630
Data type for the Message Status Packet ID.
Definition: fmi.h:1551
uint8 result_code
Result code, a valid speed_limit_alert_result_data_type.
Definition: fmi.h:1651
boolean result_code
True if the update was successful.
Definition: fmi.h:1444
CString formatLatitude(sint32 aSemicircles)
Format latitude.
uint8 id[16]
Message ID from the canned_response_list_data_type.
Definition: fmi.h:1402
Data type for File Transfer End.
Definition: fmi.h:1323
CString formatLongitude(sint32 aSemicircles)
Format longitude.
aobrd_download_receipt_result_code result_code
Definition: fmi.h:1865
Payload of FMI_ID_A602_STOP packet.
Definition: fmi.h:1220
uint8 id_size
Number of significant bytes in the message ID.
Definition: fmi.h:1716
uint8 minute
minute (0-59)
Definition: garmin_types.h:161
char text[51]
Text/description of the stop. Variable length, null-terminated string.
Definition: fmi.h:1224
uint32 status_change_id
unique identifier
Definition: fmi.h:1479
Data type for HOS Settings Request Packet ID (0x1500) from server to client.
Definition: fmi.h:2217
uint16 unique_id
Server-assigned unique ID from the FMI_ID_WAYPOINT packet.
Definition: fmi.h:1680
Data type for the Driver Profile Data Packet ID (0X1103) from client to server.
Definition: fmi.h:1760
Data type for Dashcam Notification Packet ID (0X160C) from client to server (request) ...
Definition: fmi.h:2337
void initGarminCommandNames()
Initialize the map of Garmin command IDs to text strings.
uint32 status_id
status_id from the driver_status_list_item_data_type or driver_status_list_item_delete_data_type ...
Definition: fmi.h:1462
double_position_type position
Current position of the client.
Definition: fmi.h:1072
Data type for the FMI Safe Mode setup Packet ID.
Definition: fmi.h:1608
boolean finished_flag
Definition: fmi.h:1885
Data type for the IFTA Data Delete Request Packet ID (0X0008) from server to client.
Definition: fmi.h:2021
time_type origination_time
Origination time of the response.
Definition: fmi.h:1147
Data type for Update Sensor Request Packet ID (0x1406) from server to client.
Definition: fmi.h:2184
uint32 crc
CRC of entire file as computed by UTL_calc_crc32.
Definition: fmi.h:1325
void UTIL_format_date_string(const date_time_data_type *aDateTime, char *aResultString, int aResultStringSize)
Format a date as a string.
Definition: util.cpp:657
uint32 unique_id
Unique ID of the A603 stop.
Definition: fmi.h:1203
char driver_id[50]
New driver ID (null terminated string)
Definition: fmi.h:1423
uint8 response_count
Number of elements in response_id array.
Definition: fmi.h:1381
Data type for HOS Settings Receipt Packet ID (0x1501) from client to server.
Definition: fmi.h:2226
char name[49]
Definition: fmi.h:1975
char new_text[50]
Text to display.
Definition: fmi.h:1564
uint8 message_type
Message type, a valid a604_message_type.
Definition: fmi.h:1334
uint32 status_change_id
status_change_id from the driver_status_data_type
Definition: fmi.h:1499
uint16 cat_id
Category that was deleted (0-15)
Definition: fmi.h:1708
#define SIZE_OF_FOOTER
Size of packet footer (after payload and checksum)
Definition: garmin_types.h:37
uint8 time_over
Seconds until speeding event begins.
Definition: fmi.h:1641
Garmin serial packet.
Definition: GarminPacket.h:26
Data type for the Driver Profile Update Response Data Packet ID (?) from client to server...
Definition: fmi.h:1783
Payload of FMI_ID_CLIENT_TXT_MSG_RCPT packet.
Definition: fmi.h:1167
uint16 features[126]
Array of feature IDs.
Definition: fmi.h:1119
char driver_id[50]
New driver ID (null terminated string, 50 bytes max)
Definition: fmi.h:1411
Payload of FMI_ID_A607_CLIENT_OPEN_TXT_MSG packet.
Definition: fmi.h:1176
boolean result_code
True if the update was successful.
Definition: fmi.h:1617
boolean result_code
True if the update was successful.
Definition: fmi.h:1463
uint8 id_type
Garmin packet ID.
Definition: garmin_types.h:101
void initFmiPacketNames()
Initialize the map of FMI packet IDs to text strings.
uint8 driver_idx
Index of driver changed.
Definition: fmi.h:1445
Data type for Change to Driving Warning HOSART Packet ID (0X0001)
Definition: fmi.h:2095
char message[50]
Message text, variable length, null terminated (50 bytes max)
Definition: fmi.h:1520
uint16 symbol
Waypoint symbol.
Definition: fmi.h:1669
Data type for Dashcam Notification Packet ID (0X1606) from client to server (request) ...
Definition: fmi.h:2328
char comment[50+1]
Waypoint comment, null-terminated.
Definition: fmi.h:1673
STL namespace.
uint32 next_offset
offset of next data the server should send, or 0xFFFFFFFF for an error
Definition: fmi.h:1318
Data type for Route Calculation ACK Receipt Packet ID (0X1221) from server to client.
Definition: fmi.h:1951
uint32 status_change_id
Unique ID for this driver ID change.
Definition: fmi.h:1419
char driver_id[40]
Definition: fmi.h:1786
Payload for Garmin ID_UNIT_ID packet.
Definition: fmi.h:1093
Data type for File Data Packet ID.
Definition: fmi.h:1305
void UTIL_format_time_string(const date_time_data_type *aDateTime, char *aResultString, int aResultStringSize)
Converts a time structure (date_time_data_type) to a time string representation.
Definition: util.cpp:575
Data type for the IFTA Data Fetch Receipt Packet ID (0X0007) from client to server.
Definition: fmi.h:2014
uint8 result_code
Result of operation.
Definition: fmi.h:1288
uint8 id[16]
Message ID that this list is for.
Definition: fmi.h:1383
uint8 file_version_length
Number of significant bytes in file_version.
Definition: fmi.h:1277
uint16 product_id
Product ID of the client.
Definition: fmi.h:1102
uint8 category
Alert category, a valid speed_limit_alert_category_type.
Definition: fmi.h:1627
Data type for Dashcam Lock Settings Packet ID (0X1600) from server to client.
Definition: fmi.h:2248
uint16 stop_index_in_list
The stop index in list.
Definition: fmi.h:1205
Data type for the User Interface Text Packet ID.
Definition: fmi.h:1561
uint8 id_size
ID size of message being responded to.
Definition: fmi.h:1181
Data type for Dashcam Get Settings Packet ID (0X1604, 0X1608) from server to client.
Definition: fmi.h:2283
CString formatText(const char *aText, int aMaxLength)
Format a text string, with up to 29 characters per line.
uint16 new_state
New state, see message_throttling_state_type for valid values.
Definition: fmi.h:1582
#define cnt_of_array(_a)
The number of elements in _a.
Definition: util_macros.h:90
CString formatBoolean(boolean aBool)
Translate a boolean to an equivalent string.
time_type status_change_time
timestamp of status change
Definition: fmi.h:1489
uint32 unique_id
unique_id from client_to_server_open_text_msg_data_type
Definition: fmi.h:1169
Packet receipt for Packet Receipt Packet ID.
Definition: fmi.h:1315
#define offset_of(_s, _m)
The offset of _m from the beginning of _s.
Definition: util_macros.h:84
uint32 status_id
ID for the driver status list item to delete.
Definition: fmi.h:1472
#define FALSE
Definition: garmin_types.h:46
Data type for the IFTA Data Delete Receipt Packet ID (0X0009) from client to server.
Definition: fmi.h:2029
Data type for the User Interface Text Receipt Packet ID.
Definition: fmi.h:1569
Data type for the A604 Server to Client Open Text Message Packet ID.
Definition: fmi.h:1330
double UTIL_convert_radians_to_degrees(double aRadians)
Converts a latitude/longitude from radians to degrees.
Definition: util.cpp:247
Data type for the Shipment Download Receipt Packet ID (0X110B) from client to server.
Definition: fmi.h:1835
struct date_time_data_type::_time time
const char * getCustomFormErrorMsg(const FMI_cf_rcode code)
Lookup for custom forms transmission error codes.
boolean result_code
Result code. TRUE if success, FALSE otherwise.
Definition: fmi.h:1346
uint8 id_size
Number of significant bytes in the message ID.
Definition: fmi.h:1553
uint32 unique_id
Unique ID of the stop for use with the Stop Status protocol.
Definition: fmi.h:1195
uint8 status_code
Message status, see fmi_A604_message_status for valid values.
Definition: fmi.h:1554
float32 altitude
Altitude above the WGS84 ellipsoid, in meters.
Definition: fmi.h:1066
uint16 record_count_or_reserved_when_gpi
Useful for locating cause of errors.
Definition: fmi.h:1290
Data type for the Driver Status Update Receipt packet.
Definition: fmi.h:1497
Data type for the Text Message Ack Receipt Packet ID.
Definition: fmi.h:1587
boolean enable
Definition: fmi.h:1973
Data type for the Delete Canned Message Packet ID.
Definition: fmi.h:1525
Data type for Driver ID Update Packet ID.
Definition: fmi.h:1407
message_throttling_data_type response_list[60]
One element for each protocol with ID and state.
Definition: fmi.h:1601
uint32 unit_id
Unit ID (ESN) of the client.
Definition: fmi.h:1095
Data type for the ETA Data Receipt Packet ID.
Definition: fmi.h:1258
uint32 status_change_id
Unique ID for this driver ID change.
Definition: fmi.h:1409
Data type for Custom Avoidance Delete (0X1232) from server to client.
Definition: fmi.h:1988
uint32 violation_type
Definition: fmi.h:2107
boolean play_sound
Definition: fmi.h:2141
List of canned responses that the client requests updated text for.
Definition: fmi.h:1389
time_type origination_time
Time when the stop was originated by the server.
Definition: fmi.h:1193
Payload of FMI_ID_STOP_STATUS and FMI_ID_STOP_STATUS_REQUEST packets.
Definition: fmi.h:1201
Data type for the Driver Login Data Packet ID (0X1101) from client to server.
Definition: fmi.h:1743
Data type for Driver ID Request Packet ID.
Definition: fmi.h:1432
uint16 unique_id
Definition: fmi.h:1972
void UTIL_convert_seconds_to_time_type(const time_type *aSeconds, date_time_data_type *aDateTime)
Converts from a Garmin time to a structure containing separate members for hour, minute, and second (time_type).
Definition: util.cpp:274
Date & time data type with separate fields for month, day, year, hour, minute, and second...
Definition: garmin_types.h:150
float32 up_velocity
Up velocity in m/s, negative is down.
Definition: fmi.h:1075
double UTIL_convert_semicircles_to_degrees(sint32 aSemicircles)
Converts a latitude/longitude from semicircles to degrees.
Definition: util.cpp:260
Data type for the User Interface Text Receipt Packet ID.
Definition: fmi.h:1615
Data type for Custom Avoidance Receipt ID (0X1231) from client to server.
Definition: fmi.h:1980
uint8 error_code_or_file_type_when_gpi
Set if result code is 5.
Definition: fmi.h:1289
uint32 response_id
Unique ID of this canned response.
Definition: fmi.h:1355
sint32 lat
latitude in semicircles
Definition: garmin_types.h:126
time_type status_change_time
Time when the driver ID changed.
Definition: fmi.h:1420
#define ID_ETX_BYTE
Definition: garmin_types.h:39
uint8 id[16]
The message ID from the server to client open text message.
Definition: fmi.h:1348
time_type status_change_time
timestamp of status change
Definition: fmi.h:1480
float64 lat
latitude in radians, positive is north
Definition: garmin_types.h:137
void initFmiFeatureNames()
Initialize the map of FMI packet IDs to text strings.
uint16 packet_id
First packet ID in the protocol to throttle.
Definition: fmi.h:1581
Data type for the Message Status Request Packet ID.
Definition: fmi.h:1714
CString getGarminCommandName(uint16 aCommandId)
Translate a Garmin command ID into a string describing the command name.
uint8 result_code
Definition: fmi.h:2170
Data type for the HOS Auto Status Update Enable Packet ID (0X1300) from server to client...
Definition: fmi.h:2054
Payload of server to client messages requiring a response (A602)
Definition: fmi.h:1134
time_type origination_time
Time when the message was sent by the client.
Definition: fmi.h:1160
char text_message[200]
The message text (variable length, null terminated, 200 bytes max)
Definition: fmi.h:1128
Payload of FMI_ID_TEXT_MSG_ACK packet.
Definition: fmi.h:1145
#define minval(_x, _y)
The smaller of _x and _y.
Definition: util_macros.h:95
uint8 id_size
Number of significant bytes in the message ID.
Definition: fmi.h:1725
uint8 time_under
Seconds until speeding event ends.
Definition: fmi.h:1642
time_type adverse_condition_time
Definition: fmi.h:2046
uint32 new_status
Definition: fmi.h:2090
time_type timestamp
Timestamp of the alert that is being acknowledged.
Definition: fmi.h:1659
uint16 UTIL_hex_to_uint8(const char *aHexString, uint8 *aBinaryData, uint16 aMaxBytes)
Convert a hexadecimal ASCII string to an array of uint8.
Definition: util.cpp:323
uint8 data_length
length of file_data (0..245)
Definition: fmi.h:1308
uint8 id_size
Number of significant bytes of the message ID.
Definition: fmi.h:1137
char description[110]
Definition: fmi.h:2193
uint8 operation_mode
Definition: fmi.h:2171
uint32 stop_time
Minimum stop time before auto-arrival is activated, in seconds.
Definition: fmi.h:1242
Data type for Dashcam Get Settings Packet ID (0X1605) from client to server.
Definition: fmi.h:2290
uint32 unique_id
Unique ID generated by client.
Definition: fmi.h:1161
const float cMsToMph
Data type for the Set Canned Message Packet ID.
Definition: fmi.h:1517
uint32 driver_status
ID corresponding to the new driver status.
Definition: fmi.h:1490
Data type for Custom Forms Packet ID (0X1202) from client to server.
Definition: fmi.h:1923
Data type for the Message Status Request Packet ID.
Definition: fmi.h:1542
Data type for Delete Sensor Request Packet ID (0x1404) from server to client.
Definition: fmi.h:2176
Data type for FMI_ID_WAYPOINT packet.
Definition: fmi.h:1666
CString formatMessageId(const uint8 *aMessageId, uint8 aMessageIdSize)
Format a message ID in hex, with up to 8 bytes per line.
Payload of FMI_ID_CLIENT_OPEN_TXT_MSG packet.
Definition: fmi.h:1158
float32 east_velocity
East velocity in m/s, negative is west.
Definition: fmi.h:1073
Data type for Long Text Message Request Packet ID (0X0055) from server to client. ...
Definition: fmi.h:1873
float32 mean_sea_level_height
Height of WGS84 ellipsoid above MSL at current position, in meters.
Definition: fmi.h:1076
uint8 driver_idx
Driver index to change.
Definition: fmi.h:1434
Payload of FMI_ID_A603_STOP packet.
Definition: fmi.h:1191
Data type for the Driver Status Log Receipt Packet ID (0X1108) from client to server.
Definition: fmi.h:1813
char text[200]
Text (description) of stop. Variable length, null-terminated string.
Definition: fmi.h:1196
sc_position_type position_of_destination
Location of destination.
Definition: fmi.h:1253
time_type origination_time
Definition: fmi.h:1876
Data type for AOBRD Driver Logoff Receipt Packet ID (0X1311) from client to server.
Definition: fmi.h:2078
Data type for Query Sensor Display Index Request Packet ID (0x1407) from server to client...
Definition: fmi.h:2198
Data type for Baud Rate Change Receipt Packet ID (0x0012) from client to server.
Definition: fmi.h:2124
Data type for Custom Avoidance Packet ID (0X1230) from server to client.
Definition: fmi.h:1968
uint32 text_element_id
text_element_id from the user_interface_text_data_type
Definition: fmi.h:1571
void UTIL_convert_seconds_to_date_type(const time_type *aSeconds, date_time_data_type *aDateTime)
Converts a Garmin date to a structure containing year, month, and day.
Definition: util.cpp:39
uint8 driver_idx
Index of the driver to update.
Definition: fmi.h:1501
sc_position_type point2
Definition: fmi.h:1971
signed long int sint32
32-bit signed integer
Definition: garmin_types.h:59
uint8 result_code
Definition: fmi.h:1946
Data type for Query Sensor Display Index Receipt Packet ID (0x1408) from client to server...
Definition: fmi.h:2206
uint8 file_version[16]
Server-defined version string.
Definition: fmi.h:1280
Data type for the Shipment Download Response Packet ID (0X110A) from server to client.
Definition: fmi.h:1821
uint8 result_code
Enum indicating result code, see canned_response_list_result for valid values.
Definition: fmi.h:1400
void initGarminPacketNames()
Initialize the map of Garmin packet IDs to text strings.
Data type for the Speed Limit Alert Receipt Packet ID.
Definition: fmi.h:1657
uint8 id[16]
ID of message being responded to.
Definition: fmi.h:1183
Data type for Custom Forms Packet ID (0X1203, 0X1205) from client to server.
Definition: fmi.h:1931
Data type for the Annotation Download Response Packet ID (0X110D) from server to client.
Definition: fmi.h:1850
virtual ~FmiLogParser()
Destructor.
Data type for AOBRD Driver Logoff Request Packet ID (0X1310) from server to client.
Definition: fmi.h:2071
Data type for Delete Driver Status List Item Receipt.
Definition: fmi.h:1470
Data type for Driver ID Receipt packet.
Definition: fmi.h:1441
char status[50]
Text displayed for the item (variable length, null terminated, 50 bytes max)
Definition: fmi.h:1454
Data type for the Speed Limit Alert Packet ID.
Definition: fmi.h:1625
uint32 offset
offset of data received
Definition: fmi.h:1317
unsigned short int uint16
16-bit unsigned integer
Definition: garmin_types.h:64
boolean alert_user
Audibly alert the driver.
Definition: fmi.h:1643
Data type for the A607 Driver Status Update packet.
Definition: fmi.h:1486
PacketStatusType
Enumeration for packet status values.
#define ID_NAK_BYTE
Definition: garmin_types.h:42
time_type server_timestamp
Definition: fmi.h:1823
Data type for Baud Rate Change Request Packet ID (0x0011) from server to client.
Definition: fmi.h:2116
float32 speed
FMI safe mode speed.
Definition: fmi.h:1610
boolean result_code
True if the update was successful.
Definition: fmi.h:1572
Payload for Garmin ID_PVT_DATA packet.
Definition: fmi.h:1064
Data type for Custom Forms Packet ID (0X1201) from client to server.
Definition: fmi.h:1915
uint8 id_size
Number of significant bytes of the message ID.
Definition: fmi.h:1148
uint16 stop_status
The stop status.
Definition: fmi.h:1204
float max_speed
Maximum speed since last alert.
Definition: fmi.h:1633
sc_position_type scposn
Position when the text message was created by the client.
Definition: fmi.h:1179
char driver_id[50]
Definition: fmi.h:1762
uint32 offset
offset of this data from the beginning of the file
Definition: fmi.h:1307
Data type for the Set Driver Status List Item and Delete Driver Status List Item Receipt packets...
Definition: fmi.h:1460
__packed struct fmi_dashcam_settings_list settings_list[30]
Definition: fmi.h:2295
CString formatFmiPacket(BOOL transmitted, uint16 aFmiPacketId, uint8 *aFmiPayload, uint8 aFmiPayloadSize)
Interpret an FMI packet; appending the information to the text in the packet window.
Data type for the Set Driver Status List Item packet.
Definition: fmi.h:1451
Data type for the Driver Profile Data Packet ID (0X1104) from server to client.
Definition: fmi.h:1767
Data type for Warning Found and Violation Found HOSART Packet IDs (0X0002,0X0003) ...
Definition: fmi.h:2105
time_type status_change_time
Time when the driver ID changed.
Definition: fmi.h:1410
uint8 baud_rate_type
Definition: fmi.h:2119
Data type for the Message Throttling Command Packet ID and Message Throttling Response Packet ID...
Definition: fmi.h:1579
Data type for the FMI_ID_WAYPOINT_RCPT packet.
Definition: fmi.h:1678
virtual CString getPacketDetail(int aLineNumber)
Print a particular packet to the packet view.
uint32 data_type
Type of data to delete, see del_data for valid values.
Definition: fmi.h:1267
Data type for the File Transfer Start Packet ID.
Definition: fmi.h:1274
sint16 software_version
Software version * 100 (312 means version 3.12)
Definition: fmi.h:1103
uint32 distance_to_destination
Distance to destination, in meters, or 0xFFFFFFFF if no active destination.
Definition: fmi.h:1252
Data type for Dashcam Notifictation Packet ID (0X160A) from server to client (receipt) ...
Definition: fmi.h:2321
Data type for Driver Status Request Packet ID.
Definition: fmi.h:1508
sc_position_type posn
Position at the time of alert.
Definition: fmi.h:1629
uint32 unique_id
Uniquely identifies the ETA message.
Definition: fmi.h:1250
uint32 unique_id
Unique ID from eta_data_type.
Definition: fmi.h:1260
sc_position_type stop_position
Location of the stop.
Definition: fmi.h:1223
boolean result_code
TRUE if the operation was successful, FALSE otherwise.
Definition: fmi.h:1681
Data type for the Annotation Download Request Packet ID (0X110C) from client to server.
Definition: fmi.h:1843
uint16 year
Real year (1990 means 1990!)
Definition: garmin_types.h:156
Data type for Long Test Message Receipt Packet ID (0X0056) from client to server. ...
Definition: fmi.h:1899
Data type for the Speed Limit Alerts setup Receipt Packet ID.
Definition: fmi.h:1649
time_type origination_time
Origination time of the message being acknowledged.
Definition: fmi.h:1344
char alert_text[110]
Definition: fmi.h:2142
Data type for the ETA Data Packet ID.
Definition: fmi.h:1248
uint8 id_size
Size of the message ID.
Definition: fmi.h:1380
uint16 count
Number of items deleted.
Definition: fmi.h:1709
Data type for Dashcam Configure Settings Packet ID (0X1602) from server to client.
Definition: fmi.h:2274
Data type for the Set Canned Response Packet ID.
Definition: fmi.h:1353
char password[20]
Driver password (null terminated string). Optional if driver password support is not enabled...
Definition: fmi.h:1424
CString formatTime(time_type aTimestamp)
Format Garmin UTC timestamp.
uint8 id_size
Size of the message ID.
Definition: fmi.h:1589
CString getGarminPacketName(uint8 aPacketId)
Translate a Garmin packet ID into a string describing the packet name.
time_type origination_time
Origination time of the message.
Definition: fmi.h:1136
const float cMsToKph
uint32 text_element_id
ID of the user interface element being changed.
Definition: fmi.h:1563
Data type for Change Status HOSART Packet ID (0X0000)
Definition: fmi.h:2087
Data type for the Driver Profile Data Packet ID (0X1110) from server to client and Driver Profile Dat...
Definition: fmi.h:2037
float speed
Speed at the time of alert.
Definition: fmi.h:1631
uint8 id[16]
The message ID.
Definition: fmi.h:1556
uint8 month
month (1-12)
Definition: garmin_types.h:154
unsigned char uint8
8-bit unsigned integer
Definition: garmin_types.h:62
void appendIFTADataModResultCode(CString &packet, uint8 result_code)
Data type for Route Calculation ACK Packet ID (0X1220) from client to server.
Definition: fmi.h:1942
time_type origination_time
Origination time when the server sent the stop to the client.
Definition: fmi.h:1222
uint32 message_id
ID of the canned message.
Definition: fmi.h:1535
Data type for the FMI_ID_CREATE_WAYPOINT_CAT packet.
Definition: fmi.h:1691
time_type timestamp
Definition: fmi.h:2109
Payload for Garmin ID_PRODUCT_DATA (A000) and FMI FMI_ID_PRODUCT_ID_DATA (A602) packet.
Definition: fmi.h:1100
sint16 leap_seconds
Number of leap seconds as of the current time.
Definition: fmi.h:1077
uint32 message_id
ID of the canned message to delete.
Definition: fmi.h:1527
uint16 unique_id
Server-assigned unique ID for the waypoint.
Definition: fmi.h:1668
uint32 message_id
Unique identifier and sort key for this canned message.
Definition: fmi.h:1519
Data type for the Driver Status Log response Packet ID (0X1107) from server to client.
Definition: fmi.h:1805
uint8 id
Waypoint category (0-15)
Definition: fmi.h:1701
time_type eta_time
Estimated time of arrival, or 0xFFFFFFFF if no active destination.
Definition: fmi.h:1251
boolean result_code
Result (true if successful, false otherwise)
Definition: fmi.h:1536
uint32 unique_id
unique_id from the stop_status_data_type.
Definition: fmi.h:1212
boolean result_code
True if the update was successful.
Definition: fmi.h:1500
sint16 data
Protocol number.
Definition: fmi.h:1111
Data type for the Message Throttling Query Response Packet ID.
Definition: fmi.h:1598
Data type for the HOS Auto Status Update Receipt Packet ID (0X1301) from client to server...
Definition: fmi.h:2062
uint32 status_id
Unique identifier and sort key for the status item.
Definition: fmi.h:1453
uint8 id_size
Size of the message ID.
Definition: fmi.h:1345
Data type for the Driver Status Log Update Data Packet ID (0X1106) from client to server...
Definition: fmi.h:1798
char response_text[50]
Response text to display on client (variable length, null terminated string)
Definition: fmi.h:1356
uint32 file_size
Size of the file, in bytes.
Definition: fmi.h:1276
Data type for the Set Canned Message Receipt Packet ID and Delete Canned Message Receipt Packet ID...
Definition: fmi.h:1533
boolean result_code
TRUE if message was deleted, FALSE if message was not found.
Definition: fmi.h:1726
Data type for the Delete Canned Response Packet ID.
Definition: fmi.h:1361
time_type origination_time
Time the message was sent from the server.
Definition: fmi.h:1332
virtual void resendPacket(int aLineNumber)
Resend a packet to the client.
CString getFmiPacketName(uint16 aPacketId)
Translate an FMI packet ID into a string describing the packet name.
time_type server_start_time
Definition: fmi.h:1824
Data type for the FMI_ID_CREATE_WAYPOINT_CAT_RCPT packet.
Definition: fmi.h:1699
uint8 driver_idx
Driver index to change.
Definition: fmi.h:1421
Data type for the IFTA Data Fetch Request Packet ID (0X0006) from server to client.
Definition: fmi.h:2006
CString getHosartPacketName(uint16 aPacketId)
FmiLogParser()
Constructor.
uint32 status_change_id
status_change_id from the driver_id_data_type
Definition: fmi.h:1443
Data type for File Start Receipt Packet ID and File End Receipt Packet ID.
Definition: fmi.h:1286
float64 lon
longitude in radians, positive is east
Definition: garmin_types.h:138
boolean result_code
True if the operation was successful.
Definition: fmi.h:1372
Data type for Configure Sensor Request Packet ID (0x1402) from server to client.
Definition: fmi.h:2155
uint32 driver_id
Definition: fmi.h:2089
Data type for Custom Forms Packet ID (0X1207) from client to server.
Definition: fmi.h:2238
uint8 id[16]
The message ID.
Definition: fmi.h:1718
FMI_cf_rcode
uint32 new_position
Definition: fmi.h:1926
Data type for Custom Avoidance Feature Enable Packet ID (0X1236, 0X1235)
Definition: fmi.h:1960
sc_position_type point1
Definition: fmi.h:1970
uint8 file_type
File type.
Definition: fmi.h:1299
void UTIL_convert_UTC_to_local(const time_type *aUtcTime, time_type *aLocalTime)
Converts a time_type from UTC to local time.
Definition: util.cpp:526
uint32 response_id
The canned response ID from the set or delete.
Definition: fmi.h:1371
Payload of FMI_ID_AUTO_ARRIVAL packet.
Definition: fmi.h:1240
uint8 result_code
Definition: fmi.h:2126
time_type origination_time
Time when the client sent the message.
Definition: fmi.h:1127
unsigned long int uint32
32-bit unsigned integer
Definition: garmin_types.h:66
char text_message[200]
Message text (variable length, null-terminated string)
Definition: fmi.h:1184
Data type for the Driver Status Update packet.
Definition: fmi.h:1477
float32 epe
Estimated position error, 2 sigma, in meters.
Definition: fmi.h:1067
sint32 lon
longitude in semicircles
Definition: garmin_types.h:127
uint8 result_code
Result of operation.
Definition: fmi.h:1298
uint8 id[16]
message ID
Definition: fmi.h:1150
Data type for the FMI_ID_DELETE_WAYPOINT_CAT_RCPT packet.
Definition: fmi.h:1706
uint32 time_type
Absolute time (number of seconds since 12/31/1989 12:00 am UTC)
Definition: garmin_types.h:97
Data type for the Driver Login Data Packet ID (0X1102) from server to client.
Definition: fmi.h:1752
uint8 id_size
Number of significant bytes in the message ID.
Definition: fmi.h:1333
Data type for the Canned Response List Packet ID.
Definition: fmi.h:1378
uint32 response_count
Number of responses in the array; if 0, all responses need refresh.
Definition: fmi.h:1391
float32 epv
Estimated vertical position error, 2 sigma, in meters.
Definition: fmi.h:1069
uint8 id[16]
Message ID.
Definition: fmi.h:1591
uint32 response_id
The canned response ID to delete.
Definition: fmi.h:1363
uint8 feature_count
Number of feature IDs in features[].
Definition: fmi.h:1117
Data type for Alert Popup Request Packet ID (0x1400) from server to client.
Definition: fmi.h:2135
Data type for Canned Response List Packet ID.
Definition: fmi.h:1397
float32 eph
Estimated horizontal position error, 2 sigma, in meters.
Definition: fmi.h:1068
uint8 request_type
Definition: fmi.h:2118
Data type for the Data Deletion Packet ID.
Definition: fmi.h:1265
#define ID_ACK_BYTE
Definition: garmin_types.h:40
#define ID_DLE_BYTE
Definition: garmin_types.h:41
__packed struct fmi_dashcam_settings_list settings_list[30]
Definition: fmi.h:2278
uint8 driver_idx
Index of driver to change.
Definition: fmi.h:1491
#define MAX_PAYLOAD_SIZE
Maximum payload size, before DLE stuffing.
Definition: garmin_types.h:21
Payload of FMI_ID_STOP_STATUS_RCPT packet.
Definition: fmi.h:1210
Data type for Set Dashcam Notification Settings Packet ID (0X1606) from server to client...
Definition: fmi.h:2300
uint8 driver_idx
Driver index requested.
Definition: fmi.h:1510
float speed_limit
Speed limit at the time of alert.
Definition: fmi.h:1632
uint16 type_of_gps_fix
Enum for type of GPS fix, see gps_fix_type.
Definition: fmi.h:1070
float32 north_velocity
North velocity in m/s, negative is south.
Definition: fmi.h:1074
uint8 file_data[245]
file data, variable length
Definition: fmi.h:1310
sint16 hour
hour (0-65535), range required for correct ETE conversion
Definition: garmin_types.h:160
static GarminTransportLayer * getInstance()
Get the one and only GarminTransportLayer.
uint32 week_number_days
Days from UTC December 31st, 1989 to beginning of current week.
Definition: fmi.h:1078
CString formatHosartPacket(BOOL transmitted, uint16 aPacketId, uint8 *aPayload, uint8 aPayloadSize)
Interpret an HOSART packet; appending the information to the text in the packet window.
Data type for the Set Canned Response Receipt Packet ID and Delete Canned Response Receipt Packet ID...
Definition: fmi.h:1369
float64 time_of_week
Seconds since Sunday 12:00 AM (excludes leap seconds)
Definition: fmi.h:1071
char text_message[200]
Text message (variable length, null-terminated string, 200 bytes max)
Definition: fmi.h:1140
Data type for Dashcam Settings Packet ID (0X1601, 0X1603, 0x1607) from client to server.
Definition: fmi.h:2257
uint32 driver_status
ID corresponding to the new driver status.
Definition: fmi.h:1481
uint32 unique_id
Unique ID generated by client.
Definition: fmi.h:1180
uint32 stop_distance
Minimum distance to destination before auto-arrival is activated, in meters.
Definition: fmi.h:1243
uint8 id
Waypoint category.
Definition: fmi.h:1693
Data type for File Start Receipt Packet ID and File End Receipt Packet ID when sent from Server...
Definition: fmi.h:1296
uint16 cat
Waypoint categories, bit-mapped.
Definition: fmi.h:1671
uint32 distance
Definition: fmi.h:1945
float threshold
Speed over speed limit when speeding event begins.
Definition: fmi.h:1644
uint8 mode
Mode, a valid speed_limit_alert_mode_type.
Definition: fmi.h:1640
Data type for the Speed Limit Alerts setup Packet ID.
Definition: fmi.h:1638