sbgEComBinaryLogDiag.c
Go to the documentation of this file.
1 // sbgCommonLib headers
2 #include <sbgCommon.h>
4 
5 // Local headers
6 #include "sbgEComBinaryLogDiag.h"
7 
8 //----------------------------------------------------------------------//
9 //- Public functions -//
10 //----------------------------------------------------------------------//
11 
13 {
14  assert(pInputStream);
15  assert(pOutputData);
16 
17  pOutputData->timestamp = sbgStreamBufferReadUint32LE(pInputStream);
18  pOutputData->type = (SbgDebugLogType)sbgStreamBufferReadUint8(pInputStream);
19  pOutputData->errorCode = (SbgErrorCode)sbgStreamBufferReadUint8(pInputStream);
20 
21  sbgStreamBufferReadBuffer(pInputStream, pOutputData->string, sbgStreamBufferGetSpace(pInputStream));
22  pOutputData->string[sizeof(pOutputData->string) - 1] = '\0';
23 
24  return sbgStreamBufferGetLastError(pInputStream);
25 }
26 
28 {
29  size_t length;
30 
31  assert(pOutputStream);
32  assert(pInputData);
33 
34  sbgStreamBufferWriteUint32LE(pOutputStream, pInputData->timestamp);
35  sbgStreamBufferWriteUint8(pOutputStream, pInputData->type);
36  sbgStreamBufferWriteUint8(pOutputStream, pInputData->errorCode);
37 
38  length = strlen(pInputData->string);
39 
40  if (length >= sizeof(pInputData->string))
41  {
42  length = sizeof(pInputData->string) - 1;
43  }
44 
45  sbgStreamBufferWriteBuffer(pOutputStream, pInputData->string, length);
46  sbgStreamBufferWriteUint8(pOutputStream, 0);
47 
48  return sbgStreamBufferGetLastError(pOutputStream);
49 }
SbgErrorCode errorCode
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint8(SbgStreamBuffer *pHandle, uint8_t value)
SBG_INLINE uint8_t sbgStreamBufferReadUint8(SbgStreamBuffer *pHandle)
char string[SBG_ECOM_LOG_DIAG_MAX_STRING_SIZE]
Used to read/write data from/to a memory buffer stream.
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
SBG_INLINE SbgErrorCode sbgStreamBufferReadBuffer(SbgStreamBuffer *pHandle, void *pBuffer, size_t numBytesToRead)
SBG_INLINE size_t sbgStreamBufferGetSpace(SbgStreamBuffer *pHandle)
SBG_INLINE SbgErrorCode sbgStreamBufferWriteBuffer(SbgStreamBuffer *pHandle, const void *pBuffer, size_t numBytesToWrite)
SbgDebugLogType type
Main header file for SBG Systems common C library.
enum _SbgDebugLogType SbgDebugLogType
Diagnostic log handling.
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value)
SbgErrorCode sbgEComBinaryLogWriteDiagData(SbgStreamBuffer *pOutputStream, const SbgLogDiagData *pInputData)
SBG_INLINE uint32_t sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle)
SbgErrorCode sbgEComBinaryLogParseDiagData(SbgStreamBuffer *pInputStream, SbgLogDiagData *pOutputData)
enum _SbgErrorCode SbgErrorCode
SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(SbgStreamBuffer *pHandle)


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