//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "TractorForm.h"

#include "..\..\include\OMSUtil\OMSController.h"
extern OMSController   c;


//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;



//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
	// controller board is initialized when the static object c is created
	if( c.isOpened() )
		Application->MessageBox("Board is opened","OK",IDOK);
	else
		Application->MessageBox("Board could NOT be opened","Error",IDOK);

}
//---------------------------------------------------------------------------
void __fastcall TForm1::homeButtonClick(TObject *Sender)
{

	try {
		c.goHome();
		Application->MessageBox("Successfull goHome()","OK",IDOK);
	}
	catch(RobotControllerException) {
		Application->MessageBox("Caught RobotControllerException","Error",IDOK);
	}
	catch(...){
		Application->MessageBox("Caught unknown exception","Error",IDOK);
	}
}
//---------------------------------------------------------------------------

