Debian Codegraph @

3rdparty/xspublic/xstypes/xssnapshot.h

raw symbols SCIP
1
2 // Copyright (c) 2003-2019 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32
33 #ifndef XSSNAPSHOT_H
34 #define XSSNAPSHOT_H
35
36 #include "xstypesconfig.h"
37 #include "xsdeviceid.h"
38
39 struct XsSnapshot;
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 #ifndef __cplusplus
45 #define XSSNAPSHOT_INITIALIZER { XSDEVICEID_INITIALIZER, 0, 0, 0,0,0,0, 0,0,0, 0,0,0, 0, 0, 0, 0 }
46 #endif
47
48 XSTYPES_DLL_API void XsSnapshot_construct(struct XsSnapshot* thisPtr);
49 XSTYPES_DLL_API void XsSnapshot_destruct(struct XsSnapshot* thisPtr);
50
51 #ifdef __cplusplus
52 } // extern "C"
53 #endif
54
55 enum SnapshotType
56 {
57 ST_Awinda = 0, //
58 ST_Full
59 };
60 typedef enum SnapshotType SnapshotType;
61 /*! \brief A container for Snapshot data
62 */
63 struct XsSnapshot
64 {
65 XsDeviceId m_deviceId; /*!< \brief The ID of the device that created the data */
66 uint32_t m_frameNumber; /*!< \brief The frame */
67 uint64_t m_timestamp; /*!< \brief The timestamp */
68 int32_t m_iQ[4]; /*!< \brief The integrated orientation */
69 int64_t m_iV[3]; /*!< \brief The integrated velocity */
70 int32_t m_mag[3]; /*!< \brief The magnetic field */
71 int32_t m_baro; /*!< \brief The barometric pressure */
72 uint16_t m_status; /*!< \brief The clipping flags of the latest interval */
73 uint8_t m_accClippingCounter; /*!< \brief The clipping event counter for the Acc */
74 uint8_t m_gyrClippingCounter; /*!< \brief The clipping event counter for the Gyr */
75 SnapshotType m_type; /*!< \brief The type of the snapshot (Awinda, Full) */
76 #ifdef __cplusplus
77 /*! \brief Returns true if all fields of this and \a other are exactly identical */
78 inline bool operator == (const XsSnapshot& other) const
79 {
80 if (m_frameNumber != other.m_frameNumber ||
81 m_baro != other.m_baro ||
82 m_status != other.m_status ||
83 m_accClippingCounter != other.m_accClippingCounter ||
84 m_gyrClippingCounter != other.m_gyrClippingCounter||
85 m_type != other.m_type)
86 return false;
87
88 for (int i = 0; i < 3; ++i)
89 {
90 if (m_iQ[i] != other.m_iQ[i] ||
91 m_iV[i] != other.m_iV[i] ||
92 m_mag[i] != other.m_mag[i])
93 return false;
94 }
95 if (m_type == ST_Full)
96 {
97 if (m_iQ[3] != other.m_iQ[3] || m_timestamp != other.m_timestamp )
98 return false;
99 }
100 return true;
101 }
102 #endif
103 };
104 typedef struct XsSnapshot XsSnapshot;
105
106 /*! \brief Status flag definitions for XsSnapshot status field */
107 enum SnapshotStatusFlag
108 {
109 FSFL_ClipAccX = 0x0001,
110 FSFL_ClipAccY = 0x0002,
111 FSFL_ClipAccZ = 0x0004,
112 FSFL_ClipAccMask = 0x0007,
113 FSFL_ClipGyrX = 0x0008,
114 FSFL_ClipGyrY = 0x0010,
115 FSFL_ClipGyrZ = 0x0020,
116 FSFL_ClipGyrMask = 0x0038,
117 FSFL_ClipMagX = 0x0040,
118 FSFL_ClipMagY = 0x0080,
119 FSFL_ClipMagZ = 0x0100,
120 FSFL_ClipMagMask = 0x01C0,
121 FSFL_MagIsNew = 0x0200,
122 FSFL_BaroIsNew = 0x0400,
123 FSFL_RotationMask = 0x1800
124 };
125 typedef enum SnapshotStatusFlag SnapshotStatusFlag;
126
127
128
129 #define FSFL_ClipAccShift 0
130 #define FSFL_ClipGyrShift 04
131 #define FSFL_ClipMagshift 6
132 #define FSFL_RotationShift 11
133
134 #endif