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.

71 lines
2.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __PROTOCOL_LRF_3D_INTERNAL_MASTER_SERVER_COMMUNICATION__
  2. #define __PROTOCOL_LRF_3D_INTERNAL_MASTER_SERVER_COMMUNICATION__
  3. //aliona
  4. //https://www.pornhub.com/view_video.php?viewkey=ph5dffcb1983567
  5. #include "protocol.h"
  6. class protocolInternalLRF3D: public protocolParser {
  7. private:
  8. basicLogCollection *m_pLog;
  9. protected:
  10. int packetChecker( U8 *Buffer, size_t BufferSize );
  11. protocolPackage *packetExtractor( U8 *Buffer, size_t BufferSize );
  12. inline int FinishUpPackage( U8 *Buffer, size_t Size ){
  13. Buffer[0] = 0xAA;
  14. Buffer[1] = ((Size - 3) >> 8) | SEND_TAG;
  15. Buffer[2] = (Size - 3) & 0xFF;
  16. Buffer[Size] = checksumLGS(Buffer, Size);
  17. return Size + 1;
  18. };
  19. public:
  20. protocolInternalLRF3D();
  21. virtual ~protocolInternalLRF3D();
  22. bool create(void);
  23. };
  24. #ifdef PRU_SLAVE
  25. class protocolInternalLRF3D_SLAVE: public protocolInternalLRF3D{
  26. private:
  27. basicLogCollection *m_pLog;
  28. config_setting_t *m_pSettings;
  29. CSTR m_pMasterAddress;
  30. uint16_t m_nMasterPort;
  31. uint8_t m_bFailureReason;
  32. uint32_t m_nStatus;
  33. clientPort *m_pPort;
  34. bool m_bSettingsIsLoadded;
  35. bool sendTrasholdData( uint8_t lrf_id, uint32_t dataIdx = 0 );
  36. bool sendTargets( void );
  37. bool sendStatus( void );
  38. protected:
  39. virtual bool packetHandler( protocolPackage *Package );
  40. public:
  41. explicit protocolInternalLRF3D_SLAVE( config_setting_t *Settings = NULL );
  42. virtual ~protocolInternalLRF3D_SLAVE();
  43. bool create( void );
  44. bool setTrasholdData( uint8_t lrf_id, uint32_t *ptr );
  45. bool enqueueTarget( void );
  46. uint8_t getFailureReason( void ){ return m_bFailureReason; };
  47. };
  48. #else
  49. class protocolInternalLRF3D_MASTER: public protocolInternalLRF3D{
  50. private:
  51. basicLogCollection *m_pLog;
  52. config_setting_t *m_pSettings;
  53. protected:
  54. bool packetHandler( protocolPackage *Package );
  55. public:
  56. explicit protocolInternalLRF3D_MASTER( config_setting_t *Settings = NULL );
  57. virtual ~protocolInternalLRF3D_MASTER();
  58. bool create(void);
  59. bool ackDataSegment( uint32_t dataIdx = 0 );
  60. bool ackTargets( uint32_t pkgId );
  61. bool requestTargets(void);
  62. bool requestTrasholdData( uint8_t lrf_id );
  63. bool requestStatus( void );
  64. };
  65. #endif
  66. #endif