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.

150 lines
5.9 KiB

​
​
5 years ago
​
​
​
​
​
​
​
4 years ago
4 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
5 years ago
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
5 years ago
​
5 years ago
5 years ago
5 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
  1. #ifndef __OBJECT_NET_NODE_2D_HEADERS__
  2. #define __OBJECT_NET_NODE_2D_HEADERS__
  3. #include "rgooseNodeSensor.h"
  4. #include "../components/base/basicObject.h"
  5. #include "../components/base/basicMutex.h"
  6. #include "../components/base/basicThread.h"
  7. #include "../components/base/basicLogCollection.h"
  8. #include "../components/base/basicEventHeap.h"
  9. #include "../components/base/basicPosition.h"
  10. #include "../components/object/objectSystemAnchor.h"
  11. #include "../components/base/basicSettingsProvider.h"
  12. #include "../alg/lgs/mask.h"
  13. #include "../data/protocol/protocolLGS2D.h"
  14. #define LGS_DEFAULT_SLEEP_TIME 100
  15. #define LGS_ALERT_SLEEP_TIME 1
  16. #define LGS_DEFAULT_TO_COUNTER 10
  17. #define LGS_INITIAL_FLIPS 8
  18. #define ANODE_WM_2D_BEFORE_START 0
  19. #define ANODE_WM_2D_CREATE_PORT 1
  20. #define ANODE_WM_2D_CONNECT 2
  21. #define ANODE_WM_2D_WAIT_CONNECT 3
  22. #define ANODE_WM_2D_SET_INIT_MODE 4
  23. #define ANODE_WM_2D_GET_SERIAL_NUM 6
  24. #define ANODE_WM_2D_GET_VERSION 8
  25. #define ANODE_WM_2D_GET_DETECTION_PROFILE 10
  26. #define ANODE_WM_2D_GET_MASTER_PARAM 12
  27. #define ANODE_WM_2D_GET_SLAVE_PARAM 14
  28. #define ANODE_WM_2D_GET_MASK_INFO 16
  29. #define ANODE_WM_2D_SET_MASK_INFO 18
  30. #define ANODE_WM_2D_SET_BORDER_MODE 32
  31. #define ANODE_WM_2D_GET_FAST_DRAW 34
  32. #define ANODE_WM_2D_SET_DETECTION_MODE 36
  33. #define ANODE_WM_2D_SET_FILESYSTEM_MODE 38
  34. #define ANODE_WM_2D_FS_TRANSFER_MODE 39
  35. #define ANODE_WM_2D_SET_SHADOW_DONE 40
  36. #define ANODE_WM_2D_GET_SHADOW_POLY_INFO 41
  37. #define ANODE_WM_2D_GET_SHADOW_POLY_POINT 43
  38. #define ANODE_WM_2D_SET_SHADOW_POLY_INFO 45
  39. #define ANODE_WM_2D_SET_SHADOW_POLY_POINT 47
  40. #define ANODE_WM_2D_SET_SHADOW_RAY_LINE 48
  41. #define ANODE_WM_2D_SET_SHADOW_RAY 49
  42. #define ANODE_WM_2D_SET_GETFILE_MODE 50
  43. #define ANODE_WM_2D_SEND_GETFILE_MODE 52
  44. #define ANODE_WM_2D_SET_MASTER_PARAM 58
  45. #define ANODE_WM_2D_SET_SLAVE_PARAM 59
  46. #define ANODE_WM_2D_ISSUE_FULL_RESET 64
  47. #define ANODE_WM_2D_ISSUE_RESET 66
  48. #define ANODE_WM_2D_PING 128
  49. #define ANODE_WM_2D_PONG 129
  50. #define ANODE_WM_2D_SLEEP_AND_RECONNECT 130
  51. #define ANODE_WM_2D_WAIT_DEVICE_REPLAY 254
  52. #define ANODE_WM_2D_WAIT_CHECK_REPLAY 255
  53. #define ANODE_2D_MAX_DRAW_ANGLES 6000
  54. typedef struct S_SHADOW_IO_HELPER{
  55. uint16_t m_nCurrentPolygon;
  56. uint16_t m_nCurrentPoint;
  57. uint16_t m_nCurrentRayLine;
  58. uint16_t m_nCurrentRay;
  59. uint8_t m_bSequence;
  60. }SHADOW_IO_HELPER;
  61. typedef struct S_GETFILE_IO_HELPER{
  62. uint32_t fileSize;
  63. uint32_t index;
  64. char destName[33];
  65. char sourceName[33];
  66. uint8_t state;
  67. FILE * fd;
  68. uint8_t data[250];
  69. uint8_t data_size;
  70. }GETFILE_IO_HELPER;
  71. typedef struct S_TEST_POINT{
  72. float x;
  73. float y;
  74. }TEST_POINT;
  75. class ARGUS_2DSensor: public argusNodeSensor, public basicThread, public protocolLGS_2D{
  76. private:
  77. basicLogCollection * m_pLog;
  78. basicEventHeap * m_pEventHeap;
  79. basicEventClassID m_eSensorClass;
  80. uint8_t m_bPortType;
  81. basicTransport * m_pPort;
  82. uint8_t m_bWM;
  83. uint8_t m_bOWM;
  84. basicMutex m_mWMProtector;
  85. uint8_t m_bDeviceWM;
  86. uint32_t m_nSleepTime;
  87. uint16_t m_bTimeOutCounter;
  88. uint8_t m_bInitialFlips;
  89. uint16_t m_nCurrentAngle;
  90. uint8_t m_bDrawType;
  91. uint8_t m_bOpRetryCnt;
  92. uint32_t m_nProcessingCmdId;
  93. uint32_t m_vDrawRanges[ANODE_2D_MAX_DRAW_ANGLES];
  94. bool m_bDeviceIsSynced;
  95. bool m_bSerialStringValid;
  96. bool m_bVersionStringValid;
  97. char m_tSN[65];
  98. char m_tSV[129];
  99. char m_sCurrentFile[MAX_PATH];
  100. uint32_t m_nUploadID;
  101. uint8_t m_nActiveDetectionProfile;
  102. //Shadow
  103. SHADOW_IO_HELPER m_sShadowHelper;
  104. SHADOW m_sShadow;
  105. //GetFile
  106. GETFILE_IO_HELPER m_sGetFileHelper;
  107. TARGET_DATA * prepareTargetData( uint16_t AZ, uint16_t RANGE, uint32_t WIDTH, uint8_t LRFID = 0 );
  108. //void saveRawDrawData( uint16_t alngles );
  109. uint8_t getWM( void );
  110. void setWM( uint8_t MD );
  111. void cleanupDeviceStructures();
  112. CSTR generateSettingFile();
  113. void cleanShadowStructs();
  114. bool PtInPolygons( TEST_POINT& point, uint8_t F );
  115. bool PtInPolygon( SHADOW_POLY& Poly, TEST_POINT& point );
  116. bool rasterizeShadow();
  117. #ifdef DEBUG_EXTRA
  118. void makeShadowPic( CSTR picname );
  119. #endif
  120. protected:
  121. virtual bool packetHandler( protocolPackage *Package );
  122. virtual void m_fThreadProc( void );
  123. public:
  124. explicit ARGUS_2DSensor( uint32_t id );
  125. ~ARGUS_2DSensor();
  126. virtual bool startService();
  127. virtual bool stopService();
  128. virtual bool validate();
  129. virtual void simulateTarget( void );
  130. };
  131. #endif