sbgEComBinaryLogStatus.c
Go to the documentation of this file.
2 
3 //----------------------------------------------------------------------//
4 //- Operations -//
5 //----------------------------------------------------------------------//
6 
14 {
15  //
16  // Check input arguments
17  //
18  SBG_ASSERT(pInputStream);
19  SBG_ASSERT(pOutputData);
20 
21  //
22  // Read the frame payload
23  //
24  pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream);
25  pOutputData->generalStatus = sbgStreamBufferReadUint16LE(pInputStream);
26  pOutputData->reserved1 = sbgStreamBufferReadUint16LE(pInputStream);
27  pOutputData->comStatus = sbgStreamBufferReadUint32LE(pInputStream);
28  pOutputData->aidingStatus = sbgStreamBufferReadUint32LE(pInputStream);
29  pOutputData->reserved2 = sbgStreamBufferReadUint32LE(pInputStream);
30  pOutputData->reserved3 = sbgStreamBufferReadUint16LE(pInputStream);
31 
32  //
33  // Test if we have a additional information such as uptime (since version 1.7)
34  //
35  if (sbgStreamBufferGetSpace(pInputStream) >= sizeof(uint32))
36  {
37  //
38  // Read the additional information
39  //
40  pOutputData->uptime = sbgStreamBufferReadUint32LE(pInputStream);
41  }
42  else
43  {
44  //
45  // Default the additional information
46  //
47  pOutputData->uptime = 0;
48  }
49 
50  //
51  // Return if any error has occurred while parsing the frame
52  //
53  return sbgStreamBufferGetLastError(pInputStream);
54 }
55 
63 {
64  //
65  // Check input arguments
66  //
67  SBG_ASSERT(pOutputStream);
68  SBG_ASSERT(pInputData);
69 
70  //
71  // Write the frame payload
72  //
73  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp);
74  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->generalStatus);
75  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved1);
76  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->comStatus);
77  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->aidingStatus);
78  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->reserved2);
79  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved3);
80 
81  //
82  // Write the additional information added in version 1.7
83  //
84  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->uptime);
85 
86  //
87  // Return if any error has occurred while writing the frame
88  //
89  return sbgStreamBufferGetLastError(pOutputStream);
90 }
SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData)
unsigned int uint32
Definition: sbgTypes.h:58
This file is used to parse received device status binary logs.
SBG_INLINE uint16 sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle)
SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData)
SBG_INLINE size_t sbgStreamBufferGetSpace(SbgStreamBuffer *pHandle)
SBG_INLINE uint32 sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16LE(SbgStreamBuffer *pHandle, uint16 value)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32 value)
#define SBG_ASSERT(expression)
Definition: sbgDebug.h:52
enum _SbgErrorCode SbgErrorCode
SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(SbgStreamBuffer *pHandle)


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