41 pthread_mutexattr_t mutex_attr;
42 pthread_mutexattr_init(&mutex_attr);
43 pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
46 pthread_mutexattr_destroy(&mutex_attr);
51 printf(
"open_serial() failed.\n");
61 printf(
"Error: cmdGetHwSensorMask(&mask) failed.\n");
66 printf(
"Error: cmdSetSwSensorMask(mask) failed.\n");
74 printf(
"Error: cmdGetNbSensorsTotal(&n) failed.\n");
79 printf(
"Error: cmdSetNbSensorsEnabled(n) failed.\n");
87 printf(
"Error: cmdGetGloveStatus(&enable) failed.\n");
94 printf(
"Error: cmdGetTimeStamp(&enable) failed.\n");
99 printf(
"Try to switch off (and on again!) the glove hardware.\n");
219 for (
int i = 0; i < n; i++)
443 printf(
"Received wrong data from stream\n");
623 *n = (
unsigned char) MAX_SENSORS;
640 result = (res[0] ==
'^' && res[1] == cmd && res[2] ==
CR && res[3] ==
LF 791 printf(
"--- Glove Current Status ---\n");
793 printf(
"Glove Status Byte: %s\n",
796 printf(
"Errors detected: %s\n",
error ?
"no" :
"yes");
802 int main(
int argc,
char **argv)
810 fprintf(stderr,
"Testing gloveDevice\n");
812 printf(
"testing gloveDevice\n");
bool cmdSetCalibrateGain(uchar_t index, uchar_t gain)
bool cmdGetWristToggle(bool *enable)
bool cmdSetWristToggle(bool enable)
bool cmdSetParameterFlags(parameterFlags_t flags)
bool readResponseGet(uchar_t c)
bool cmdGetConnectStatus(statusConnect_t *status)
bool cmdGetSensorValuesSync(vector_t values, uchar_t *n, bool *errorSync, gloveStatusByte_t *gloveStatusByte)
bool cmdSetControlLight(bool enable)
bool cmdSetSamplePeriod(samplePeriod_t period)
long write_serial(int tty_fd, unsigned char *p_buffer, long nb_byte)
bool cmdGetCalibrateAll(vector_t offset, vector_t gain)
void close_serial(int tty_fd)
bool cmdGetChar(uchar_t name, uchar_t *val)
bool cmdGetSensorDummyValues(vector_t values, uchar_t *n, statusQuery_t *query, gloveStatusByte_t *gloveStatusByte)
void setGloveStatusByte(bool activate)
bool cmdSetActuateAll(vector_t values)
void setSensorSize(uchar_t n)
bool cmdGetWristLight(bool *enable)
bool cmdGetSensorValues(vector_t values, uchar_t *n, statusQuery_t *query, gloveStatusByte_t *gloveStatusByte)
bool cmdSetGloveStatus(bool enable)
bool cmdGetActuateAll(vector_t values)
bool cmdGetHand(bool *rightHand)
void getString(vector_t s, int n)
int main(int argc, char **argv)
bool cmdSetActuate(int n, vector_t index, vector_t values)
bool cmdGetQuantized(bool *enable)
bool cmdSetNbSensorsEnabled(uchar_t n)
bool readResponseSet(uchar_t c)
bool cmdSetChar(uchar_t name, uchar_t val)
bool cmdSetWristLight(bool enable)
bool cmdSetQuantized(bool enable)
bool internalCmd(uchar_t cmd)
bool cmdSetTimeStamp(bool enable)
bool cmdReinitializeCyberGlove()
bool cmdGetTimeStamp(bool *enable)
bool cmdSetCalibrateAll(vector_t offset, vector_t gain)
bool cmdGetGloveStatus(bool *enable)
bool cmdGetNbSensorsEnabled(uchar_t *n)
bool cmdGetBaudRate(uchar_t *baudDivide)
bool cmdSetStreamValues(bool enable)
bool init(const char *serialDev)
bool cmdGetBinarySync(bool *enable)
bool cmdGetControlLight(bool *enable)
bool cmdRestartFirmware()
bool cmdGetParameterFlags(parameterFlags_t *flags)
bool cmdGetGloveVersion(gloveVersion_t *version)
void setTimeStamp(bool activate)
bool cmdGetDigitalFilter(bool *enable)
bool cmdSetBinarySync(bool enable)
bool cmdSetCalibrateOffset(uchar_t index, uchar_t offset)
bool cmdGetHwSensorMask(sensorMask_t *mask)
int open_serial(const char *p_tty_name)
long read_serial(int tty_fd, unsigned char *p_buffer, long nb_bytes_max)
pthread_mutex_t serial_lock
bool cmdGetNbSensorsTotal(uchar_t *n)
bool cmdSetSwSensorMask(sensorMask_t mask)
bool cmdGetSamplePeriod(samplePeriod_t *period)
bool cmdGetBool(uchar_t name, bool *val)
void sendString(vector_t s, int n)
bool cmdGetSwSensorMask(sensorMask_t *mask)
bool cmdSetBaudRate(uchar_t baudDivide)
bool cmdSetDigitalFilter(bool enable)