//---------------------------------------------------------------------------
#ifndef VBNGUIH
#define VBNGUIH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "Ipwcore.h"
#include "ipwudpport.h"
#include "ipwCore.h"

#define     INIFILE                             "C:\VBN.ini"

#define     SHUTDOWN_MESSAGE                    "VBN SHUTDOWN"
#define     SHUTDOWN_LENGTH                     12

#define     NAVIGATE_MESSAGE                    "VBN NAVIGATE START"
#define     NAVIGATE_LENGTH                     18

#define     HEARTBEAT MESSAGE                   "VBN HEARTBEAT"
#define     HEARTBEAT_LENGTH                    13

#define     VIDEO_COLLECT_MESSAGE               "VBN VIDEO_COLLECT START"
#define     VIDEO_COLLECT_MESSAGE_LENGTH        23

#define     NAVIGATE_AND_COLLECT_VIDEO_MESSAGE  "VBN NAVIGATE_AND_COLLECT START"
#define     NAVIGATE_AND_COLLECT_VIDEO_LENGTH   30

#define     UTILITY_MESSAGE                     "VBN UTILITY"
#define     UTILITY_LENGTH                      11

#define     TS_MESSAGE                          "VBN TS"
#define     TS_LENGTH                           6

#define     TICK_DELAY                          10000
#define     DEFAULT_MASTER                   "127.0.0.1"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
    TipwUDPPort *ExternalControlPort;
    TipwUDPPort *VBN_output_UDP_Port;
    TButton *ShutdownButton;
    TLabel *StatusMessage;
   TipwUDPPort *MasterPort;
    void __fastcall ExternalControlPortDataIn(TObject *Sender,
          char *Datagram, USHORT lenDatagram, AnsiString &SourceAddress,
          USHORT SourcePort);
    void __fastcall ShutdownButtonClick(TObject *Sender);
    void __fastcall FormCreate(TObject *Sender);

private:	// User declarations
    void __fastcall ReadINI();
    void Launch_Process(AnsiString CommandLine);
    void    MakeLogEntry(AnsiString Entry);
    char  *navigation_executable_name;
    char  *collection_executable_name;
    char  *navigation_and_collection_executable_name;
    AnsiString  utility_names[9];
    AnsiString  logging_file_name;
    TFileStream *logging_file_stream;
    AnsiString    my_master;
    HANDLE        process_handle;
public:		// User declarations
    __fastcall TForm1(TComponent* Owner);
};

extern void    Launch_Process(AnsiString CommandLine);
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
