Qt 4.8
Public Functions | Protected Functions | Private Functions | List of all members
QWSPcMouseSubHandler_serial Class Reference
Inheritance diagram for QWSPcMouseSubHandler_serial:
QWSPcMouseSubHandler QWSPcMouseSubHandler_mousesystems QWSPcMouseSubHandler_ms

Public Functions

 QWSPcMouseSubHandler_serial (int f)
 
- Public Functions inherited from QWSPcMouseSubHandler
void appendData (uchar *data, int length)
 
int buttonState () const
 
void closeIfNot (int &f)
 
int file () const
 
void initState ()
 
bool motionPending () const
 
 QWSPcMouseSubHandler (int f)
 
bool reliable () const
 
QPoint takeMotion ()
 
int takeWheel ()
 
UsageResult useData ()
 
void worse (int by=1)
 
virtual ~QWSPcMouseSubHandler ()
 

Protected Functions

void setflags (int f)
 
- Protected Functions inherited from QWSPcMouseSubHandler
virtual int tryData ()=0
 

Private Functions

void initSerial ()
 

Additional Inherited Members

- Public Types inherited from QWSPcMouseSubHandler
enum  UsageResult { Insufficient, Motion, Button }
 
- Protected Types inherited from QWSPcMouseSubHandler
enum  { max_buf =32 }
 
- Protected Variables inherited from QWSPcMouseSubHandler
int badness
 
int bstate
 
uchar buffer [max_buf]
 
int fd
 
int goodness
 
QPoint motion
 
int nbuf
 
int wheel
 

Detailed Description

Definition at line 315 of file qmousepc_qws.cpp.

Constructors and Destructors

◆ QWSPcMouseSubHandler_serial()

QWSPcMouseSubHandler_serial::QWSPcMouseSubHandler_serial ( int  f)
inline

Definition at line 317 of file qmousepc_qws.cpp.

318  {
319  initSerial();
320  }

Functions

◆ initSerial()

void QWSPcMouseSubHandler_serial::initSerial ( )
inlineprivate

Definition at line 348 of file qmousepc_qws.cpp.

349  {
350  int speed[4] = { B9600, B4800, B2400, B1200 };
351 
352  for (int n = 0; n < 4; n++) {
353  setflags(CSTOPB | speed[n]);
354  QT_WRITE(fd, "*q", 2);
355  usleep(10000);
356  }
357  }
#define QT_WRITE
Definition: qcore_unix_p.h:289

◆ setflags()

void QWSPcMouseSubHandler_serial::setflags ( int  f)
inlineprotected

Definition at line 323 of file qmousepc_qws.cpp.

324  {
325  termios tty;
326  if (tcgetattr(fd, &tty) == -1) {
327 #ifdef QWS_MOUSE_DEBUG
328  perror("QWSPcMouseSubHandler_serial: tcgetattr");
329 #endif
330  }
331  tty.c_iflag = IGNBRK | IGNPAR;
332  tty.c_oflag = 0;
333  tty.c_lflag = 0;
334  tty.c_cflag = f | CREAD | CLOCAL | HUPCL;
335 #ifdef Q_OS_LINUX
336  tty.c_line = 0;
337 #endif
338  tty.c_cc[VTIME] = 0;
339  tty.c_cc[VMIN] = 1;
340  if (tcsetattr(fd, TCSANOW, &tty) == -1) {
341 #ifdef QWS_MOUSE_DEBUG
342  perror("QWSPcMouseSubHandler_serial: tcgetattr");
343 #endif
344  }
345  }

The documentation for this class was generated from the following file: