sbgEComBinaryLogs.c
Go to the documentation of this file.
1 #include "sbgEComBinaryLogs.h"
3 
4 //----------------------------------------------------------------------//
5 //- Communication protocol operations -//
6 //----------------------------------------------------------------------//
7 
16 SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData)
17 {
18  SbgErrorCode errorCode = SBG_NO_ERROR;
19  SbgStreamBuffer inputStream;
20 
21  assert(pPayload);
22  assert(payloadSize > 0);
23  assert(pOutputData);
24 
25  //
26  // Handle the different classes of messages differently
27  //
28  if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_0)
29  {
30  //
31  // Create an input stream buffer that points to the frame payload so we can easily parse it's content
32  //
33  sbgStreamBufferInitForRead(&inputStream, pPayload, payloadSize);
34 
35  //
36  // Parse the incoming log according to its type
37  //
38  switch (msg)
39  {
41  errorCode = sbgEComBinaryLogParseStatusData(&inputStream, &pOutputData->statusData);
42  break;
44  errorCode = sbgEComBinaryLogParseImuData(&inputStream, &pOutputData->imuData);
45  break;
47  errorCode = sbgEComBinaryLogParseImuShort(&inputStream, &pOutputData->imuShort);
48  break;
50  errorCode = sbgEComBinaryLogParseEkfEulerData(&inputStream, &pOutputData->ekfEulerData);
51  break;
53  errorCode = sbgEComBinaryLogParseEkfQuatData(&inputStream, &pOutputData->ekfQuatData);
54  break;
56  errorCode = sbgEComBinaryLogParseEkfNavData(&inputStream, &pOutputData->ekfNavData);
57  break;
60  errorCode = sbgEComBinaryLogParseShipMotionData(&inputStream, &pOutputData->shipMotionData);
61  break;
63  errorCode = sbgEComBinaryLogParseOdometerData(&inputStream, &pOutputData->odometerData);
64  break;
66  errorCode = sbgEComBinaryLogParseUtcData(&inputStream, &pOutputData->utcData);
67  break;
70  errorCode = sbgEComBinaryLogParseGpsVelData(&inputStream, &pOutputData->gpsVelData);
71  break;
74  errorCode = sbgEComBinaryLogParseGpsPosData(&inputStream, &pOutputData->gpsPosData);
75  break;
78  errorCode = sbgEComBinaryLogParseGpsHdtData(&inputStream, &pOutputData->gpsHdtData);
79  break;
82  errorCode = sbgEComBinaryLogParseGpsRawData(&inputStream, &pOutputData->gpsRawData);
83  break;
84  case SBG_ECOM_LOG_MAG:
85  errorCode = sbgEComBinaryLogParseMagData(&inputStream, &pOutputData->magData);
86  break;
88  errorCode = sbgEComBinaryLogParseMagCalibData(&inputStream, &pOutputData->magCalibData);
89  break;
91  errorCode = sbgEComBinaryLogParseDvlData(&inputStream, &pOutputData->dvlData);
92  break;
94  errorCode = sbgEComBinaryLogParseDvlData(&inputStream, &pOutputData->dvlData);
95  break;
97  errorCode = sbgEComBinaryLogParseAirData(&inputStream, &pOutputData->airData);
98  break;
99  case SBG_ECOM_LOG_USBL:
100  errorCode = sbgEComBinaryLogParseUsblData(&inputStream, &pOutputData->usblData);
101  break;
102  case SBG_ECOM_LOG_DEPTH:
103  errorCode = sbgEComBinaryLogParseDepth(&inputStream, &pOutputData->depthData);
104  break;
112  errorCode = sbgEComBinaryLogParseEvent(&inputStream, &pOutputData->eventMarker);
113  break;
118  errorCode = sbgEComBinaryLogParseDebugData(&inputStream, &pOutputData->debugData);
119  break;
121  errorCode = sbgEComBinaryLogParseImuRawData(&inputStream, &pOutputData->imuRawData);
122  break;
123  case SBG_ECOM_LOG_DIAG:
124  errorCode = sbgEComBinaryLogParseDiagData(&inputStream, &pOutputData->diagData);
125  break;
126  default:
127  //
128  // This log isn't handled
129  //
130  errorCode = SBG_ERROR;
131  }
132  }
133  else if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_1)
134  {
135  //
136  // Create an input stream buffer that points to the frame payload so we can easily parse it's content
137  //
138  sbgStreamBufferInitForRead(&inputStream, pPayload, payloadSize);
139 
140  //
141  // Parse the message depending on the message ID
142  //
143  switch ((SbgEComLog1)msg)
144  {
146  //
147  // Parse this binary log
148  //
149  errorCode = sbgEComBinaryLogParseFastImuData(&inputStream, &pOutputData->fastImuData);
150  break;
151  default:
152  //
153  // This log isn't handled
154  //
155  errorCode = SBG_ERROR;
156  }
157  }
158  else
159  {
160  //
161  // Un-handled message class
162  //
163  errorCode = SBG_ERROR;
164  }
165 
166  return errorCode;
167 }
SBG_INLINE SbgErrorCode sbgStreamBufferInitForRead(SbgStreamBuffer *pHandle, const void *pLinkedBuffer, size_t bufferSize)
SbgLogEkfNavData ekfNavData
SbgLogEkfEulerData ekfEulerData
SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData)
SbgLogEkfQuatData ekfQuatData
SbgErrorCode sbgEComBinaryLogParseEkfNavData(SbgStreamBuffer *pInputStream, SbgLogEkfNavData *pOutputData)
SbgLogDebugData debugData
SbgLogImuData imuData
SbgLogEvent eventMarker
SbgErrorCode sbgEComBinaryLogParseUsblData(SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseMagCalibData(SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData)
Used to read/write data from/to a memory buffer stream.
SbgErrorCode sbgEComBinaryLogParseImuShort(SbgStreamBuffer *pInputStream, SbgLogImuShort *pOutputData)
SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogGpsRaw *pOutputData)
SbgErrorCode sbgEComBinaryLogParseUtcData(SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData)
SbgLogUsblData usblData
SbgLogGpsVel gpsVelData
SbgLogOdometerData odometerData
SbgErrorCode sbgEComBinaryLogParseImuRawData(SbgStreamBuffer *pInputStream, SbgLogImuRawData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseShipMotionData(SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData)
SbgErrorCode sbgEComBinaryLogParseEkfEulerData(SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseFastImuData(SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseDebugData(SbgStreamBuffer *pInputStream, SbgLogDebugData *pOutputData)
SbgLogGpsPos gpsPosData
SbgErrorCode sbgEComBinaryLogParseMagData(SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData)
SbgLogMagCalib magCalibData
SbgLogImuShort imuShort
uint8_t SbgEComMsgId
Definition: sbgEComIds.h:289
SbgErrorCode sbgEComBinaryLogParseEkfQuatData(SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseOdometerData(SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData)
SbgLogFastImuData fastImuData
SbgLogDiagData diagData
SbgErrorCode sbgEComBinaryLogParseImuData(SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData)
enum _SbgEComClass SbgEComClass
SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData)
SbgLogDvlData dvlData
SbgLogShipMotionData shipMotionData
This file is used to parse received binary logs.
enum _SbgEComLog1MsgId SbgEComLog1
SbgErrorCode sbgEComBinaryLogParseDiagData(SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData)
SbgLogImuRawData imuRawData
SbgLogAirData airData
SbgLogStatusData statusData
SbgLogUtcData utcData
SbgErrorCode sbgEComBinaryLogParseEvent(SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData)
SbgLogGpsHdt gpsHdtData
enum _SbgErrorCode SbgErrorCode
SbgErrorCode sbgEComBinaryLogParseDvlData(SbgStreamBuffer *pInputStream, SbgLogDvlData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData)
SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData)
SbgErrorCode sbgEComBinaryLogParseDepth(SbgStreamBuffer *pInputStream, SbgLogDepth *pOutputData)
SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData)
SbgLogGpsRaw gpsRawData


sbg_driver
Author(s): SBG Systems
autogenerated on Thu Oct 22 2020 03:47:22