Project

General

Profile

GloveObject.h
1 //###################################################################################
2 //# Definition Of Class GloveObject #
3 //# Used To Handle a 5DT Glove #
4 //# Author : #
5 //# Aymeric SUTEAU #
6 //# LISA - ANGERS #
7 //###################################################################################
8 
9 #ifndef GLOVE_OBJECT
10 #define GLOVE_OBJECT
11 
12 // Include Glove Prerequistes
13 #include "GlovePrerequistes.h"
14 #include "dtimer.h"
15 
16 //define constants
17 #define NUMBEROFSENSOR 18
18 
23 {
24  public:
25  protected:
26  private:
27  fdGlove* pGlove; // Pointer to the Glove Object
28  int iUSBPort; // Index of the USB port on which the data glove is opened
29  std::string sUSBPort; // COM/USB port
30  int iType; // Type of glove (index)
31  std::string sType; // Type of glove (string)
32  int iHand; // Hand Type of glove (index)
33  std::string sHand; // Hand Type of glove (string)
34  int NbrOfSensors; // Counter for the number of sensors
35  int gestureIndex; // Index of the current gesture
36  std::string serialNumber;
37  bool bCalibrationDone; // Boolean to indicate the status of the calibration
38  float *pSensorValues; // Sensor values
39  GloveCalibration* calibration;
40  Timer timer;
41 
42  public:
43 
44  //constructor and destructor
45 
49  GloveObject();
50 
54  ~GloveObject();
55 
56  //getters
57 
58  fdGlove* GetGlove();
59 
63  std::string GetUSBPortName();
64 
65  /*
66  \brief ID of the USB port of the glove
67  */
68  int GetUSBPortIndex();
69 
70  /*
71  \brief get the id type of the glove
72  */
73  int GetTypeID();
74 
75  /*
76  \brief get the name of the glove type
77  */
78  std::string GetTypeName();
79 
80  /*
81  \brief hand ID
82  */
83  int GetHandIndex();
84 
85  /*
86  \brief right or left
87  */
88  std::string GetHandName();
89 
90  /*
91  \brief number of sensors (always return 18...)
92  */
93  int GetNbrOfSensors();
94 
95  /*
96  \brief ID of the hand gesture in binary base
97  */
98  int GetGestureIndex(); // Return gesture index between 0 and 15 (thumb not handled)
99 
100  /*
101  \brief serial number of the glove
102  */
103  std::string GetSerialNumber();
104 
105  /*
106  \brief Sensor values
107  */
108  float* GetSensorValues();
109 
110  /*
111  \brief reset the calibration
112  */
113  void StartCalibration();
114 
115  // Init Glove on USB Port and Glove sensors values
116  bool Init();
117  void InitValues();
118 
119  // Close Glove
120  int Close();
121 
122  // Calibrate Automatically (True) Or Manually (False) The Glove
123  void Calibrate(bool);
124 
125  // Called by the Callback Function
126  void UpdateGlove();
127  protected:
128  private:
129  /*
130  \brief link the driver gesture index to a binary based gesture index
131  */
132  void SetGestureIndex(int);
133 
134 
135 
136 };
137 
138 #endif