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  //
22  // Check input parameters
23  //
24  SBG_ASSERT(pPayload);
25  SBG_ASSERT(payloadSize > 0);
26  SBG_ASSERT(pOutputData);
27 
28  //
29  // Handle the different classes of messages differently
30  //
31  if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_0)
32  {
33  //
34  // Create an input stream buffer that points to the frame payload so we can easily parse it's content
35  //
36  sbgStreamBufferInitForRead(&inputStream, pPayload, payloadSize);
37 
38  //
39  // Parse the incoming log according to its type
40  //
41  switch (msg)
42  {
44  //
45  // Parse this binary log
46  //
47  errorCode = sbgEComBinaryLogParseStatusData(&inputStream, &pOutputData->statusData);
48  break;
50  //
51  // Parse this binary log
52  //
53  errorCode = sbgEComBinaryLogParseImuData(&inputStream, &pOutputData->imuData);
54  break;
56  //
57  // Parse this binary log
58  //
59  errorCode = sbgEComBinaryLogParseEkfEulerData(&inputStream, &pOutputData->ekfEulerData);
60  break;
62  //
63  // Parse this binary log
64  //
65  errorCode = sbgEComBinaryLogParseEkfQuatData(&inputStream, &pOutputData->ekfQuatData);
66  break;
68  //
69  // Parse this binary log
70  //
71  errorCode = sbgEComBinaryLogParseEkfNavData(&inputStream, &pOutputData->ekfNavData);
72  break;
75  //
76  // Parse this binary log
77  //
78  errorCode = sbgEComBinaryLogParseShipMotionData(&inputStream, &pOutputData->shipMotionData);
79  break;
81  //
82  // Parse this binary log
83  //
84  errorCode = sbgEComBinaryLogParseOdometerData(&inputStream, &pOutputData->odometerData);
85  break;
87  //
88  // Parse this binary log
89  //
90  errorCode = sbgEComBinaryLogParseUtcData(&inputStream, &pOutputData->utcData);
91  break;
94  //
95  // Parse this binary log
96  //
97  errorCode = sbgEComBinaryLogParseGpsVelData(&inputStream, &pOutputData->gpsVelData);
98  break;
101  //
102  // Parse this binary log
103  //
104  errorCode = sbgEComBinaryLogParseGpsPosData(&inputStream, &pOutputData->gpsPosData);
105  break;
108  //
109  // Parse this binary log
110  //
111  errorCode = sbgEComBinaryLogParseGpsHdtData(&inputStream, &pOutputData->gpsHdtData);
112  break;
115  //
116  // Parse this binary log
117  //
118  errorCode = sbgEComBinaryLogParseGpsRawData(&inputStream, &pOutputData->gpsRawData);
119  break;
120  case SBG_ECOM_LOG_MAG:
121  //
122  // Parse this binary log
123  //
124  errorCode = sbgEComBinaryLogParseMagData(&inputStream, &pOutputData->magData);
125  break;
127  //
128  // Parse this binary log
129  //
130  errorCode = sbgEComBinaryLogParseMagCalibData(&inputStream, &pOutputData->magCalibData);
131  break;
133  //
134  // Parse this binary log
135  //
136  errorCode = sbgEComBinaryLogParseDvlData(&inputStream, &pOutputData->dvlData);
137  break;
139  //
140  // Parse this binary log
141  //
142  errorCode = sbgEComBinaryLogParseDvlData(&inputStream, &pOutputData->dvlData);
143  break;
145  //
146  // Parse this binary log
147  //
148  errorCode = sbgEComBinaryLogParsePressureData(&inputStream, &pOutputData->pressureData);
149  break;
150  case SBG_ECOM_LOG_USBL:
151  //
152  // Parse this binary log
153  //
154  errorCode = sbgEComBinaryLogParseUsblData(&inputStream, &pOutputData->usblData);
155  break;
161  //
162  // Parse all events markers logs
163  //
164  errorCode = sbgEComBinaryLogParseEvent(&inputStream, &pOutputData->eventMarker);
165  break;
167  //
168  // Parse this binary log
169  //
170  errorCode = sbgEComBinaryLogParseDebug0Data(&inputStream, &pOutputData->debug0Data);
171  break;
172  default:
173  //
174  // This log isn't handled
175  //
176  errorCode = SBG_ERROR;
177  }
178  }
179  else if (msgClass == SBG_ECOM_CLASS_LOG_ECOM_1)
180  {
181  //
182  // Create an input stream buffer that points to the frame payload so we can easily parse it's content
183  //
184  sbgStreamBufferInitForRead(&inputStream, pPayload, payloadSize);
185 
186  //
187  // Parse the message depending on the message ID
188  //
189  switch ((SbgEComLog1)msg)
190  {
192  //
193  // Parse this binary log
194  //
195  errorCode = sbgEComBinaryLogParseFastImuData(&inputStream, &pOutputData->fastImuData);
196  break;
197  default:
198  //
199  // This log isn't handled
200  //
201  errorCode = SBG_ERROR;
202  }
203  }
204  else
205  {
206  //
207  // Unhandled message class
208  //
209  errorCode = SBG_ERROR;
210  }
211 
212  return errorCode;
213 }
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)
SbgErrorCode sbgEComBinaryLogParseDebug0Data(SbgStreamBuffer *pInputStream, SbgLogDebug0Data *pOutputData)
SbgLogImuData imuData
SbgLogEvent eventMarker
SbgErrorCode sbgEComBinaryLogParseUsblData(SbgStreamBuffer *pInputStream, SbgLogUsblData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseMagCalibData(SbgStreamBuffer *pInputStream, SbgLogMagCalib *pOutputData)
SbgErrorCode sbgEComBinaryLogParsePressureData(SbgStreamBuffer *pInputStream, SbgLogPressureData *pOutputData)
Used to read/write data from/to a memory buffer stream.
SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogGpsRaw *pOutputData)
SbgErrorCode sbgEComBinaryLogParseUtcData(SbgStreamBuffer *pInputStream, SbgLogUtcData *pOutputData)
SbgLogUsblData usblData
SbgLogGpsVel gpsVelData
SbgLogOdometerData odometerData
SbgErrorCode sbgEComBinaryLogParseShipMotionData(SbgStreamBuffer *pInputStream, SbgLogShipMotionData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData)
SbgErrorCode sbgEComBinaryLogParseEkfEulerData(SbgStreamBuffer *pInputStream, SbgLogEkfEulerData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseFastImuData(SbgStreamBuffer *pInputStream, SbgLogFastImuData *pOutputData)
SbgLogGpsPos gpsPosData
SbgErrorCode sbgEComBinaryLogParseMagData(SbgStreamBuffer *pInputStream, SbgLogMag *pOutputData)
uint8 SbgEComMsgId
Definition: sbgEComIds.h:278
SbgLogMagCalib magCalibData
SbgLogDebug0Data debug0Data
SbgLogPressureData pressureData
SbgErrorCode sbgEComBinaryLogParseEkfQuatData(SbgStreamBuffer *pInputStream, SbgLogEkfQuatData *pOutputData)
SbgErrorCode sbgEComBinaryLogParseOdometerData(SbgStreamBuffer *pInputStream, SbgLogOdometerData *pOutputData)
SbgLogFastImuData fastImuData
#define SBG_ASSERT(expression)
Definition: sbgDebug.h:52
SbgErrorCode sbgEComBinaryLogParseImuData(SbgStreamBuffer *pInputStream, SbgLogImuData *pOutputData)
enum _SbgEComClass SbgEComClass
SbgLogDvlData dvlData
SbgLogShipMotionData shipMotionData
This file is used to parse received binary logs.
enum _SbgEComLog1MsgId SbgEComLog1
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 sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData)
SbgLogGpsRaw gpsRawData


sbg_driver
Author(s):
autogenerated on Sun Jan 27 2019 03:42:20