xssyncsetting.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 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 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #ifndef XSSYNCSETTINGS_H
66 #define XSSYNCSETTINGS_H
67 
68 #include <string.h>
69 
70 #include "pstdint.h"
71 #include "xstypesconfig.h"
72 #include "xssyncline.h"
73 #include "xssyncfunction.h"
74 #include "xssyncpolarity.h"
75 
76 struct XsSyncSetting;
77 
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 #ifndef __cplusplus
82 #define XSSYNCSETTINGS_INITIALIZER { XSL_Invalid, XSF_Invalid, XSP_None, 1, 0, 0, 0, 0, 0, 0 }
83 #endif
84 
85 XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting* thisPtr);
86 XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting* thisPtr);
88 XSTYPES_DLL_API int XsSyncSetting_compare(const struct XsSyncSetting* a, const struct XsSyncSetting* b);
89 
90 #ifdef __cplusplus
91 } // extern "C"
92 #endif
93 
96 {
102  uint16_t m_skipFirst;
103  uint16_t m_skipFactor;
104  uint16_t m_clockPeriod;
105  uint8_t m_triggerOnce;
106  uint8_t m_padding;
107 #ifdef __cplusplus
108  explicit XsSyncSetting(XsSyncLine line = XSL_Invalid
110  , XsSyncFunction function = XSF_Invalid
111  , XsSyncPolarity polarity = XSP_RisingEdge
112  , uint32_t pulseWidth = 1000
113  , int32_t offset = 0
114  , uint16_t skipFirst = 0
115  , uint16_t skipFactor = 0
116  , uint16_t clockPeriod = 0
117  , uint8_t triggerOnce = 0)
118  : m_line(line)
119  , m_function(function)
120  , m_polarity(polarity)
121  , m_pulseWidth(pulseWidth)
122  , m_offset(offset)
123  , m_skipFirst(skipFirst)
124  , m_skipFactor(skipFactor)
125  , m_clockPeriod(clockPeriod)
126  , m_triggerOnce(triggerOnce)
127  , m_padding(0)
128  {
129  }
130 
132  XsSyncSetting(const XsSyncSetting& other)
133  {
134  memcpy(this, &other, sizeof(XsSyncSetting));
135  }
136 
138  const XsSyncSetting& operator =(const XsSyncSetting& other)
139  {
140  if (this != &other)
141  memcpy(this, &other, sizeof(XsSyncSetting));
142  return *this;
143  }
144 
146  inline bool isInput() const
147  {
148  return 0 != XsSyncSetting_isInput(this);
149  }
150 
152  inline bool isOutput() const
153  {
154  return 0 != XsSyncSetting_isOutput(this);
155  }
156 
159  inline void swap(XsSyncSetting& other)
160  {
161  XsSyncSetting_swap(this, &other);
162  }
163 
166  friend void swap(XsSyncSetting& first, XsSyncSetting& second)
167  {
168  first.swap(second);
169  }
170 
173  inline bool operator == (const XsSyncSetting& other) const
174  {
175  return (this == &other) || XsSyncSetting_compare(this, &other) == 0;
176  }
177 
180  inline bool operator != (const XsSyncSetting& other) const
181  {
182  return (this != &other) && XsSyncSetting_compare(this, &other) != 0;
183  }
184 
187  inline bool operator < (const XsSyncSetting& other) const
188  {
189  return (this != &other) && XsSyncSetting_compare(this, &other) < 0;
190  }
191 #endif
192 };
193 
195 
196 #endif
xssyncline.h
XsSyncSetting::m_skipFirst
uint16_t m_skipFirst
Definition: xssyncsetting.h:102
XsSyncSetting_isOutput
XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting *thisPtr)
XsSyncSetting::m_function
XsSyncFunction m_function
Definition: xssyncsetting.h:98
XSL_Invalid
@ XSL_Invalid
Invalid sync setting. Used if no sync line is set.
Definition: xssyncline.h:94
XsSyncSetting::m_polarity
XsSyncPolarity m_polarity
Definition: xssyncsetting.h:99
XsSyncSetting::m_pulseWidth
uint32_t m_pulseWidth
Definition: xssyncsetting.h:100
XsSyncSetting_swap
XSTYPES_DLL_API void XsSyncSetting_swap(struct XsSyncSetting *a, struct XsSyncSetting *b)
Swap the contents of a with b.
Definition: xssyncsetting.c:109
XsSyncSetting::m_padding
uint8_t m_padding
Definition: xssyncsetting.h:106
XsSyncSetting_compare
XSTYPES_DLL_API int XsSyncSetting_compare(const struct XsSyncSetting *a, const struct XsSyncSetting *b)
Compares a with b.
Definition: xssyncsetting.c:122
XsSyncPolarity
XsSyncPolarity
Signal polarity.
Definition: xssyncpolarity.h:74
XsSyncSetting
A structure for storing all xsens sync settings.
Definition: xssyncsetting.h:95
operator==
bool operator==(const XsFilterProfile &lhs, const XsFilterProfile &rhs)
Returns true if lhs has the same type as rhs.
Definition: scenariomatchpred.h:81
uint32_t
unsigned int uint32_t
Definition: pstdint.h:485
XsSyncSetting::m_triggerOnce
uint8_t m_triggerOnce
Definition: xssyncsetting.h:105
XsSyncSetting
struct XsSyncSetting XsSyncSetting
Definition: xssyncsetting.h:194
XsSyncSetting::m_line
XsSyncLine m_line
Definition: xssyncsetting.h:97
xssyncfunction.h
xstypesconfig.h
XsSyncSetting::m_offset
int32_t m_offset
Definition: xssyncsetting.h:101
pstdint.h
XSP_RisingEdge
@ XSP_RisingEdge
React to a rising edge on input.
Definition: xssyncpolarity.h:77
XsSyncLine
XsSyncLine
Synchronization line identifiers.
Definition: xssyncline.h:74
XSTYPES_DLL_API
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:65
int32_t
signed int int32_t
Definition: pstdint.h:515
XsSyncSetting_isInput
XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting *thisPtr)
XSF_Invalid
@ XSF_Invalid
Invalid action.
Definition: xssyncfunction.h:100
XsSyncFunction
XsSyncFunction
Actions to be taken on input triggers.
Definition: xssyncfunction.h:74
xssyncpolarity.h
XsSyncSetting::m_skipFactor
uint16_t m_skipFactor
Definition: xssyncsetting.h:103
XsSyncSetting::m_clockPeriod
uint16_t m_clockPeriod
Definition: xssyncsetting.h:104


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:20