ComPort485F.h
00001 #ifndef _COMPORT_485F_H_
00002 #define _COMPORT_485F_H_
00003
00004 #include <queue>
00005 #include "ComPort.h"
00006 #include "PassiveTimer.h"
00007
00019 class ComPort485F:
00020 public ComPort
00021 {
00022 public:
00023
00024 ComPort485F( std::string comDevice, int gpio_num, bool tmit_ctrl=false );
00025
00026 virtual void sendByte( unsigned char x );
00027 virtual void setTimeout( int timeout );
00028 virtual int sendBlock( unsigned char*msg,int len );
00029
00030 virtual void cleanupChannel();
00031 virtual void reopen();
00032
00033 protected:
00034
00035 virtual unsigned char m_receiveByte( bool wait );
00036 void save2queue( unsigned char*msg, int len, int bnum );
00037 bool remove_echo( unsigned char tb[], int len );
00038 void m_read( int tmsec );
00039
00041 unsigned char tbuf[ComPort::BufSize];
00042
00043 std::queue<unsigned char> wq;
00044 std::queue<unsigned char> rq;
00046 int gpio_num;
00047 bool tmit_ctrl_on;
00048 PassiveTimer ptRecv;
00049 int tout_msec;
00050 };
00051
00052 #endif // _COMPORT_E_H_
00053