/*
* Title: Control.cpp
* Author: M.Thomas BEAM Ltd
* Date: 2007-02-13
*
* Contents: Tms Client control. All Server request are routed through here.
*
* Mod Rec:
*
*/
#include <Control.h>
#include <iostream>
using namespace std;
using namespace Tms;
Control::Control() {
ohostName = "localhost";
};
Control::~Control(){};
BError Control::init() { ///< Initialise the system
BError err;
err = connect();
return err;
}
void Control::setHost(BString host) { ///< Set host
ohostName = host;
}
BError Control::connect() {
BError err;
if(err = otmsControl.connectService(BString("//") + ohostName + "/tmsControl")){
cerr << "Error: cannot connect to tmsControl: " << err.getString() << "\n";
return err;
}
if(err = otmsProcess.connectService(BString("//") + ohostName + "/tmsProcess")){
cerr << "Error: cannot connect to tmsProcess: " << err.getString() << "\n";
return err;
}
emit newConnection();
return err;
}
BError Control::reconfigure(Tms::ConfigInfo info) { ///< Reconfigure the system
otmsControl.configure(info);
return otmsControl.configure(info);
}
BError Control::getConfiguration(Tms::ConfigInfo& info) { ///< Reconfigure the system
return otmsControl.getConfiguration(info);
}
BError Control::setControlInfo(Tms::CycleParam params) { ///< Setup cycle parameters
return otmsProcess.setControlInfo(params);
}
BError Control::runTest(BList<BError>& l) { ///< Start the system running
return otmsControl.test(l);
}
BError Control::getData(Tms::DataInfo info,Tms::Data& data) { ///< Get Data
return otmsProcess.getData(info,data);
}
BError Control::getTestData(PuChannel puPhysChannel, TestCaptureInfo captureInfo, BArray< UInt64 > &data) {
return otmsControl.captureTestData(puPhysChannel,captureInfo,data);
}
BError Control::getPuChannel (UInt32 puChannel, PuChannel &puPhysChannel){
return otmsControl.getPuChannel(puChannel,puPhysChannel);
}
BError Control::setTestData(PuChannel puChannel,Int32 on, BArray<UInt32> data) {
return otmsControl.setTestData(puChannel,on,data);
}
BError Control::getStatus(BList<Tms::NameValue>& l) { ///< Get Status
return otmsControl.getStatus(l);
}
BError Control::getStatistics(BList<Tms::NameValue>& l) { ///< Get Statistics
return otmsControl.getStatistics(l);
}
BError Control::getCycleNumber(UInt32& cycleNumber ) {
BString cycleType;
return otmsProcess.getCycleInfo(cycleNumber,cycleType);
}