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.

68 lines
2.1 KiB

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