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.

80 lines
2.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASICCOMMUNICATIONPROTOCOL_H_INCL__
  2. #define __BASICCOMMUNICATIONPROTOCOL_H_INCL__
  3. #include "basicCommunicationTransport.h"
  4. #include "basicEvtDispatcher.h"
  5. /**
  6. * TODO: Add class description
  7. *
  8. * @author gagua
  9. */
  10. class basicCommunicationProtocol
  11. {
  12. protected:
  13. int m_iTypeID;
  14. bool m_bTransportIsBound;
  15. basicCommunicationTransport * m_pChannel;
  16. public:
  17. // Constructor
  18. basicCommunicationProtocol();
  19. // Destructor
  20. virtual ~basicCommunicationProtocol();
  21. // Copy constructor
  22. // TODO: Uncomment the copy constructor when you need it.
  23. // basicCommunicationProtocol(const basicCommunicationProtocol& src);
  24. // Assignment operator
  25. // TODO: Uncomment the assignment operator when you need it.
  26. // basicCommunicationProtocol& operator=(const basicCommunicationProtocol& src);
  27. virtual int probeData(unsigned char * Data, int DataSize) {}
  28. virtual int parseData(unsigned char * Data, int DataSize) {}
  29. virtual bool getPackage(unsigned char * Data, int DataSize)
  30. {
  31. return NULL;
  32. }
  33. virtual void sendPackage(unsigned char * Data, int DataSize) {}
  34. bool bindToCommunicationChannel(basicCommunicationTransport * Channel);
  35. };
  36. typedef std::vector<basicCommunicationProtocol> ProtocolQueue;
  37. typedef std::vector<basicCommunicationProtocol *> pProtocolQueue;
  38. // Constructor implementation
  39. inline basicCommunicationProtocol::basicCommunicationProtocol()
  40. {
  41. m_bTransportIsBound = false;
  42. m_pChannel = NULL;
  43. }
  44. // Destructor implementation
  45. inline basicCommunicationProtocol::~basicCommunicationProtocol() {}
  46. // TODO: Uncomment the copy constructor when you need it.
  47. // inline basicCommunicationProtocol::basicCommunicationProtocol(const basicCommunicationProtocol& src)
  48. //{
  49. // // TODO: copy
  50. //}
  51. // TODO: Uncomment the assignment operator when you need it.
  52. // inline basicCommunicationProtocol& basicCommunicationProtocol::operator=(const basicCommunicationProtocol& rhs)
  53. //{
  54. // if (this == &rhs) {
  55. // return *this;
  56. // }
  57. //
  58. // // TODO: assignment
  59. //
  60. // return *this;
  61. //}
  62. #endif // __BASICCOMMUNICATIONPROTOCOL_H_INCL__