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.

38 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
  1. #ifndef __PROTOCOL_LGS_3D_99sd8_HEADERS__
  2. #define __PROTOCOL_LGS_3D_99sd8_HEADERS__
  3. #include "protocol.h"
  4. #include "../../alg/lgs/detectorStructures.h"
  5. #include "protocolLGS_data.h"
  6. //#define DUBUG_COMMUNICATION
  7. class protocolLGS_3D: public protocolParser{
  8. private:
  9. basicLogCollection * m_pLog;
  10. protected:
  11. basicMutex m_mBufferProtector;
  12. uint8_t m_pWorkingBuffer[MAXIMAL_SOCKET_PACKET_LENGTH];
  13. uint8_t m_bDeviceID;
  14. inline int FinishUpPackage( uint8_t *Buffer, size_t Size, uint8_t DeviceID ){
  15. Buffer[0] = 0x55;
  16. Buffer[1] = ((Size - 3) >> 8) | SEND_TAG;
  17. Buffer[2] = (Size - 3) & 0xFF;
  18. Buffer[3] = DeviceID;
  19. Buffer[Size] = checksumLGS(Buffer, Size);
  20. return Size + 1;
  21. };
  22. int packetChecker( uint8_t *Buffer, size_t BufferSize);
  23. protocolPackage * packetExtractor( uint8_t *Buffer, size_t BufferSize);
  24. public:
  25. explicit protocolLGS_3D( uint8_t DeviceID = 0 );
  26. virtual ~protocolLGS_3D();
  27. virtual bool create(void){ return protocolParser::create(); };
  28. uint8_t getProtocolID(void) { return m_bDeviceID; };
  29. bool setProtocolID( uint8_t DeviceID ){ m_bDeviceID = DeviceID; return true; };
  30. bool sendACK( uint8_t CMD );
  31. bool sendNACK( uint8_t CMD );
  32. bool sendIDONK( uint8_t CMD );
  33. };
  34. #endif