blob: 42e376bc393673580a868010c59d95c2b04eb9a8 [file] [log] [blame]
#include "CommandBase.h"
#include "ResulTest.h"
#include <log/log.h>
#undef LOG_TAG
#define LOG_TAG "CommandBase"
using namespace std;
CommandBase::CommandBase():mResultTest(ResulTest::getInstance()),
mModuleId(-1)
{
}
CommandBase::~CommandBase()
{
}
int CommandBase::open(const sp<ModuleBase> module,int moduleId)
{
mModuleBase = module;
mRfAutomaticTest = RfAutomaticTest::Create(mModuleBase,mResultTest);
mModuleId = moduleId;
return 1;
}
/*
void CommandBase::getAutomaticTest()
{
printf("GpsCommand startTest\n");
mRfAutomaticTest->startTest();
return 1;
}*/
int CommandBase::startTest()
{
RLOGD("GpsCommand startTest\n");
if(timeout<0)
{
printf("time not set\n");
return -1;
}
mRfAutomaticTest->handlerStartTest(mModuleId);
return 1;
}
int CommandBase:: getCheckResult(int smallData,int largerData)
{
RLOGD("GpsCommand ,smallData:%d,largerData:%d\n");
if(smallData>largerData)
{
mRfAutomaticTest->handlerGetCheck(largerData,smallData);
return 1;
}
else if(smallData<largerData)
{
mRfAutomaticTest->handlerGetCheck(smallData,largerData);
return 1;
}
else
{
printf("Scope data error\n");
return 0;
}
}
int CommandBase::timeOut(int timeout)//sec
{
RLOGD("CommandBase timeout:%d\n",timeout);
this->timeout = timeout;
RLOGD("CommandBase mRfAutomaticTest timeout start:%d\n",timeout);
mRfAutomaticTest->handlerTimeout(timeout);
RLOGD("CommandBase mRfAutomaticTest timeout end:%d\n",timeout);
return 1;
}