18 #ifndef FSPINCHGLOVE_H
19 #define FSPINCHGLOVE_H
31 namespace vreckoDP_base {
34 #define STARTBYTE (char)0x80
35 #define STARTTBYTE (char)0x81
36 #define STARTXBYTE (char)0x82
37 #define ENDBYTE (char)0x8F
39 #define CONNECTBYTE (char)0x87
40 #define CLOSEBYTE (char)0x88
41 #define DEF_PGI_PORT 6666
42 #define DEF_PGI_SERIAL "/dev/ttyS1"
44 #define PGI_MAX_PACKET_LEN 14
53 #define L_THUMB (int)0x0010
54 #define L_INDEX (int)0x0008
55 #define L_MIDDLE (int)0x0004
56 #define L_RING (int)0x0002
57 #define L_PINKIE (int)0x0001
59 #define R_THUMB (int)0x0010
60 #define R_INDEX (int)0x0008
61 #define R_MIDDLE (int)0x0004
62 #define R_RING (int)0x0002
63 #define R_PINKIE (int)0x0001
70 #define if_ok( param ) if( ( param ) == OK )
71 #define if_notok( param) if( ( param ) != OK )
72 #define if_err( param ) if( ( param ) < 0 )
73 #define if_null( param ) if( ( param ) == NULL )
74 #define if_nonull( param ) if( ( param ) != NULL )
77 int (*callback) (
void*);
88 virtual int openDevice(
void);
89 int closeDevice(
void);
93 int initPort(
char *port);
94 int *getGesture(
void);
95 void setGestureFunc(
int (*func) (
void*),
void *g_object,
int t1,
96 int t2 = 0,
int t3 = 0,
int t4 = 0,
int t5 = 0);
97 int activateGesture(
int t1,
int t2 = 0,
int t3 = 0,
int t4 = 0,
int t5 = 0);
98 int deactivateGesture(
int t1,
int t2 = 0,
int t3 = 0,
int t4 = 0,
int t5 = 0);
99 int checkGesture(
void);
103 void setReleaseFunc(
int (*func) (
void*),
void *data);
104 void printConf(
void);
105 void printGests(
void);
120 int (*relFunc) (void);
125 void pgd_close(
void);
126 int getByte(
char *buf);
127 int getPacket(
char *buf);
128 int pgdRead(
char *buf,
int n);
129 int pgdComm(
const char buf[2],
char *reply);
132 int getData(
char *buf,
int len,
int *time_st );
133 int checkConnection(
void);
134 void printBuf(
const char *buf,
int length );
135 void delay(
int msec);
138 void invNulls(
char *buf,
int length);
139 void swapBytes(
int &num );