Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

khepera_serial.h

Go to the documentation of this file.
00001 #ifndef KHEPERA_SERIAL_H
00002 #define KHEPERA_SERIAL_H
00003 
00004 #include <pthread.h>
00005 #include <termios.h>
00006 
00007 #define KHEPERA_DEFAULT_BAUD B38400
00008 #define KHEPERA_BUFFER_LEN 255
00009 #define KHEPERA_SERIAL_TIMEOUT_USECS 100000
00010 
00011 
00012 class KheperaSerial
00013 {
00014 public:
00015         
00016         KheperaSerial(char * port, int rate = KHEPERA_DEFAULT_BAUD);
00017         ~KheperaSerial();
00018 
00019         bool Open() {return fd >0;};
00020         int KheperaCommand(char command, int InCount, int * InValues, int OutCount, int * OutValues);
00021 
00022         void Lock();
00023         void Unlock();
00024 protected:
00025         // serial port descriptor
00026         int fd;
00027         struct termios oldtio;
00028         
00029         // read/write buffer
00030         char buffer[KHEPERA_BUFFER_LEN+1];
00031 
00032         int WriteInts(char command, int Count = 0, int * Values = NULL);
00033         int ReadInts(char Header, int Count = 0, int * Values = NULL);
00034         
00035         pthread_mutex_t lock;
00036 };
00037 
00038 #endif

Generated on Tue May 3 14:15:34 2005 for Player by doxygen 1.3.6