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

#ifndef TThreadPollingFH
#define TThreadPollingFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ADODB.hpp>
#include <DB.hpp>
//---------------------------------------------------------------------------
class TThreadPolling : public TThread
{
protected:
    void __fastcall Execute();
private:
    TADOConnection      *m_pConnection;
    HWND                 m_lMainWinHandle;
    String               m_sDbConnString;

    bool __fastcall DbConnect();
    bool __fastcall IsDbOpen()
    {
        if (m_pConnection)  return m_pConnection->Connected;
        else return false;
    };
    void __fastcall DbClose()
    {
        if (IsDbOpen()) m_pConnection->Close();
    };
    bool __fastcall IsDbDisconnected();

public:
    __fastcall TThreadPolling(bool CreateSuspended);
    __fastcall ~TThreadPolling();

public:
    bool __fastcall SelProcessStatusData(LPARAM LParam);
    bool __fastcall SelVmsStatusData(LPARAM LParam);
    bool __fastcall SelVmsMsg(LPARAM LParam);
    bool __fastcall SelIfscTrafficData(LPARAM LParam);
    bool __fastcall SelVmsIfscTrafficData(LPARAM LParam);
    bool __fastcall SelIncidentData(LPARAM LParam);
};
//---------------------------------------------------------------------------
#endif

