urgCapture.h

Go to the documentation of this file.
00001 #ifndef URG_CAPTURE_H
00002 #define URG_CAPTURE_H
00003 
00013 #include "urgInterface.h"
00014 #include <exception>
00015 #include <string>
00016 
00017 
00021 class URGCapture {
00022 public:
00023   enum {
00024     HeaderError = -2,
00025     RecvSizeError = -3,
00026     MissmatchLF = -4,
00027   };
00028   virtual ~URGCapture(void) {}
00029 
00035   virtual const char* what(void) = 0;
00036 
00048   virtual int connect(const char* device, long baudrate) = 0;
00049 
00061   virtual int connectSocket(const char* host, short port) = 0;
00062 
00068   virtual void disconnect(void) = 0;
00069 
00075   virtual bool isConnected(void) = 0;
00076 
00082   virtual void set_recvTimeout(int timeout) = 0;
00083 
00091   virtual void setTimestampMode(bool withTimestamp) = 0;
00092 
00110   virtual int capture(long length[],
00111                       int first_index, int last_index, int group,
00112                       URGInterface::urgParams_t& params,
00113                       unsigned long* raw_timestamp = NULL) = 0;
00114 
00120   virtual int getCaptureTimes(void) = 0;
00121 
00133   virtual int send(const char* data, int size) = 0;
00134 
00147   virtual int recv(char* data, int maxsize, long timeout = 0) = 0;
00148 
00162   virtual int recv_line(char* data, int maxsize, long timeout = 0) = 0;
00163 
00164   virtual int laser(bool on) = 0;
00165 };
00166 
00167 
00171 class URGCapture_Exception : public std::exception {
00172   std::string error_message;
00173 
00174 public:
00178   URGCapture_Exception(const char* message) throw ()
00179     : error_message(message) {}
00180   virtual ~URGCapture_Exception(void) throw () {}
00181 
00187   virtual const char* what(void) const throw() {
00188     return error_message.c_str();
00189   }
00190 };
00191 
00192 #endif /* !URG_CAPTURE_H */
00193 

Generated on Mon Apr 13 22:52:04 2009 by  doxygen 1.5.7.1