All Classes Namespaces Files Functions Variables Enumerations Enumerator
libs/connection/CustomConnection.h
Go to the documentation of this file.
00001 #ifndef QRK_CUSTOM_CONNECTION_H
00002 #define QRK_CUSTOM_CONNECTION_H
00003 
00013 #include "Connection.h"
00014 #include <string>
00015 #include <memory>
00016 
00017 
00018 namespace qrk
00019 {
00021     class CustomConnection : public Connection
00022     {
00023     public:
00024         enum { NoTimeout = -1 };
00025 
00026         CustomConnection(void);
00027         ~CustomConnection(void);
00028 
00029         const char* what(void) const;
00030 
00031         bool connect(const char* device, long baudrate);
00032         void disconnect(void);
00033         bool setBaudrate(long baudrate);
00034         long baudrate(void) const;
00035         bool isConnected(void) const;
00036         int send(const char* data, size_t count);
00037         int receive(char* data, size_t count, int timeout);
00038         size_t size(void) const;
00039         void flush(void);
00040         void clear(void);
00041         void ungetc(const char ch);
00042 
00043         void setReadData(const char* data, size_t count);
00044         void setReadData(std::string data);
00045         void readSendData(char* data, size_t count);
00046 
00047     private:
00048         CustomConnection(const CustomConnection& rhs);
00049         CustomConnection& operator = (const CustomConnection& rhs);
00050 
00051         struct pImpl;
00052         std::auto_ptr<pImpl> pimpl;
00053     };
00054 }
00055 
00056 #endif /* !QRK_CUSTOM_CONNECTION_H */