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.
131 lines
9.0 KiB
131 lines
9.0 KiB
#ifndef __ARGUS_DATABASE_CONNECTOR_HEADER__
|
|
#define __ARGUS_DATABASE_CONNECTOR_HEADER__
|
|
|
|
#include "../components/base/basicSettingsProvider.h"
|
|
#include "../data/mysql/database_class.h"
|
|
#include "../data/protocol/onvifMediaObserver.h"
|
|
#include "../alg/generic/md5.h"
|
|
#include "rgooseTypes.h"
|
|
|
|
class argusDBC{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
MySQL_Connector * m_pDatabase;
|
|
bool m_bIsConnected;
|
|
char m_pDbHost[CLOG];
|
|
char m_pDbUsername[CLOG];
|
|
char m_pDbPassword[CLOG];
|
|
char m_pDbDatabase[CLOG];
|
|
|
|
uint32_t m_nSiteID;
|
|
public:
|
|
static argusDBC * getInstance( config_setting_t * Settings = NULL );
|
|
virtual ~argusDBC();
|
|
/* Functionality */
|
|
bool connect( void );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool addDraw( uint32_t DBID, uint16_t SIZE, CSTR ID );
|
|
uint32_t addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsms, uint8_t evt_type, uint16_t dig_r=0, float AZ=.0f, float EL=.0f, float RANGE=.0f, float AREA=.0f, float lat=.0f, float lon=.0f, float alt=.0f, uint32_t RefID=0, CSTR RefUUID=NULL );
|
|
bool addIPCam( uint32_t SiteID, resultWoWo *tPtr );
|
|
bool addIPCam( uint32_t SiteID, OBSERVER_RESULT *tPtr );
|
|
uint32_t addLocalMediaSource( uint32_t SiteID, CSTR path, uint32_t width, uint32_t height );
|
|
uint32_t addLocalDCB( uint32_t SiteID, CSTR PATH, CSTR SERIAL, uint8_t CNT, uint32_t status );
|
|
uint32_t addLocalUART( uint32_t ResID, uint8_t utype, uint32_t speed, uint8_t bit, char parity, float stop_bit, CSTR PATH, uint8_t mode=0, uint16_t port=0 );
|
|
//uint32_t addNodeSocket( uint32_t NodeID, uint32_t auxID, uint8_t SocketType, uint8_t SocketMode, bool multidrop, CSTR path, CSTR name );
|
|
bool addNotification( uint32_t MSG_ID, uint8_t DIS_LVL = 0, uint32_t OBJ_ID=0 );
|
|
|
|
uint32_t addResource( uint32_t SiteID, uint32_t NodeID, uint8_t type, CSTR devName, uint32_t auxID = 0 );
|
|
|
|
bool addVideoEvent( uint32_t evtID, uint32_t videoID );
|
|
uint32_t addVideoRecord( uint32_t streamID, CSTR md5, uint32_t partID );
|
|
bool cleanResources( uint32_t SiteID, uint32_t ServerID, bool all = false );
|
|
|
|
DBC_INT_LIST * listCamMediaStreams( uint32_t CAMID );
|
|
DBC_INT_LIST * listDetectionProfileIDs( uint32_t nodeID );
|
|
DBC_INT_LIST * listDetectionProfiles( uint32_t nodeID );
|
|
DBC_INT_LIST * listFilters( uint32_t m_nSiteID, uint32_t m_nServerID );
|
|
DBC_INT_LIST * listMediaStreams( uint32_t SiteId, uint32_t MediaServerID, uint8_t listingType = LIST_ALL_RECORDS );
|
|
DBC_INT_LIST * listModules( uint32_t SiteID );
|
|
DBC_INT_LIST * listNewModules( uint32_t SiteID, DBC_INT_LIST * old_ids );
|
|
DBC_INT_LIST * listNewNodes( uint32_t SiteID, DBC_INT_LIST * old_ids );
|
|
DBC_INT_LIST * listNodes( uint32_t SiteID );
|
|
//DBC_INT_LIST * listSockets( uint32_t NodeID );
|
|
DBC_INT_LIST * listResources( uint32_t NodeID = 0 );
|
|
|
|
DBC_KRNL_CMD * getActiveCommand( uint32_t SiteID );
|
|
bool getAllCamRecords( uint32_t SiteID, vectorCamRecords &VR );
|
|
DBC_APF_DATA * getAPFData( uint32_t APFID );
|
|
DBC_CAM_DATA * getCamData( uint32_t CamID );
|
|
uint32_t getCamId( CSTR UUID );
|
|
bool getConnectionStatus(void){return m_bIsConnected;};
|
|
DBC_EVT_DATA * getEventByUUID( CSTR UUID );
|
|
DBC_FH_DATA * getFlyHunterData( uint32_t ID );
|
|
int getIPCamCount( uint32_t SiteID );
|
|
KAFKA_TEMPLATE * getKafkaTemplateForEvent( uint32_t ModuleID, uint32_t ClassID, uint32_t EventID );
|
|
bool getLastEvents( vectorEventRecords &VR, uint32_t tss, uint32_t tsms );
|
|
DBC_LRF_DATA * getLRFData( uint32_t ID );
|
|
uint8_t getLRFDataStatus( uint32_t ID );
|
|
uint8_t getLRFPushedCMD( uint32_t ID );
|
|
DBC_MEDIA_STREAM_DATA * getMediaStreamData( uint32_t ID );
|
|
DBC_MEDIA_SERVER_DATA * getMediaServerData( uint32_t ID );
|
|
DBC_MEDIA_SERVER_STREAM_DATA * getMediaServerStreamData( uint32_t ID );
|
|
DBC_MEDIA_SERVER_STREAM_DATA * getMediaServerStreamDataBySource( uint32_t ID );
|
|
DBC_MODULE_DATA * getModuleData( uint32_t ID );
|
|
DBC_NODE_DATA * getNodeData( uint32_t ID );
|
|
CSTR getNodeIP4( uint32_t NodeID );
|
|
CSTR getNodeIP6( uint32_t NodeID );
|
|
//uint32_t getNodeSocketID( uint32_t NodeID, uint32_t auxID, uint8_t SocketType, CSTR path );
|
|
DBC_RESOURCE_DATA * getResourceData( uint32_t ResourceID );
|
|
uint32_t getResourceID( uint32_t SiteID, uint32_t NodeID, uint8_t type, uint32_t auxID );
|
|
uint32_t getServerID( CSTR identity );
|
|
uint32_t getServerNode( uint32_t SID );
|
|
KAFKA_SETTINGS * getSettingsKAFKA( uint32_t NodeID );
|
|
DBC_SITE_DATA * getSiteData( uint32_t ID );
|
|
//DBC_SOCKET_DATA * getSocketData( uint32_t ID );
|
|
CSTR getResourceDevice( uint32_t NodeID, uint32_t Type );
|
|
DBC_TARGET_FLITER_DATA * getTargetFilterData( uint32_t ID );
|
|
DBC_UART_DATA * getUartData( uint32_t UartID );
|
|
uint32_t getUartID( uint32_t RessourceID );
|
|
|
|
|
|
|
|
|
|
|
|
void registerServer(uint32_t SiteID, CSTR identity );
|
|
void unregisterServer(uint32_t ServerID, uint32_t NodeID );
|
|
|
|
bool transferEvtToArchive( uint32_t SECONDS = ONE_DAY_HISTORY );
|
|
|
|
|
|
|
|
bool setNodeOnline( uint32_t NodeID, uint8_t status=ARGUS_NODE_STATUS_WORK );
|
|
bool setNodeOffline( uint32_t NodeID );
|
|
bool setOnlineStatus( bool Status );
|
|
bool setLRFDetectionProfile( uint32_t lrfID, uint8_t profileID );
|
|
bool setLRFDataStatus( uint32_t lrfID, uint8_t ST );
|
|
bool setLRFAltSerial( uint32_t lrfID, CSTR Serial );
|
|
bool setLRFAltVerison( uint32_t lrfID, CSTR version );
|
|
|
|
bool updateAFPBox( uint32_t filterID, CSTR Tag, float x, float y, float z );
|
|
bool updateCommand( uint32_t CMD_ID, uint8_t STATUS );
|
|
bool updateIPCam( uint32_t SiteID, CSTR uuid, CSTR Addr );
|
|
bool updateIPCam( uint32_t SiteID, uint32_t CamID, CSTR Addr );
|
|
bool updateLRFSerial( uint32_t lrfID, CSTR Serial );
|
|
bool updateLRFVerison( uint32_t lrfID, CSTR version );
|
|
bool updateLRFDetectionProfile( uint32_t lrfID, uint8_t profileID, bool master, uint16_t nOrder, uint16_t nOffset, uint16_t nDelta, uint16_t nWidth, uint16_t nFlip, uint16_t nSun, uint8_t bSST, uint32_t GP=0, uint32_t spikes=0 );
|
|
bool updateMediaServerStream( uint32_t id, CSTR mrl=NULL, CSTR key = NULL );
|
|
bool updateNetworkNode( bool OnlineStatus );
|
|
bool updateResourceAUX( uint32_t ResID, uint32_t AUX );
|
|
private:
|
|
static argusDBC * _instance;
|
|
explicit argusDBC( config_setting_t * Settings = NULL );
|
|
};
|
|
|
|
#endif
|