sbgEComBinaryLogStatus.c
Go to the documentation of this file.
2 
3 //----------------------------------------------------------------------//
4 //- Operations -//
5 //----------------------------------------------------------------------//
6 
14 {
15  assert(pInputStream);
16  assert(pOutputData);
17 
18  //
19  // Read the frame payload
20  //
21  pOutputData->timeStamp = sbgStreamBufferReadUint32LE(pInputStream);
22  pOutputData->generalStatus = sbgStreamBufferReadUint16LE(pInputStream);
23  pOutputData->reserved1 = sbgStreamBufferReadUint16LE(pInputStream);
24  pOutputData->comStatus = sbgStreamBufferReadUint32LE(pInputStream);
25  pOutputData->aidingStatus = sbgStreamBufferReadUint32LE(pInputStream);
26  pOutputData->reserved2 = sbgStreamBufferReadUint32LE(pInputStream);
27  pOutputData->reserved3 = sbgStreamBufferReadUint16LE(pInputStream);
28 
29  //
30  // Test if we have a additional information such as uptime (since version 1.7)
31  //
32  if (sbgStreamBufferGetSpace(pInputStream) >= sizeof(uint32_t))
33  {
34  //
35  // Read the additional information
36  //
37  pOutputData->uptime = sbgStreamBufferReadUint32LE(pInputStream);
38  }
39  else
40  {
41  //
42  // Default the additional information
43  //
44  pOutputData->uptime = 0;
45  }
46 
47  //
48  // Return if any error has occurred while parsing the frame
49  //
50  return sbgStreamBufferGetLastError(pInputStream);
51 }
52 
60 {
61  assert(pOutputStream);
62  assert(pInputData);
63 
64  //
65  // Write the frame payload
66  //
67  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timeStamp);
68  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->generalStatus);
69  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved1);
70  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->comStatus);
71  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->aidingStatus);
72  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->reserved2);
73  sbgStreamBufferWriteUint16LE(pOutputStream, pInputData->reserved3);
74 
75  //
76  // Write the additional information added in version 1.7
77  //
78  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->uptime);
79 
80  //
81  // Return if any error has occurred while writing the frame
82  //
83  return sbgStreamBufferGetLastError(pOutputStream);
84 }
SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData)
This file is used to parse received device status binary logs.
SBG_INLINE uint16_t sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle)
SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData)
SBG_INLINE size_t sbgStreamBufferGetSpace(SbgStreamBuffer *pHandle)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value)
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 Thu Oct 22 2020 03:47:22