gloveDevice.h
Go to the documentation of this file.
1 
18 #ifndef GLOVEDEVICE_H
19 #define GLOVEDEVICE_H
20 
21 /* system includes */
22 #include <pthread.h>
23 
24 /* my includes */
25 #include "gloveTypes.h"
26 #include "gloveStatus.h"
27 #include "serial.h"
28 
36 #define CR 13
37 #define LF 10
38 #define MAX_SENSORS 22
39 
41 {
42 public:
43  gloveDevice();
44  ~gloveDevice();
45 
46  bool init(const char *serialDev);
47  void stop();
48 
49  /* Display status */
50  void showCurrentStatus();
51 
52  /* Sensors: init */
53 
54  //M
56  bool cmdGetSwSensorMask(sensorMask_t *mask);
57  //K
58  bool cmdGetHwSensorMask(sensorMask_t *mask);
59  //N
62  //S
64  //T
66  bool cmdGetSamplePeriod(samplePeriod_t *period);
67 
68  /* Sensors: switches */
69 
70  //D
71  bool cmdSetTimeStamp(bool enable);
72  bool cmdGetTimeStamp(bool *enable);
73  //U
74  bool cmdSetGloveStatus(bool enable);
75  bool cmdGetGloveStatus(bool *enable);
76 
77  /* Sensors: values */
78 
79  //G
80  bool cmdGetSensorValues(vector_t values, uchar_t *n, statusQuery_t *query,
81  gloveStatusByte_t *gloveStatusByte);
82  //Y
83  bool cmdGetSensorValuesSync(vector_t values, uchar_t *n, bool *errorSync,
84  gloveStatusByte_t *gloveStatusByte);
85  //S
86  bool cmdSetStreamValues(bool enable);
87 
89  statusQuery_t *query, gloveStatusByte_t *gloveStatusByte);
90 
91  /* Sensors: calibrate */
92 
93  //A
94  bool cmdSetActuate(int n, vector_t index, vector_t values);
95  bool cmdSetActuateAll(vector_t values);
96  bool cmdGetActuateAll(vector_t values);
97  //C
98  bool cmdSetCalibrateAll(vector_t offset, vector_t gain);
99  bool cmdSetCalibrateOffset(uchar_t index, uchar_t offset);
100  bool cmdSetCalibrateGain(uchar_t index, uchar_t gain);
101  bool cmdGetCalibrateAll(vector_t offset, vector_t gain);
102 
103  /* Glove: information */
104 
105  //B
106  bool cmdSetBaudRate(uchar_t baudDivide);
107  bool cmdGetBaudRate(uchar_t *baudDivide);
108  //P
111  //G
113  //R
114  bool cmdGetHand(bool *rightHand);
115  //V
116  bool cmdGetGloveVersion(gloveVersion_t *version);
117  //Y
118  bool cmdSetBinarySync(bool enable);
119  bool cmdGetBinarySync(bool *enable);
120 
121  /* Glove: switches */
122 
123  //F
124  bool cmdSetDigitalFilter(bool enable);
125  bool cmdGetDigitalFilter(bool *enable);
126  //J
127  bool cmdSetControlLight(bool enable);
128  bool cmdGetControlLight(bool *enable);
129  //L
130  bool cmdSetWristLight(bool enable);
131  bool cmdGetWristLight(bool *enable);
132  //Q
133  bool cmdSetQuantized(bool enable);
134  bool cmdGetQuantized(bool *enable);
135  //W
136  bool cmdSetWristToggle(bool enable);
137  bool cmdGetWristToggle(bool *enable);
138 
139  /* Glove: internal commands */
140 
141  //^I
143  //^R
144  bool cmdRestartFirmware();
145 
146 private:
149  bool error;
150  pthread_mutex_t serial_lock;
151 
152  void lock_serial();
153  void unlock_serial();
154 
155  uchar_t getChar();
156  void getString(vector_t s, int n);
157  void sendChar(uchar_t);
158  void sendString(vector_t s, int n);
159 
160  bool readResponseSet(uchar_t c);
161  bool readResponseSet(uchar_t c1, uchar_t c2);
162  bool readNullChar();
163  bool readResponseGet(uchar_t c);
164 
165  bool cmdSetChar(uchar_t name, uchar_t val);
166  bool cmdGetChar(uchar_t name, uchar_t *val);
167  bool cmdGetBool(uchar_t name, bool *val);
168 
169  bool internalCmd(uchar_t cmd);
170 
171 };
172 
173 #endif /* GLOVEDEVICE_H */
bool cmdSetCalibrateGain(uchar_t index, uchar_t gain)
Definition: gloveDevice.cc:314
bool cmdGetWristToggle(bool *enable)
Definition: gloveDevice.cc:745
bool cmdSetWristToggle(bool enable)
Definition: gloveDevice.cc:740
bool cmdSetParameterFlags(parameterFlags_t flags)
Definition: gloveDevice.cc:567
bool readResponseGet(uchar_t c)
Definition: gloveDevice.cc:159
bool cmdGetConnectStatus(statusConnect_t *status)
Definition: gloveDevice.cc:467
bool cmdGetSensorValuesSync(vector_t values, uchar_t *n, bool *errorSync, gloveStatusByte_t *gloveStatusByte)
Definition: gloveDevice.cc:760
bool cmdSetControlLight(bool enable)
Definition: gloveDevice.cc:477
bool cmdSetSamplePeriod(samplePeriod_t period)
Definition: gloveDevice.cc:657
void unlock_serial()
Definition: gloveDevice.cc:116
bool cmdGetCalibrateAll(vector_t offset, vector_t gain)
Definition: gloveDevice.cc:333
bool cmdGetChar(uchar_t name, uchar_t *val)
Definition: gloveDevice.cc:186
bool cmdGetSensorDummyValues(vector_t values, uchar_t *n, statusQuery_t *query, gloveStatusByte_t *gloveStatusByte)
Definition: gloveDevice.cc:616
bool cmdSetActuateAll(vector_t values)
Definition: gloveDevice.cc:232
bool cmdGetWristLight(bool *enable)
Definition: gloveDevice.cc:508
unsigned char uchar_t
Definition: gloveTypes.h:28
uchar_t getChar()
Definition: gloveDevice.cc:122
bool cmdGetSensorValues(vector_t values, uchar_t *n, statusQuery_t *query, gloveStatusByte_t *gloveStatusByte)
Definition: gloveDevice.cc:390
bool cmdSetGloveStatus(bool enable)
Definition: gloveDevice.cc:691
gloveStatus status
Definition: gloveDevice.h:147
bool cmdGetActuateAll(vector_t values)
Definition: gloveDevice.cc:250
bool cmdGetHand(bool *rightHand)
Definition: gloveDevice.cc:611
void lock_serial()
Definition: gloveDevice.cc:110
void getString(vector_t s, int n)
Definition: gloveDevice.cc:129
bool cmdSetActuate(int n, vector_t index, vector_t values)
Definition: gloveDevice.cc:210
bool cmdGetQuantized(bool *enable)
Definition: gloveDevice.cc:606
bool cmdSetNbSensorsEnabled(uchar_t n)
Definition: gloveDevice.cc:547
SerialDevice serial
Definition: gloveDevice.h:148
bool readResponseSet(uchar_t c)
Definition: gloveDevice.cc:144
bool cmdSetChar(uchar_t name, uchar_t val)
Definition: gloveDevice.cc:169
bool cmdSetWristLight(bool enable)
Definition: gloveDevice.cc:503
bool cmdSetQuantized(bool enable)
Definition: gloveDevice.cc:601
bool internalCmd(uchar_t cmd)
Definition: gloveDevice.cc:627
bool cmdSetTimeStamp(bool enable)
Definition: gloveDevice.cc:350
bool readNullChar()
Definition: gloveDevice.cc:154
bool cmdReinitializeCyberGlove()
Definition: gloveDevice.cc:472
bool cmdGetTimeStamp(bool *enable)
Definition: gloveDevice.cc:365
bool cmdSetCalibrateAll(vector_t offset, vector_t gain)
Definition: gloveDevice.cc:276
bool cmdGetGloveStatus(bool *enable)
Definition: gloveDevice.cc:701
bool cmdGetNbSensorsEnabled(uchar_t *n)
Definition: gloveDevice.cc:557
bool cmdGetBaudRate(uchar_t *baudDivide)
Definition: gloveDevice.cc:271
bool cmdSetStreamValues(bool enable)
Definition: gloveDevice.cc:451
unsigned char * vector_t
Definition: gloveTypes.h:27
bool init(const char *serialDev)
Definition: gloveDevice.cc:37
bool cmdGetBinarySync(bool *enable)
Definition: gloveDevice.cc:755
bool cmdGetControlLight(bool *enable)
Definition: gloveDevice.cc:482
void showCurrentStatus()
Definition: gloveDevice.cc:788
bool cmdRestartFirmware()
Definition: gloveDevice.cc:647
bool cmdGetParameterFlags(parameterFlags_t *flags)
Definition: gloveDevice.cc:585
bool cmdGetGloveVersion(gloveVersion_t *version)
Definition: gloveDevice.cc:711
bool cmdGetDigitalFilter(bool *enable)
Definition: gloveDevice.cc:385
bool cmdSetBinarySync(bool enable)
Definition: gloveDevice.cc:750
bool cmdSetCalibrateOffset(uchar_t index, uchar_t offset)
Definition: gloveDevice.cc:295
bool cmdGetHwSensorMask(sensorMask_t *mask)
Definition: gloveDevice.cc:487
pthread_mutex_t serial_lock
Definition: gloveDevice.h:150
void sendChar(uchar_t)
Definition: gloveDevice.cc:134
bool cmdGetNbSensorsTotal(uchar_t *n)
Definition: gloveDevice.cc:652
bool cmdSetSwSensorMask(sensorMask_t mask)
Definition: gloveDevice.cc:513
bool cmdGetSamplePeriod(samplePeriod_t *period)
Definition: gloveDevice.cc:675
bool cmdGetBool(uchar_t name, bool *val)
Definition: gloveDevice.cc:202
void sendString(vector_t s, int n)
Definition: gloveDevice.cc:139
bool cmdGetSwSensorMask(sensorMask_t *mask)
Definition: gloveDevice.cc:531
bool cmdSetBaudRate(uchar_t baudDivide)
Definition: gloveDevice.cc:266
bool cmdSetDigitalFilter(bool enable)
Definition: gloveDevice.cc:380


asr_cyberglove_lib
Author(s): Heller Florian, Meißner Pascal, Nguyen Trung, Yi Xie
autogenerated on Mon Jun 10 2019 12:40:38