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

#ifndef CDSManagerFH
#define CDSManagerFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <stdio.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include <SyncObjs.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <GIFimg.hpp>
//---------------------------------------------------------------------------
#include "ITSLibF.h"
#include "CDSItsObjectF.h"
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
class TCDSManager : public TCDSItsObject
{
public:
    TCDSManager();
    ~TCDSManager();

private:
    AnsiString FFormDsplDt;

public:
    bool FIsStaticCycle;

    int SendVmsDownloadForm();

public:
    int ClearVmsProvideMode();
    
public:
    int InitVmsDsplPrst(TADOConnection *ADbConn);

	int CheckVmsEVehicleInf(TADOConnection *ADbConn);
	int LoadVmsEVehicleInf(TADOConnection *ADbConn, int ACommand);
	int LoadVmsEventOccrInf(TADOConnection *ADbConn);
	int LoadVmsScheduleInfo(TADOConnection *ADbConn);
	int LoadVmsOperationMode(TADOConnection *ADbConn);

    /* 스케줄에 의한 작업으로 처리 */
    int LoadVmsOnOffTime(TADOConnection *ADbConn);
    int LoadVmsDownLoadJob(TADOConnection *ADbConn);
    int SaveVmsDownLoadJob(TADOConnection *ADbConn, void *ACtlrObj);

	int UpdateVmsProvideResult(TADOConnection *ADbConn, void *ACtlrObj);
	int SaveVmsProvideForm(TADOConnection *ADbConn, void *ACtlrObj);
    int SaveVmsDownloadForm(TADOConnection *ADbConn);
    
    int MakeVmsScenarioForm(TADOConnection *ADbConn, int ACommand);
    int DownloadVmsForm(TADOConnection *ADbConn, int ACommand);
    int SaveProvideResult(TADOConnection *ADbConn, void *AData);

};
//---------------------------------------------------------------------------
extern TCDSManager *CDSManager;
//---------------------------------------------------------------------------

#if 0
* FrmMain   : 정주기 또는 모드변경 운영단말로 부터 수신시
*             DbmThread 로 APP_PostDbThreadWriteMessage(dbm_dnld_form_cycle);
*             PostDbThreadMessage(dbm_dnld_form_mode);
* DbmThread : CDSManager->DownloadVmsForm 호출
*             CDSManager->DownloadVmsForm 에서 MakeVmsScenarioForm 호출
*             DbmThread : CDSManager->DownloadVmsForm 완료 정보를 FrmMain으로 전송
* FrmMain   : TFrmMain::MakeVmsProvideForm() 호출 - 스케줄정보에 의해 폼 생성 후
*             TFrmMain::MakeVmsDatabaseForm(TCDSCtlr *AObj) 호출 - 데이터베이스에 저장할 이미지생성 후 파일저장
*             DbmThread 로 APP_PostDbThreadWriteMessage(dbm_save_form_download);
* DbmThread : CDSManager->SaveVmsDownloadForm 호출
*             CDSManager->SaveVmsProvideForm() 에서 VMS별 이력조회할 포맷작성후 데이터베이스에 저장
*

FrmMain                 DbmThread                                             FrmMain                                      DbmThread
dbm_dnld_form_cycle --> (CDSManager->DownloadVmsForm, MakeVmsScenarioForm) -> (MakeVmsProvideForm, MakeVmsDatabaseForm) -> (CDSManager->SaveVmsDownloadForm, SaveVmsProvideForm)
dbm_dnld_form_mode  -|
#endif


#endif
