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.

61 lines
1.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __PROTOCOL_LGS_3D_99sd8_HEADERS__
  2. #define __PROTOCOL_LGS_3D_99sd8_HEADERS__
  3. #include "../../alg/lgs/detectorStructures.h"
  4. #include "protocol.h"
  5. #include "protocolLGS_data.h"
  6. // #define DUBUG_COMMUNICATION
  7. class protocolLGS_3D : public protocolParser
  8. {
  9. private:
  10. basicLogCollection * m_pLog;
  11. protected:
  12. basicMutex m_mBufferProtector;
  13. uint8_t m_pWorkingBuffer[4096];//ToDo: May Be moved to each package creation function .... or must be protected by mutex .... either way must be changed
  14. uint8_t m_bDeviceID;
  15. inline int FinishUpPackage(uint8_t * Buffer, size_t Size, uint8_t DeviceID)
  16. {
  17. Buffer[0] = 0x55;
  18. Buffer[1] = ((Size - 3) >> 8) | SEND_TAG;
  19. Buffer[2] = (Size - 3) & 0xFF;
  20. Buffer[3] = DeviceID;
  21. Buffer[Size] = checksumLGS(Buffer, Size);
  22. return Size + 1;
  23. }
  24. int packetChecker(uint8_t * Buffer, size_t BufferSize);
  25. protocolPackage * packetExtractor(uint8_t * Buffer, size_t BufferSize);
  26. public:
  27. explicit protocolLGS_3D(uint8_t DeviceID = 0);
  28. virtual ~protocolLGS_3D();
  29. virtual bool create(void)
  30. {
  31. return protocolParser::create();
  32. }
  33. uint8_t getProtocolID(void)
  34. {
  35. return m_bDeviceID;
  36. }
  37. bool setProtocolID(uint8_t DeviceID)
  38. {
  39. m_bDeviceID = DeviceID;
  40. return true;
  41. }
  42. bool sendACK(uint8_t CMD);
  43. bool sendNACK(uint8_t CMD);
  44. bool sendIDONK(uint8_t CMD);
  45. };
  46. #endif