external
sbgECom
src
binaryLogs
sbgEComBinaryLogEvent.c
Go to the documentation of this file.
1
#include "
sbgEComBinaryLogEvent.h
"
2
3
//----------------------------------------------------------------------//
4
//- Operations -//
5
//----------------------------------------------------------------------//
6
13
SbgErrorCode
sbgEComBinaryLogParseEvent
(
SbgStreamBuffer
*pInputStream,
SbgLogEvent
*pOutputData)
14
{
15
assert(pInputStream);
16
assert(pOutputData);
17
18
//
19
// Read the frame payload
20
//
21
pOutputData->
timeStamp
=
sbgStreamBufferReadUint32LE
(pInputStream);
22
pOutputData->
status
=
sbgStreamBufferReadUint16LE
(pInputStream);
23
pOutputData->
timeOffset0
=
sbgStreamBufferReadUint16LE
(pInputStream);
24
pOutputData->
timeOffset1
=
sbgStreamBufferReadUint16LE
(pInputStream);
25
pOutputData->
timeOffset2
=
sbgStreamBufferReadUint16LE
(pInputStream);
26
pOutputData->
timeOffset3
=
sbgStreamBufferReadUint16LE
(pInputStream);
27
28
//
29
// Return if any error has occurred while parsing the frame
30
//
31
return
sbgStreamBufferGetLastError
(pInputStream);
32
}
33
40
SbgErrorCode
sbgEComBinaryLogWriteEvent
(
SbgStreamBuffer
*pOutputStream,
const
SbgLogEvent
*pInputData)
41
{
42
assert(pOutputStream);
43
assert(pInputData);
44
45
//
46
// Write the frame payload
47
//
48
sbgStreamBufferWriteUint32LE
(pOutputStream, pInputData->
timeStamp
);
49
sbgStreamBufferWriteUint16LE
(pOutputStream, pInputData->
status
);
50
sbgStreamBufferWriteUint16LE
(pOutputStream, pInputData->
timeOffset0
);
51
sbgStreamBufferWriteUint16LE
(pOutputStream, pInputData->
timeOffset1
);
52
sbgStreamBufferWriteUint16LE
(pOutputStream, pInputData->
timeOffset2
);
53
sbgStreamBufferWriteUint16LE
(pOutputStream, pInputData->
timeOffset3
);
54
55
//
56
// Return if any error has occurred while writing the frame
57
//
58
return
sbgStreamBufferGetLastError
(pOutputStream);
59
}
sbgStreamBufferGetLastError
SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferCommon.h:274
_SbgLogEvent::timeOffset0
uint16_t timeOffset0
Definition:
sbgEComBinaryLogEvent.h:50
_SbgLogEvent::timeOffset1
uint16_t timeOffset1
Definition:
sbgEComBinaryLogEvent.h:51
sbgEComBinaryLogParseEvent
SbgErrorCode sbgEComBinaryLogParseEvent(SbgStreamBuffer *pInputStream, SbgLogEvent *pOutputData)
Definition:
sbgEComBinaryLogEvent.c:13
sbgStreamBufferReadUint16LE
SBG_INLINE uint16_t sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferLE.h:106
_SbgLogEvent::timeStamp
uint32_t timeStamp
Definition:
sbgEComBinaryLogEvent.h:48
_SbgLogEvent
Definition:
sbgEComBinaryLogEvent.h:46
_SbgLogEvent::timeOffset3
uint16_t timeOffset3
Definition:
sbgEComBinaryLogEvent.h:53
_SbgLogEvent::timeOffset2
uint16_t timeOffset2
Definition:
sbgEComBinaryLogEvent.h:52
sbgEComBinaryLogWriteEvent
SbgErrorCode sbgEComBinaryLogWriteEvent(SbgStreamBuffer *pOutputStream, const SbgLogEvent *pInputData)
Definition:
sbgEComBinaryLogEvent.c:40
sbgStreamBufferWriteUint16LE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16LE(SbgStreamBuffer *pHandle, uint16_t value)
Definition:
sbgStreamBufferLE.h:1250
sbgStreamBufferReadUint32LE
SBG_INLINE uint32_t sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferLE.h:386
_SbgStreamBuffer
Definition:
sbgStreamBufferCommon.h:188
sbgEComBinaryLogEvent.h
SbgErrorCode
enum _SbgErrorCode SbgErrorCode
Header file that defines all error codes for SBG Systems libraries.
_SbgLogEvent::status
uint16_t status
Definition:
sbgEComBinaryLogEvent.h:49
sbgStreamBufferWriteUint32LE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value)
Definition:
sbgStreamBufferLE.h:1499
sbg_driver
Author(s): SBG Systems
autogenerated on Fri Oct 11 2024 02:13:40