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.

39 lines
1.0 KiB

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