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 protected:
00031
00032 virtual unsigned char m_receiveByte( bool wait );
00033 void save2queue( unsigned char*msg, int len, int bnum );
00034 bool remove_echo( unsigned char tb[], int len );
00035 void m_read( int tmsec );
00036
00038 unsigned char tbuf[ComPort::BufSize];
00039
00040 std::queue<unsigned char> wq;
00041 std::queue<unsigned char> rq;
00043 int gpio_num;
00044 bool tmit_ctrl_on;
00045 PassiveTimer ptRecv;
00046 int tout_msec;
00047 };
00048
00049 #endif // _COMPORT_E_H_
00050