sbgEComBinaryLogAirData.c
Go to the documentation of this file.
2 
3 //----------------------------------------------------------------------//
4 //- Operations -//
5 //----------------------------------------------------------------------//
6 
8 {
9  assert(pInputStream);
10  assert(pOutputData);
11 
12  //
13  // Read the frame payload
14  //
15  pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream);
16  pOutputData->status = sbgStreamBufferReadUint16LE(pInputStream);
17 
18  pOutputData->pressureAbs = sbgStreamBufferReadFloatLE(pInputStream);
19  pOutputData->altitude = sbgStreamBufferReadFloatLE(pInputStream);
20 
21  //
22  // The true airspeed fields have been added in version 2.0
23  //
24  if (sbgStreamBufferGetSpace(pInputStream) > 0)
25  {
26  pOutputData->pressureDiff = sbgStreamBufferReadFloatLE(pInputStream);
27  pOutputData->trueAirspeed = sbgStreamBufferReadFloatLE(pInputStream);
28  pOutputData->airTemperature = sbgStreamBufferReadFloatLE(pInputStream);
29  }
30  else
31  {
32  pOutputData->pressureDiff = 0.0f;
33  pOutputData->trueAirspeed = 0.0f;
34  pOutputData->airTemperature = 0.0f;
35  }
36 
37  //
38  // Return if any error has occurred while parsing the frame
39  //
40  return sbgStreamBufferGetLastError(pInputStream);
41 }
42 
44 {
45  assert(pOutputStream);
46  assert(pInputData);
47 
48  //
49  // Write the frame payload
50  //
51  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp);
52  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->status);
53 
54  sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pressureAbs);
55  sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->altitude);
56 
57  sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->pressureDiff);
58  sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->trueAirspeed);
59 
60  sbgStreamBufferWriteFloatLE(pOutputStream, pInputData->airTemperature);
61 
62  //
63  // Return if any error has occurred while writing the frame
64  //
65  return sbgStreamBufferGetLastError(pOutputStream);
66 }
SBG_INLINE float sbgStreamBufferReadFloatLE(SbgStreamBuffer *pHandle)
This file is used to parse & received Air Data logs.
SBG_INLINE uint16_t sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle)
SBG_INLINE size_t sbgStreamBufferGetSpace(SbgStreamBuffer *pHandle)
SbgErrorCode sbgEComBinaryLogWriteAirData(SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteFloatLE(SbgStreamBuffer *pHandle, float value)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value)
SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData)
SBG_INLINE uint32_t sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16LE(SbgStreamBuffer *pHandle, uint16_t value)
enum _SbgErrorCode SbgErrorCode
SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(SbgStreamBuffer *pHandle)


sbg_driver
Author(s): SBG Systems
autogenerated on Sat Sep 3 2022 02:53:35