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.

41 lines
1.2 KiB

8 years ago
​
​
​
3 years ago
8 years ago
​
4 years ago
8 years ago
3 years ago
​
​
​
8 years ago
​
​
​
3 years ago
​
​
​
​
8 years ago
​
​
​
​
​
8 years ago
​
​
​
​
8 years ago
​
​
​
​
  1. #ifndef __TRANSPORT_SERIAL_HEADERS__
  2. #define __TRANSPORT_SERIAL_HEADERS__
  3. #include "../../components/base/basicDualThread.h"
  4. #include "../../components/base/basicMutex.h"
  5. #include "../../components/base/basicTransport.h"
  6. //#define DEBUG_COMMUNICATION
  7. #define MAXIMAL_SERIAL_PACKET_LENGTH 1024
  8. //#define PUSH_PULL_MODE
  9. #ifdef PUSH_PULL_MODE
  10. #define DEFAULT_PUSH_PULL_TO 200 //200 msec
  11. #endif
  12. class transportSerial: public basicTransport, public basicDualThread {
  13. private:
  14. basicLogCollection *m_pLog;
  15. #ifdef PUSH_PULL_MODE
  16. basicMutex m_mCmdSent;
  17. uint16_t m_nCmdSentTO;
  18. #endif
  19. basicMutex m_mIsBusy;
  20. void m_fThreadAProc(void);
  21. void m_fThreadBProc(void);
  22. protected:
  23. U8 * m_pInputBuffer;
  24. int m_nInputBufferSize;
  25. U8 * m_pOutputBuffer;
  26. int m_nOutputBufferSize;
  27. virtual int sendBlock(unsigned char *Data, int DataSize){ return 0;};
  28. virtual int recptBlock(unsigned char *Buffer, int *BufferLength){ return 0;};
  29. public:
  30. transportSerial();
  31. virtual ~transportSerial();
  32. bool sendData( unsigned char *Data, int DataSize );
  33. };
  34. #endif