//---------------------------------------------------------------------------

#ifndef CDSMonitoringObjFH
#define CDSMonitoringObjFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <stdio.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include "ITSLibF.h"
#include "ITSDbF.h"
//---------------------------------------------------------------------------

#define MAX_CAMERA_SCREEM       20
#define MAX_CAMERA_PER_SCREEM   64  // 8 * 8

class TScreenCtlr
{
public:
    TScreenCtlr() {};
    ~TScreenCtlr(){};

private:

public:
    int SEQ;
    String CTLR_NMBR;
    int VIEW_MODE;
public:
};
//---------------------------------------------------------------------------

class TMonitoringScreen
{
public:
    TMonitoringScreen() {};
    ~TMonitoringScreen(){ FLists.RemoveAll(); };

private:

public:
    int    SEQ;
    String NAME;
    int    LAYOUT;
    TItsMap<int, TScreenCtlr*> FLists;
public:
};
//---------------------------------------------------------------------------

class TMonitoringScreenManager
{
public:
    TMonitoringScreenManager();
    ~TMonitoringScreenManager();

public:
    TItsMap<String, TMonitoringScreen*> FLists;
    void Init();
};
//---------------------------------------------------------------------------
extern TMonitoringScreenManager *ObjScreenManager;
//---------------------------------------------------------------------------

class TMonitoringCtlr
{
public:
    TMonitoringCtlr() {};
    ~TMonitoringCtlr(){};

private:

public:
    String CTLR_NMBR;
    String ID;
    String CTLR_ID;
    String NAME;
    String CTLR_IP;
    String INFO1;
    String INFO2;

    String STRM_IP;
    String STRM_ID;
    String STRM_PSWD;
    String STRM_ADDR;
    String FULL_STRM_ADDR;
public:
};
//---------------------------------------------------------------------------

typedef enum enMonitoringType
{
    enMonitoringPhase    = 1,
    enMonitoringScenario = 2,
    enMonitoringCamera   = 3,
    enMonitoringModule   = 4,
} EN_MONITORING_TYPE;

class TMonitoringCtlrManager
{
public:
    TMonitoringCtlrManager(int AMonitoringType);
    ~TMonitoringCtlrManager();

public:
    String FCfgFile;
    int FMonitoringType;

    TItsMap<String, TMonitoringCtlr*> FLists;

    bool LoadCtlrFromDb(TADOConnection *ADbConn=NULL);
    bool InitMonitoringFormFromDb(TADOConnection *ADbConn=NULL);
    bool LoadMonitoringFormFromDb(TADOConnection *ADbConn=NULL);
    bool DelMonitoringFormFromDb(String AMonitoringName, String ANewFormName, TADOConnection *ADbConn=NULL);
    bool InsMonitoringFormFromDb(String AMonitoringName, int ASeq, String ACtlrNmbr, int AViewMode, TADOConnection *ADbConn=NULL);
    bool SaveCameraInfo(int ASeq, String ANmbr, String AId, String ANm, String AIp, String AStream, String AFullStream="");
};
//---------------------------------------------------------------------------
extern TMonitoringCtlrManager *ObjCtlrManager;
//---------------------------------------------------------------------------

#endif
