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.
56 lines
2.0 KiB
56 lines
2.0 KiB
#ifndef __ARGUS_DATABASE_CONNECTOR_HEADER__
|
|
#define __ARGUS_DATABASE_CONNECTOR_HEADER__
|
|
|
|
#include "../components/base/basicSettingsProvider.h"
|
|
#include "../data/mysql/database_class.h"
|
|
|
|
#define ONE_DAY_HISTORY 86400
|
|
#define ONE_HOUR_HISTORY 3600
|
|
#define ONE_SECOND_HISTORY 1
|
|
|
|
typedef struct S_CamRecordDBC{
|
|
int id;
|
|
bool online;
|
|
char uuid[CLOG];
|
|
char ip[16];
|
|
char username[CLOG];
|
|
char password[CLOG];
|
|
}CamRecordDBC;
|
|
|
|
typedef struct S_EventRecordDBC{
|
|
int ts_s;
|
|
int ts_ms;
|
|
int type;
|
|
|
|
}EventRecordDBC;
|
|
|
|
typedef std::vector<CamRecordDBC*> vectorCamRecords;
|
|
typedef std::vector<EventRecordDBC*> vectorEventRecords;
|
|
|
|
class ARGUS_DBC{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
int m_nSiteID;
|
|
MySQL_Connector * m_pDatabase;
|
|
bool m_bIsConnected;
|
|
char m_pDbHost[CLOG];
|
|
char m_pDbUsername[CLOG];
|
|
char m_pDbPassword[CLOG];
|
|
char m_pDbDatabase[CLOG];
|
|
public:
|
|
explicit ARGUS_DBC( config_setting_t * Settings );
|
|
~ARGUS_DBC();
|
|
/* Functionality */
|
|
bool connect( void );
|
|
bool getConnectionStatus(void){return m_bIsConnected;};
|
|
bool setOnlineStatus( bool Status );
|
|
int getIPCamCount( int siteID );
|
|
bool getIPCamRecords( vectorCamRecords &VR );
|
|
bool updateIPCam( CSTR uuid, CSTR Addr );
|
|
bool updateNetworkNode( bool OnlineStatus );
|
|
bool getLastEvents( vectorEventRecords &VR, int tss, int tsms );
|
|
bool transferEvtToArchive( int SECONDS = ONE_DAY_HISTORY );
|
|
};
|
|
|
|
#endif
|