rmp_ftd2xx.h
Go to the documentation of this file.
00001 
00038 #ifndef RMP_FTD2XX_H
00039 #define RMP_FTD2XX_H
00040 
00041 #include "segwayrmp/impl/rmp_io.h"
00042 
00043 #include "segwayrmp/ftd2xx.h"
00044 
00045 namespace segwayrmp {
00046 
00050 typedef enum {
00051     by_serial_number   = 0, 
00052     by_description     = 1, 
00053     by_index           = 2, 
00054     by_none            = 3  
00055 } ConfigurationType;
00056 
00057 std::vector<FT_DEVICE_LIST_INFO_NODE> enumerateUSBDevices();
00058 
00059 class FTD2XXRMPIO : public RMPIO {
00060 public:
00064     FTD2XXRMPIO();
00065     ~FTD2XXRMPIO();
00066     
00070     void connect();
00071     
00075     void disconnect();
00076     
00084     int read(unsigned char* buffer, int size);
00085     
00093     int write(unsigned char* buffer, int size);
00094     
00101     void configureUSBBySerial(std::string serial_number, int baudrate);
00102     
00109     void configureUSBByDescription(std::string description, int baudrate);
00110     
00118     void configureUSBByIndex(unsigned int device_index, int baudrate);
00119     
00120 private:
00121     std::vector<FT_DEVICE_LIST_INFO_NODE> enumerateUSBDevices_();
00122     void connectBySerial();
00123     void connectByDescription();
00124     void connectByIndex();
00125     
00126     bool configured;
00127     
00128     bool is_open;
00129     
00130     ConfigurationType config_type;
00131     
00132     std::string port_serial_number;
00133     std::string port_description;
00134     unsigned int port_index;
00135     
00136     int baudrate;
00137     
00138     FT_HANDLE usb_port_handle;
00139 };
00140 
00141 }
00142 
00143 #endif


libsegwayrmp
Author(s): William Woodall
autogenerated on Wed Aug 26 2015 12:23:18