|
|
#ifndef __PROTOCOL_BSCH_VMS_HEADER__
#define __PROTOCOL_BSCH_VMS_HEADER__
#ifdef __linux__
#include <features.h>
#endif
#include "../../components/base/basicFunctionality.h"
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicPosition.h"
#include "protocolHTTP.h"
#include "../data/json/json_tool.h"
#include <json/reader.h>
#include <json/value.h>
#include <json/writer.h>
#include <strings.h>
//#include "xmlParser.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sys/timeb.h>
#include <sys/types.h>
#include <time.h>
#define SERVICE_URL_TEMPLATE_STATUS "/sensors/lidar%dd/%s/status"
#define SERVICE_URL_TEMPLATE_FAULT "/sensors/lidar%dd/%s/fault"
#define SERVICE_URL_TEMPLATE_EVENT "/sensors/lidar%dd/%s/event"
#define SERVICE_URL_TEMPLATE_CALLBACK "/sensors/lidar%dd/%s/httpcallback"
#define SERVICE_URL_TEMPLATE_CLOCKSYNC "/sensors/lidar%dd/%s/clocksync"
/*
{ "EventID": "evt-7734-abc-123", "EventTime": "2026-04-19T10:00:01Z", "EventType": "IVA:ObjectInField", "DeviceID": "CAM-001", "DeviceName": "Perimeter_North", "EventState": "Active", "Priority": "High", "Description": "Person detected in restricted zone", "Metadata": { "IVAPro": { "ObjectType": "Person", "Confidence": 95, "Location": { "Latitude": 32.0853, "Longitude": 34.7818, "Altitude": 0 }, "BoundingBox": [100, 200, 300, 400] } }}
*/
/**
* TODO: Add class description * * @author gagua */class protocolBVMS : public protocolHTTP{ private:
basicLogCollection * m_pLog; CSTR m_pServerIP; int m_nServerPort; bool m_bCurrentStatus; CSTR buildURL(CSTR templ, int dim, CSTR devID); CSTR buildUniqID(void); bool buildClockSyncPackage(unsigned char * Buffer, int & BufferSize); bool buildCallBackPackage(unsigned char * Buffer, int & BufferSize, CSTR CallBackPath); bool buildStatusPackage(unsigned char * Buffer, int & BufferSize, bool Status); bool buildFaultPackage(unsigned char * Buffer, int & BufferSize, unsigned char Type, CSTR Description); bool buildEventPackage(unsigned char * Buffer, int & BufferSize, CSTR msgUID, int targetID, int Angle, int Range, int Width);
protected:
virtual bool packetHandler(protocolPackage * Package);
public:
// Constructor
explicit protocolBVMS( CSTR server, uint16_t port ); virtual ~protocolBVMS();
virtual bool init() { return true; }
bool Alarm( C3D_WGS84_LOC target_location ); // GeoLocation
bool Alarm( C3D_DECART target_location ); // UTM
bool VisibilityChanged(bool Worsened); bool StatusUpdate(void);
void SetStatus(bool A) { m_bCurrentStatus = A; }
bool ErrorReporting(int lvl, CSTR Descr); bool StartTimeSynch(void);#ifdef __linux__
// bool FinishTimeSynch( unsigned long long *tVals );
#else
// bool FinishTimeSynch( unsigned __int64 *tVals );
#endif
bool SetupCallBack(CSTR CallBackPath); void setProtocolType(bool DeviceIs3D); void setScannerName(CSTR Name);};
#ifdef __linux__
unsigned long long getSHTimeValue(void);#else
unsigned __int64 getSHTimeValue(void);#endif
#endif
|