// Pantilt.cpp: implementation of the CPantilt class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Capture.h"
#include "Pantilt.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPantilt::CPantilt()
{
	Run = 0;
}

CPantilt::~CPantilt()
{

}

int CPantilt::Start(CString command)
{
	if (Port.Open())
	{
		Port.SendLine(command);
		return 1;
	}
	else
		return 0;
}

int CPantilt::Stop()
{
	return Port.Close();
}

CString CPantilt::ReadData(CString command)
{
	CString Data;
	Port.SendLine(command);

	while(1)
	{
		Data = Port.ReceiveLine();
		TRACE(Data);
		if (Data == "")
			return "End";
		else
			return Data;
	}
}

int CPantilt::Running(CString command)
{
	Run = Start(command);
	return Run;
}



int CPantilt::Stopping()
{
	Run = !Stop();
	return !Run;
}

int CPantilt::GetRun()
{
	return Run;
}
