15 m_DispatchingMode(eCoupled), m_MaximalPendingEvents(2), m_EventFlags(0XFFFF), m_pIMUDevice(pIMUDevice), m_LastStartTimeStamp(
CTimeStamp::s_Zero), m_LastStopTimeStamp(
CTimeStamp::s_Zero), m_LastCycleReferenceTimeStamp(
CTimeStamp::s_Zero), m_LastFusedCycleReferenceTimeStamp(
CTimeStamp::s_Zero), m_LastIntegratedStateReferenceTimeStamp(
CTimeStamp::s_Zero), m_LastCustomEventReferenceTimeStamp(
CTimeStamp::s_Zero)
17 pthread_mutex_init(&m_DispatchingModeMutex,
nullptr);
18 pthread_mutex_init(&m_MaximalPendingEventsMutex,
nullptr);
19 pthread_mutex_init(&m_EventFlagsMutex,
nullptr);
20 pthread_mutex_init(&m_IMUDeviceMutex,
nullptr);
21 pthread_mutex_init(&m_EventsQueueMutex,
nullptr);
22 pthread_mutex_init(&m_LastStartTimeStampMutex,
nullptr);
23 pthread_mutex_init(&m_LastStopTimeStampMutex,
nullptr);
24 pthread_mutex_init(&m_LastCycleReferenceTimeStampMutex,
nullptr);
25 pthread_mutex_init(&m_LastFusedCycleReferenceTimeStampMutex,
nullptr);
26 pthread_mutex_init(&m_LastIntegratedStateReferenceTimeStampMutex,
nullptr);
27 pthread_mutex_init(&m_LastCustomEventReferenceTimeStampMutex,
nullptr);
31 m_DispatchingMode(eCoupled), m_MaximalPendingEvents(2), m_EventFlags(0XFFFF), m_pIMUDevice(nullptr), m_EventsQueue(), m_LastStartTimeStamp(
CTimeStamp::s_Zero), m_LastStopTimeStamp(
CTimeStamp::s_Zero), m_LastCycleReferenceTimeStamp(
CTimeStamp::s_Zero), m_LastFusedCycleReferenceTimeStamp(
CTimeStamp::s_Zero), m_LastIntegratedStateReferenceTimeStamp(
CTimeStamp::s_Zero), m_LastCustomEventReferenceTimeStamp(
CTimeStamp::s_Zero)
33 pthread_mutex_init(&m_DispatchingModeMutex,
nullptr);
34 pthread_mutex_init(&m_MaximalPendingEventsMutex,
nullptr);
35 pthread_mutex_init(&m_EventFlagsMutex,
nullptr);
36 pthread_mutex_init(&m_IMUDeviceMutex,
nullptr);
37 pthread_mutex_init(&m_EventsQueueMutex,
nullptr);
38 pthread_mutex_init(&m_LastStartTimeStampMutex,
nullptr);
39 pthread_mutex_init(&m_LastStopTimeStampMutex,
nullptr);
40 pthread_mutex_init(&m_LastCycleReferenceTimeStampMutex,
nullptr);
41 pthread_mutex_init(&m_LastFusedCycleReferenceTimeStampMutex,
nullptr);
42 pthread_mutex_init(&m_LastIntegratedStateReferenceTimeStampMutex,
nullptr);
43 pthread_mutex_init(&m_LastCustomEventReferenceTimeStampMutex,
nullptr);
57 m_pIMUDevice = pIMUDevice;
64 const uint32_t EventFlagsCurrentState = m_EventFlags;
66 return EventFlagsCurrentState;
72 m_DispatchingMode = Mode;
81 return DispatchingModeCurrentState;
86 if ((MaximalPendingEvents > 1) && (MaximalPendingEvents != m_MaximalPendingEvents))
89 m_MaximalPendingEvents = MaximalPendingEvents;
102 const uint32_t MaximalPendingEventsCurrentState = m_MaximalPendingEvents;
104 return MaximalPendingEventsCurrentState;
110 m_EventFlags = Enabled ? (m_EventFlags |
Type) : (m_EventFlags & (~
Type));
117 const uint32_t EventHandlingFlagsCurrentState = m_EventFlags;
119 return EventHandlingFlagsCurrentState;
125 const bool HandelEvent = Event.
GetEventType() & m_EventFlags;
134 if (m_EventsQueue.size() == m_MaximalPendingEvents)
136 m_EventsQueue.pop_front();
139 m_EventsQueue.push_back(Event);
146 gettimeofday(&m_LastCycleReferenceTimeStamp,
nullptr);
152 gettimeofday(&m_LastFusedCycleReferenceTimeStamp,
nullptr);
158 gettimeofday(&m_LastIntegratedStateReferenceTimeStamp,
nullptr);
164 gettimeofday(&m_LastCustomEventReferenceTimeStamp,
nullptr);
170 gettimeofday(&m_LastStartTimeStamp,
nullptr);
176 gettimeofday(&m_LastStopTimeStamp,
nullptr);
192 if (m_EventsQueue.size())
195 m_EventsQueue.pop_front();
209 m_LastStartTimeStamp = Reference;
213 m_LastStopTimeStamp = Reference;
217 m_LastCycleReferenceTimeStamp = Reference;
221 m_LastFusedCycleReferenceTimeStamp = Reference;
225 m_LastIntegratedStateReferenceTimeStamp = Reference;
229 m_LastCustomEventReferenceTimeStamp = Reference;
236 timeval TimeStampCurrentState = m_LastStartTimeStamp;
238 return TimeStampCurrentState;
244 timeval TimeStampCurrentState = m_LastStopTimeStamp;
246 return TimeStampCurrentState;
252 timeval TimeStampCurrentState = m_LastCycleReferenceTimeStamp;
254 return TimeStampCurrentState;
260 timeval TimeStampCurrentState = m_LastFusedCycleReferenceTimeStamp;
262 return TimeStampCurrentState;
268 timeval TimeStampCurrentState = m_LastIntegratedStateReferenceTimeStamp;
270 return TimeStampCurrentState;
276 timeval TimeStampCurrentState = m_LastCustomEventReferenceTimeStamp;
278 return TimeStampCurrentState;
281 void IIMUEventDispatcher::PurgeEvents()
285 if (m_EventsQueue.size() >= m_MaximalPendingEvents)
287 const uint32_t TotalEventsToRemove = (uint32_t(m_EventsQueue.size()) - m_MaximalPendingEvents) + 1;
289 for (uint32_t i = 0 ; i < TotalEventsToRemove ; ++i)
291 m_EventsQueue.pop_front();