You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

7 years ago
​
​
​
7 years ago
​
​
​
6 years ago
​
6 years ago
​
​
7 years ago
​
​
​
​
7 years ago
​
​
​
7 years ago
​
​
7 years ago
​
​
7 years ago
​
​
  1. #ifndef __BASIC_TNSPORT_HEADERS__
  2. #define __BASIC_TNSPORT_HEADERS__
  3. #include <vector>
  4. #include <algorithm>
  5. #include "basicMutex.h"
  6. #include "basicLogCollection.h"
  7. #ifdef DEBUG
  8. //#ifndef DUBUG_COMMUNICATION
  9. //#define DUBUG_COMMUNICATION
  10. //#endif
  11. #endif
  12. class protocolParser;
  13. typedef std::vector<protocolParser *> parseQueue;
  14. class basicTransport{
  15. private:
  16. basicLogCollection * m_pLog;
  17. protected:
  18. parseQueue m_vParsers;
  19. basicMutex m_mQueueProtectorMutex;
  20. basicMutex m_mBufferProtectorMutex;
  21. CONNECTION_STATUS m_eConnectionStatus;
  22. public:
  23. basicTransport();
  24. ~basicTransport();
  25. virtual bool sendData(unsigned char *Data, int DataSize){ return true; };
  26. virtual bool reconnect( void ){ return false; };
  27. bool addRecipient( protocolParser *ProtoParser );
  28. bool removeRecipient( protocolParser *ProtoParser );
  29. bool getStatus( void ){ return m_eConnectionStatus == CS_CONNECTED; };
  30. void setConnectionStatus( CONNECTION_STATUS ES);
  31. CONNECTION_STATUS getConnectionStatus( void );
  32. virtual int getRawHandle(void){ return -1;};
  33. };
  34. #endif