MRPT  1.9.9
xssyncsetting.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef XSSYNCSETTINGS_H
10 #define XSSYNCSETTINGS_H
11 
12 #include "pstdint.h"
13 #include "xstypesconfig.h"
14 #include "xssyncline.h"
15 #include "xssyncfunction.h"
16 #include "xssyncpolarity.h"
17 
18 struct XsSyncSetting;
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #else
23 #define XSSYNCSETTINGS_INITIALIZER \
24  { \
25  XSL_Invalid, XSF_Invalid, XSP_None, 1, 0, 0, 0, 0, 0 \
26  }
27 #endif
28 
29 XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting* thisPtr);
30 XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting* thisPtr);
32  struct XsSyncSetting* a, struct XsSyncSetting* b);
33 
34 #ifdef __cplusplus
35 } // extern "C"
36 #endif
37 
38 /*! \brief A structure for storing all xsens sync settings */
40 {
41  XsSyncLine m_line; /*!< The sync lines enabled. \see XsSyncLine. */
42  XsSyncFunction m_function; /*!< The action to be performed, when an input
43  sync line changes \see XsSyncFunction. */
44  XsSyncPolarity m_polarity; /*!< The edge on which the action is performed,
45  \see XsSyncPolarity. */
46  uint32_t m_pulseWidth; /*!< The time to keep the line polarity before
47  toggling back, in microseconds. */
48  int32_t m_offset; /*!< The time between reception of a line change and the
49  execution of the sync action, in microseconds. */
50  uint16_t m_skipFirst; /*!< The number of frames to skip before executing the
51  action. */
52  uint16_t
53  m_skipFactor; /*!< The number of frames to skip between 2 actions. */
54  uint16_t m_clockPeriod; /*!< The frequency of the external clock in
55  milliseconds, only valid when action is
56  STE_ResetTimer. */
57  uint8_t
58  m_triggerOnce; /*!< Whether the action is repeated for each frame. */
59 
60 #ifdef __cplusplus
61  //! \brief Default constructor, initializes to the given (default) settings
62  explicit XsSyncSetting(
64  XsSyncPolarity polarity = XSP_RisingEdge, uint32_t pulseWidth = 1000,
65  int32_t offset = 0, uint16_t skipFirst = 0, uint16_t skipFactor = 0,
66  uint16_t clockPeriod = 0, uint8_t triggerOnce = 0)
67  : m_line(line),
68  m_function(function),
69  m_polarity(polarity),
70  m_pulseWidth(pulseWidth),
72  m_skipFirst(skipFirst),
73  m_skipFactor(skipFactor),
74  m_clockPeriod(clockPeriod),
75  m_triggerOnce(triggerOnce)
76  {
77  }
78 
79  //! \brief Construct a XsSyncSetting as a copy of \a other.
80  XsSyncSetting(const XsSyncSetting& other)
81  {
82  memcpy(this, &other, sizeof(XsSyncSetting));
83  }
84 
85  //! \brief Copy values of \a other into this.
86  const XsSyncSetting& operator=(const XsSyncSetting& other)
87  {
88  if (this != &other) memcpy(this, &other, sizeof(XsSyncSetting));
89  return *this;
90  }
91 
92  //! \brief \copybrief XsSyncSetting_isInput
93  inline bool isInput() const { return 0 != XsSyncSetting_isInput(this); }
94  //! \brief \copybrief XsSyncSetting_isOutput
95  inline bool isOutput() const { return 0 != XsSyncSetting_isOutput(this); }
96  /*! \brief Swap the contents with \a other
97  */
98  inline void swap(XsSyncSetting& other) { XsSyncSetting_swap(this, &other); }
99  /*! \brief Return true if \a other is identical to this
100  */
101  inline bool operator==(const XsSyncSetting& other) const
102  {
103  return (this == &other) ||
104  (m_line == other.m_line && m_function == other.m_function &&
105  m_polarity == other.m_polarity &&
106  m_pulseWidth == other.m_pulseWidth &&
107  m_offset == other.m_offset &&
108  m_skipFirst == other.m_skipFirst &&
109  m_skipFactor == other.m_skipFactor &&
110  m_clockPeriod == other.m_clockPeriod &&
111  m_triggerOnce == other.m_triggerOnce);
112  }
113 #endif
114 };
115 
117 
118 #endif // file guard
uint8_t m_triggerOnce
Definition: xssyncsetting.h:58
unsigned __int16 uint16_t
Definition: rptypes.h:44
XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting *thisPtr)
uint16_t m_skipFirst
Definition: xssyncsetting.h:50
GLintptr offset
Definition: glext.h:3925
React to a rising edge on input.
A structure for storing all xsens sync settings.
Definition: xssyncsetting.h:39
unsigned char uint8_t
Definition: rptypes.h:41
uint16_t m_clockPeriod
Definition: xssyncsetting.h:54
GLubyte GLubyte b
Definition: glext.h:6279
struct XsSyncSetting XsSyncSetting
XsSyncPolarity
Signal polarity.
XsSyncFunction m_function
Definition: xssyncsetting.h:42
XsSyncLine m_line
Definition: xssyncsetting.h:41
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:201
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
__int32 int32_t
Definition: rptypes.h:46
int32_t m_offset
Definition: xssyncsetting.h:48
Invalid action.
XsSyncFunction
Actions to be taken on input triggers.
uint32_t m_pulseWidth
Definition: xssyncsetting.h:46
unsigned __int32 uint32_t
Definition: rptypes.h:47
XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting *thisPtr)
XsSyncLine
Synchronization line identifiers.
Definition: xssyncline.h:16
GLubyte GLubyte GLubyte a
Definition: glext.h:6279
XsSyncPolarity m_polarity
Definition: xssyncsetting.h:44
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".
Definition: os.cpp:356
XSTYPES_DLL_API void XsSyncSetting_swap(struct XsSyncSetting *a, struct XsSyncSetting *b)
uint16_t m_skipFactor
Definition: xssyncsetting.h:53



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020