IMUEvent.h
Go to the documentation of this file.
1 /*
2  * IMUEvent.h
3  *
4  * Created on: Mar 16, 2014
5  * Author: Dr.-Ing. David Israel González Aguirre
6  * Mail: david.gonzalez@kit.edu
7  */
8 
9 #pragma once
10 
11 #include "IMUHelpers.h"
12 #include "IMUState.h"
13 
14 namespace IMU
15 {
16  class CIMUDevice;
17  class CIMUEvent
18  {
19  public:
20 
21  enum EventType
22  {
23  eOnIMUStart = 0X0001, eOnIMUStop = 0X0002, eOnIMUCycle = 0X0004, eOnIMUFusedCycle = 0X0008, eOnIMUIntegratedState = 0X0010, eOnIMUCustomEvent = 0X8000
24  };
25 
26  CIMUEvent(const timeval& TimeStamp, const EventType EventType, const CIMUDevice* pIMUDevice, const IMUState& EventState);
27  CIMUEvent(const timeval& TimeStamp, const EventType EventType, const CIMUDevice* pIMUDevice);
28  CIMUEvent(const EventType EventType, const CIMUDevice* pIMUDevice);
29  CIMUEvent(const CIMUEvent& Event);
30  CIMUEvent();
31 
32  virtual ~CIMUEvent();
33 
34  inline uint32_t GetId() const
35  {
36  return m_Id;
37  }
38 
39  inline EventType GetEventType() const
40  {
41  return m_EventType;
42  }
43 
44  inline const CIMUDevice* GetIMU() const
45  {
46  return m_pIMUDevice;
47  }
48 
49  inline const timeval& GetTimeStamp() const
50  {
51  return m_TimeStamp;
52  }
53 
54  protected:
55 
56  uint32_t m_Id;
57  const timeval m_TimeStamp;
61 
62  private:
63 
64  static uint32_t CreatId();
65  static uint32_t s_IdCounter;
66  static pthread_mutex_t s_IdCounterMutex;
67  };
68 }
69 
IMU::CIMUEvent::GetId
uint32_t GetId() const
Definition: IMUEvent.h:34
IMU::CIMUEvent::m_IMUState
const IMUState m_IMUState
Definition: IMUEvent.h:60
IMU::CIMUEvent::EventType
EventType
Definition: IMUEvent.h:21
IMU::CIMUEvent::CIMUEvent
CIMUEvent()
Definition: IMUEvent.cpp:38
IMU::CIMUEvent::eOnIMUStart
@ eOnIMUStart
Definition: IMUEvent.h:23
IMU::CIMUEvent::m_TimeStamp
const timeval m_TimeStamp
Definition: IMUEvent.h:57
IMU::CIMUEvent::~CIMUEvent
virtual ~CIMUEvent()
IMU::CIMUEvent::m_pIMUDevice
const CIMUDevice * m_pIMUDevice
Definition: IMUEvent.h:59
IMU::CIMUEvent
Definition: IMUEvent.h:17
IMU::CIMUEvent::GetIMU
const CIMUDevice * GetIMU() const
Definition: IMUEvent.h:44
IMU::CIMUEvent::eOnIMUCustomEvent
@ eOnIMUCustomEvent
Definition: IMUEvent.h:23
IMU::CIMUEvent::eOnIMUIntegratedState
@ eOnIMUIntegratedState
Definition: IMUEvent.h:23
IMU::CIMUEvent::eOnIMUStop
@ eOnIMUStop
Definition: IMUEvent.h:23
IMU::CIMUEvent::GetEventType
EventType GetEventType() const
Definition: IMUEvent.h:39
IMU::CIMUEvent::m_Id
uint32_t m_Id
Definition: IMUEvent.h:56
IMU::CIMUDevice
This class contains the the devices module and the thread for read the measurements.
Definition: IMUDevice.h:41
IMU::IMUState
Definition: IMUState.h:15
IMU
Definition: IIMUEventDispatcher.cpp:12
IMUHelpers.h
IMU::CIMUEvent::m_EventType
const EventType m_EventType
Definition: IMUEvent.h:58
IMUState.h
IMU::CIMUEvent::eOnIMUCycle
@ eOnIMUCycle
Definition: IMUEvent.h:23
IMU::CIMUEvent::GetTimeStamp
const timeval & GetTimeStamp() const
Definition: IMUEvent.h:49
IMU::CIMUEvent::eOnIMUFusedCycle
@ eOnIMUFusedCycle
Definition: IMUEvent.h:23