| 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 XSDEVICECAPABILITIES_H |
| 34 |
#define XSDEVICECAPABILITIES_H |
| 35 |
|
| 36 |
#include "xstypesconfig.h" |
| 37 |
|
| 38 |
#ifdef __cplusplus |
| 39 |
extern "C" { |
| 40 |
#endif |
| 41 |
|
| 42 |
/*! \addtogroup enums Global enumerations |
| 43 |
@{ |
| 44 |
*/ |
| 45 |
/*! \brief Device capability flags. */ |
| 46 |
enum XsDeviceCapability |
| 47 |
{ |
| 48 |
XDC_Invalid = 0x00000000, //!< Indicates the \a XsDeviceCapabilities structure is invalid. |
| 49 |
XDC_Acc = 0x00000001, //!< Device has an operational accelerometer. |
| 50 |
XDC_Gyr = 0x00000002, //!< Device has an operational gyroscope. |
| 51 |
XDC_Mag = 0x00000004, //!< Device has an operational magnetometer. |
| 52 |
XDC_Baro = 0x00000008, //!< Device has an operational barometer |
| 53 |
XDC_Gnss = 0x00000010, //!< Device has an operational GNSS receiver. |
| 54 |
XDC_Imu = 0x00000020, //!< Device is an IMU. |
| 55 |
XDC_Vru = 0x00000040, //!< Device is a VRU. |
| 56 |
XDC_Ahrs = 0x00000080, //!< Device is an AHRS. |
| 57 |
XDC_GnssIns = 0x00000100, //!< Device is a GNSS/INS. |
| 58 |
}; |
| 59 |
/*! @} */ |
| 60 |
|
| 61 |
typedef enum XsDeviceCapability XsDeviceCapability; |
| 62 |
|
| 63 |
struct XsDeviceCapabilities; |
| 64 |
|
| 65 |
XSTYPES_DLL_API int XsDeviceCapabilities_isValid(const struct XsDeviceCapabilities* thisPtr); |
| 66 |
XSTYPES_DLL_API int XsDeviceCapabilities_hasAccelerometer(const struct XsDeviceCapabilities* thisPtr); |
| 67 |
XSTYPES_DLL_API int XsDeviceCapabilities_hasGyroscope(const struct XsDeviceCapabilities* thisPtr); |
| 68 |
XSTYPES_DLL_API int XsDeviceCapabilities_hasMagnetometer(const struct XsDeviceCapabilities* thisPtr); |
| 69 |
XSTYPES_DLL_API int XsDeviceCapabilities_hasBarometer(const struct XsDeviceCapabilities* thisPtr); |
| 70 |
XSTYPES_DLL_API int XsDeviceCapabilities_hasGnss(const struct XsDeviceCapabilities* thisPtr); |
| 71 |
XSTYPES_DLL_API int XsDeviceCapabilities_isImu(const struct XsDeviceCapabilities* thisPtr); |
| 72 |
XSTYPES_DLL_API int XsDeviceCapabilities_isVru(const struct XsDeviceCapabilities* thisPtr); |
| 73 |
XSTYPES_DLL_API int XsDeviceCapabilities_isAhrs(const struct XsDeviceCapabilities* thisPtr); |
| 74 |
XSTYPES_DLL_API int XsDeviceCapabilities_isGnssIns(const struct XsDeviceCapabilities* thisPtr); |
| 75 |
|
| 76 |
#ifdef __cplusplus |
| 77 |
} |
| 78 |
#endif |
| 79 |
|
| 80 |
struct XsDeviceCapabilities |
| 81 |
{ |
| 82 |
#ifdef __cplusplus |
| 83 |
public: |
| 84 |
//! \brief Constructor to create an XsDeviceCapabilities instance from a raw flags field. |
| 85 |
inline explicit XsDeviceCapabilities(uint32_t flags = XDC_Invalid) |
| 86 |
: m_flags(flags) |
| 87 |
{ |
| 88 |
} |
| 89 |
|
| 90 |
//! \brief Copy constructor. |
| 91 |
inline XsDeviceCapabilities(const XsDeviceCapabilities& other) |
| 92 |
: m_flags(other.m_flags) |
| 93 |
{ |
| 94 |
} |
| 95 |
|
| 96 |
//! \brief Copy assignment. |
| 97 |
inline const XsDeviceCapabilities& operator=(const XsDeviceCapabilities& other) |
| 98 |
{ |
| 99 |
m_flags = other.m_flags; |
| 100 |
return *this; |
| 101 |
} |
| 102 |
|
| 103 |
//! \copydoc XsDeviceCapabilities_hasAccelerometer(const struct XsDeviceCapabilities*) |
| 104 |
inline bool hasAccelerometer() const |
| 105 |
{ |
| 106 |
return XsDeviceCapabilities_hasAccelerometer(this) != 0; |
| 107 |
} |
| 108 |
|
| 109 |
//! \copydoc XsDeviceCapabilities_hasGyroscope(const struct XsDeviceCapabilities*) |
| 110 |
inline bool hasGyroscope() const |
| 111 |
{ |
| 112 |
return XsDeviceCapabilities_hasGyroscope(this) != 0; |
| 113 |
} |
| 114 |
|
| 115 |
//! \copydoc XsDeviceCapabilities_hasMagnetometer(const struct XsDeviceCapabilities*) |
| 116 |
inline bool hasMagnetometer() const |
| 117 |
{ |
| 118 |
return XsDeviceCapabilities_hasMagnetometer(this) != 0; |
| 119 |
} |
| 120 |
|
| 121 |
//! \copydoc XsDeviceCapabilities_hasBarometer(const struct XsDeviceCapabilities*) |
| 122 |
inline bool hasBarometer() const |
| 123 |
{ |
| 124 |
return XsDeviceCapabilities_hasBarometer(this) != 0; |
| 125 |
} |
| 126 |
|
| 127 |
//! \copydoc XsDeviceCapabilities_hasGnss(const struct XsDeviceCapabilities*) |
| 128 |
inline bool hasGnss() const |
| 129 |
{ |
| 130 |
return XsDeviceCapabilities_hasGnss(this) != 0; |
| 131 |
} |
| 132 |
|
| 133 |
//! \copydoc XsDeviceCapabilities_isImu(const struct XsDeviceCapabilities*) |
| 134 |
inline bool isImu() const |
| 135 |
{ |
| 136 |
return XsDeviceCapabilities_isImu(this) != 0; |
| 137 |
} |
| 138 |
|
| 139 |
//! \copydoc XsDeviceCapabilities_isVru(const struct XsDeviceCapabilities*) |
| 140 |
inline bool isVru() const |
| 141 |
{ |
| 142 |
return XsDeviceCapabilities_isVru(this) != 0; |
| 143 |
} |
| 144 |
|
| 145 |
//! \copydoc XsDeviceCapabilities_isAhrs(const struct XsDeviceCapabilities*) |
| 146 |
inline bool isAhrs() const |
| 147 |
{ |
| 148 |
return XsDeviceCapabilities_isAhrs(this) != 0; |
| 149 |
} |
| 150 |
|
| 151 |
//! \copydoc XsDeviceCapabilities_isGnssIns(const struct XsDeviceCapabilities*) |
| 152 |
inline bool isGnssIns() const |
| 153 |
{ |
| 154 |
return XsDeviceCapabilities_isGnssIns(this) != 0; |
| 155 |
} |
| 156 |
private: |
| 157 |
#endif |
| 158 |
|
| 159 |
uint32_t m_flags; |
| 160 |
}; |
| 161 |
|
| 162 |
typedef struct XsDeviceCapabilities XsDeviceCapabilities; |
| 163 |
|
| 164 |
#endif |