urgManualCapture.h
Go to the documentation of this file.00001 #ifndef URG_MANUAL_CAPTURE_H
00002 #define URG_MANUAL_CAPTURE_H
00003
00013 #include "urgCapture.h"
00014 #include "connectionDevice.h"
00015 #include <vector>
00016
00017
00021 class URGManualCapture : public URGCapture {
00022 friend class URGCtrlTest;
00023
00024 enum {
00025 DefaultTimeout = 240,
00026 BufferSize = 3072,
00027
00028 OneDataByte = 3,
00029 };
00030 ConnectionDevice* con;
00031 std::string error_message;
00032 long capture_times;
00033 int oneData_byte;
00034 char recv_buffer[BufferSize];
00035 int Timeout;
00036 bool isLF(char ch);
00037 unsigned char encode6bit(char ch);
00038 int adjustIndex(int index, int add);
00039 int recvScanData(long data[], int first, int last, int group,
00040 const char* send_str, URGInterface::urgParams_t& params,
00041 unsigned long* raw_ticks);
00042
00043 protected:
00044 bool laser_on;
00045 int remain_byte;
00046 char remain_data[3];
00047 bool enableTimestamp;
00048 long decode(const char* data, int data_byte);
00049
00050 std::vector<long> recv_data;
00051 int recvCaptureData(long* data, size_t max_size, unsigned long* timestamp,
00052 URGInterface::urgParams_t& params);
00053 int readLine(char *buffer, int timeout);
00054 int addRecvData(const char buffer[]);
00055
00056 public:
00057 URGManualCapture(void);
00058 virtual ~URGManualCapture(void);
00059
00060 const char* what(void);
00061 int connect(const char* device, long baudrate);
00062 int connectSocket(const char* host, short port);
00063 void disconnect(void);
00064 bool isConnected(void);
00065 void set_recvTimeout(int timeout);
00066 void setTimestampMode(bool withTimestamp);
00067 virtual int capture(long length[],
00068 int first_index, int last_index, int group,
00069 URGInterface::urgParams_t& params,
00070 unsigned long* raw_timestamp = NULL);
00071 int getCaptureTimes(void);
00072 int send(const char* data, int size);
00073 int recv(char* data, int maxsize, long timeout);
00074 int recv_line(char* data, int maxsize, long timeout);
00075 int laser(bool on);
00076 };
00077
00078 #endif
00079