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 }
sbgStreamBufferWriteFloatLE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteFloatLE(SbgStreamBuffer *pHandle, float value)
Definition: sbgStreamBufferLE.h:1753
sbgEComBinaryLogParseAirData
SbgErrorCode sbgEComBinaryLogParseAirData(SbgStreamBuffer *pInputStream, SbgLogAirData *pOutputData)
Definition: sbgEComBinaryLogAirData.c:7
sbgStreamBufferGetLastError
SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(SbgStreamBuffer *pHandle)
Definition: sbgStreamBufferCommon.h:274
_SbgLogAirData::altitude
float altitude
Definition: sbgEComBinaryLogAirData.h:55
_SbgLogAirData::trueAirspeed
float trueAirspeed
Definition: sbgEComBinaryLogAirData.h:57
sbgStreamBufferReadUint16LE
SBG_INLINE uint16_t sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle)
Definition: sbgStreamBufferLE.h:106
_SbgLogAirData
Definition: sbgEComBinaryLogAirData.h:50
sbgEComBinaryLogAirData.h
This file is used to parse & received Air Data logs.
sbgStreamBufferWriteUint16LE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16LE(SbgStreamBuffer *pHandle, uint16_t value)
Definition: sbgStreamBufferLE.h:1250
_SbgLogAirData::pressureAbs
float pressureAbs
Definition: sbgEComBinaryLogAirData.h:54
sbgStreamBufferGetSpace
SBG_INLINE size_t sbgStreamBufferGetSpace(SbgStreamBuffer *pHandle)
Definition: sbgStreamBufferCommon.h:353
sbgStreamBufferReadUint32LE
SBG_INLINE uint32_t sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle)
Definition: sbgStreamBufferLE.h:386
_SbgLogAirData::timeStamp
uint32_t timeStamp
Definition: sbgEComBinaryLogAirData.h:52
_SbgStreamBuffer
Definition: sbgStreamBufferCommon.h:188
_SbgLogAirData::pressureDiff
float pressureDiff
Definition: sbgEComBinaryLogAirData.h:56
SbgErrorCode
enum _SbgErrorCode SbgErrorCode
Header file that defines all error codes for SBG Systems libraries.
_SbgLogAirData::airTemperature
float airTemperature
Definition: sbgEComBinaryLogAirData.h:58
sbgStreamBufferReadFloatLE
SBG_INLINE float sbgStreamBufferReadFloatLE(SbgStreamBuffer *pHandle)
Definition: sbgStreamBufferLE.h:1086
_SbgLogAirData::status
uint16_t status
Definition: sbgEComBinaryLogAirData.h:53
sbgStreamBufferWriteUint32LE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value)
Definition: sbgStreamBufferLE.h:1499
sbgEComBinaryLogWriteAirData
SbgErrorCode sbgEComBinaryLogWriteAirData(SbgStreamBuffer *pOutputStream, const SbgLogAirData *pInputData)
Definition: sbgEComBinaryLogAirData.c:43


sbg_driver
Author(s): SBG Systems
autogenerated on Fri Oct 11 2024 02:13:40