external
sbgECom
src
binaryLogs
sbgEComBinaryLogStatus.c
Go to the documentation of this file.
1
#include "
sbgEComBinaryLogStatus.h
"
2
3
//----------------------------------------------------------------------//
4
//- Operations -//
5
//----------------------------------------------------------------------//
6
13
SbgErrorCode
sbgEComBinaryLogParseStatusData
(
SbgStreamBuffer
*pInputStream,
SbgLogStatusData
*pOutputData)
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
59
SbgErrorCode
sbgEComBinaryLogWriteStatusData
(
SbgStreamBuffer
*pOutputStream,
const
SbgLogStatusData
*pInputData)
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
}
sbgStreamBufferGetLastError
SBG_INLINE SbgErrorCode sbgStreamBufferGetLastError(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferCommon.h:274
_SbgLogStatusData
Definition:
sbgEComBinaryLogStatus.h:116
sbgStreamBufferReadUint16LE
SBG_INLINE uint16_t sbgStreamBufferReadUint16LE(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferLE.h:106
sbgEComBinaryLogStatus.h
_SbgLogStatusData::uptime
uint32_t uptime
Definition:
sbgEComBinaryLogStatus.h:125
_SbgLogStatusData::aidingStatus
uint32_t aidingStatus
Definition:
sbgEComBinaryLogStatus.h:122
_SbgLogStatusData::reserved2
uint32_t reserved2
Definition:
sbgEComBinaryLogStatus.h:123
sbgStreamBufferWriteUint16LE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint16LE(SbgStreamBuffer *pHandle, uint16_t value)
Definition:
sbgStreamBufferLE.h:1250
_SbgLogStatusData::comStatus
uint32_t comStatus
Definition:
sbgEComBinaryLogStatus.h:121
sbgStreamBufferGetSpace
SBG_INLINE size_t sbgStreamBufferGetSpace(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferCommon.h:353
_SbgLogStatusData::reserved3
uint16_t reserved3
Definition:
sbgEComBinaryLogStatus.h:124
sbgStreamBufferReadUint32LE
SBG_INLINE uint32_t sbgStreamBufferReadUint32LE(SbgStreamBuffer *pHandle)
Definition:
sbgStreamBufferLE.h:386
sbgEComBinaryLogParseStatusData
SbgErrorCode sbgEComBinaryLogParseStatusData(SbgStreamBuffer *pInputStream, SbgLogStatusData *pOutputData)
Definition:
sbgEComBinaryLogStatus.c:13
_SbgLogStatusData::reserved1
uint16_t reserved1
Definition:
sbgEComBinaryLogStatus.h:120
_SbgStreamBuffer
Definition:
sbgStreamBufferCommon.h:188
_SbgLogStatusData::generalStatus
uint16_t generalStatus
Definition:
sbgEComBinaryLogStatus.h:119
SbgErrorCode
enum _SbgErrorCode SbgErrorCode
Header file that defines all error codes for SBG Systems libraries.
_SbgLogStatusData::timeStamp
uint32_t timeStamp
Definition:
sbgEComBinaryLogStatus.h:118
sbgStreamBufferWriteUint32LE
SBG_INLINE SbgErrorCode sbgStreamBufferWriteUint32LE(SbgStreamBuffer *pHandle, uint32_t value)
Definition:
sbgStreamBufferLE.h:1499
sbgEComBinaryLogWriteStatusData
SbgErrorCode sbgEComBinaryLogWriteStatusData(SbgStreamBuffer *pOutputStream, const SbgLogStatusData *pInputData)
Definition:
sbgEComBinaryLogStatus.c:59
sbg_driver
Author(s): SBG Systems
autogenerated on Fri Oct 11 2024 02:13:40