#ifndef __PROTOCOL_KAFKA_HEADER__ #define __PROTOCOL_KAFKA_HEADER__ #ifdef __linux__ #include #endif #include #include #include #include #include #include //#include #include #include "protocolEuropeanGeneral.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicSettingsProvider.h" /** * TODO: Add class description * * @author gagua */ class protocolKAFKA:public RdKafka::DeliveryReportCb { private: basicLogCollection * m_pLog; //config_setting_t * m_pSettings; //rd_kafka_t * m_pKafka; /* Producer instance handle */ RdKafka::Producer * m_pKafka; /* Producer instance handle */ //rd_kafka_conf_t * m_pKafkaConf; /* Temporary configuration object */ //RdKafka::Conf * m_pKafkaConf; /* Temporary configuration object */ char m_pKafkaBrokerSTR[OS_CEP_ADDRESS_SIZE]; //CSTR m_pKafkaTopicSTR; RdKafka::Topic * m_pKafkaTopic; // bool m_bUseCompression; // bool m_bEnableStatus; //uint8_t m_bKafkaBrokersCount; //int m_nScannerDimentions; //CSTR m_pScannerName; CSTR m_pServerIP; //CSTR m_pAccessURL; //bool m_bEnabled; //bool m_bUseSSL; //bool m_bMitigationStatus; //float m_fLon; //float m_fLat; 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 buildEvent2DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, float Angle, float Range, float Width ); //bool buildEvent3DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, float Angle1, float Angle2, float Range ); //CSTR assembleStatusData( bool StatusOK ); //CSTR assembleFaultData( uint8_t Code, CSTR Desc ); //CSTR assembleTargetData( bool is3D, int targetID, int Range, int Width, int Azimuth, int Elevation = 0 ); //size_t assembleDefenderJSON( CSTR Buffer, defenderCategoryTypes Type, uint8_t Severity, CSTR Location, CSTR Data ); public: // Constructor //explicit protocolKAFKA( config_setting_t *Settings ); explicit protocolKAFKA( KAFKA_SETTINGS *Settings ); explicit protocolKAFKA( CSTR ServerAddr, uint16_t Port ); //ToDo: change Serial to BaseClass of some kind of socket //protocolSafeShore( clientPort *SocketTransport, config_setting_t *Settings = NULL ); // Destructor virtual ~protocolKAFKA(); bool init(); bool issuePost( CSTR Channel, CSTR Buffer, int BufferSize ); // bool Alarm2D( float Angle, float Range, float Width, int ID=0 ); // bool Alarm3D( float Angle1, float Angle2, float Range, int ID=0 ); // bool VisibilityChanged( bool Worsened ); // bool StatusUpdate( void ); // void SetStatus( bool A ){ m_bCurrentStatus = A; }; // bool ErrorReporting( int lvl, CSTR Descr ); // bool StartTimeSynch( void ); /* Implementation of RdKafka::DeliveryReportCb */ virtual void dr_cb( RdKafka::Message &message ); #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 ); // void setScannerPosition( float Lat, float Lon ){ m_fLon = Lon; m_fLat = Lat; }; // bool getMitigationStatus(void) { return m_bMitigationStatus; }; }; #endif