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.

126 lines
3.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __PROTOCOL_BSCH_VMS_HEADER__
  2. #define __PROTOCOL_BSCH_VMS_HEADER__
  3. #ifdef __linux__
  4. #include <features.h>
  5. #endif
  6. #include "../../components/base/basicFunctionality.h"
  7. #include "../../components/base/basicLogCollection.h"
  8. #include "../../components/base/basicSettingsProvider.h"
  9. #include "../../components/base/basicPosition.h"
  10. #include "protocolHTTP.h"
  11. #include "../data/json/json_tool.h"
  12. #include <json/reader.h>
  13. #include <json/value.h>
  14. #include <json/writer.h>
  15. #include <strings.h>
  16. //#include "xmlParser.h"
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string>
  20. #include <sys/timeb.h>
  21. #include <sys/types.h>
  22. #include <time.h>
  23. #define SERVICE_URL_TEMPLATE_STATUS "/sensors/lidar%dd/%s/status"
  24. #define SERVICE_URL_TEMPLATE_FAULT "/sensors/lidar%dd/%s/fault"
  25. #define SERVICE_URL_TEMPLATE_EVENT "/sensors/lidar%dd/%s/event"
  26. #define SERVICE_URL_TEMPLATE_CALLBACK "/sensors/lidar%dd/%s/httpcallback"
  27. #define SERVICE_URL_TEMPLATE_CLOCKSYNC "/sensors/lidar%dd/%s/clocksync"
  28. /*
  29. {
  30. "EventID": "evt-7734-abc-123",
  31. "EventTime": "2026-04-19T10:00:01Z",
  32. "EventType": "IVA:ObjectInField",
  33. "DeviceID": "CAM-001",
  34. "DeviceName": "Perimeter_North",
  35. "EventState": "Active",
  36. "Priority": "High",
  37. "Description": "Person detected in restricted zone",
  38. "Metadata": {
  39. "IVAPro": {
  40. "ObjectType": "Person",
  41. "Confidence": 95,
  42. "Location": {
  43. "Latitude": 32.0853,
  44. "Longitude": 34.7818,
  45. "Altitude": 0
  46. },
  47. "BoundingBox": [100, 200, 300, 400]
  48. }
  49. }
  50. }
  51. */
  52. /**
  53. * TODO: Add class description
  54. *
  55. * @author gagua
  56. */
  57. class protocolBVMS : public protocolHTTP
  58. {
  59. private:
  60. basicLogCollection * m_pLog;
  61. CSTR m_pServerIP;
  62. int m_nServerPort;
  63. bool m_bCurrentStatus;
  64. CSTR buildURL(CSTR templ, int dim, CSTR devID);
  65. CSTR buildUniqID(void);
  66. bool buildClockSyncPackage(unsigned char * Buffer, int & BufferSize);
  67. bool buildCallBackPackage(unsigned char * Buffer, int & BufferSize, CSTR CallBackPath);
  68. bool buildStatusPackage(unsigned char * Buffer, int & BufferSize, bool Status);
  69. bool buildFaultPackage(unsigned char * Buffer, int & BufferSize, unsigned char Type, CSTR Description);
  70. bool buildEventPackage(unsigned char * Buffer, int & BufferSize, CSTR msgUID, int targetID, int Angle, int Range, int Width);
  71. protected:
  72. virtual bool packetHandler(protocolPackage * Package);
  73. public:
  74. // Constructor
  75. explicit protocolBVMS( CSTR server, uint16_t port );
  76. virtual ~protocolBVMS();
  77. virtual bool init()
  78. {
  79. return true;
  80. }
  81. bool Alarm( C3D_WGS84_LOC target_location ); // GeoLocation
  82. bool Alarm( C3D_DECART target_location ); // UTM
  83. bool VisibilityChanged(bool Worsened);
  84. bool StatusUpdate(void);
  85. void SetStatus(bool A)
  86. {
  87. m_bCurrentStatus = A;
  88. }
  89. bool ErrorReporting(int lvl, CSTR Descr);
  90. bool StartTimeSynch(void);
  91. #ifdef __linux__
  92. // bool FinishTimeSynch( unsigned long long *tVals );
  93. #else
  94. // bool FinishTimeSynch( unsigned __int64 *tVals );
  95. #endif
  96. bool SetupCallBack(CSTR CallBackPath);
  97. void setProtocolType(bool DeviceIs3D);
  98. void setScannerName(CSTR Name);
  99. };
  100. #ifdef __linux__
  101. unsigned long long getSHTimeValue(void);
  102. #else
  103. unsigned __int64 getSHTimeValue(void);
  104. #endif
  105. #endif