Commit 0ab69c12 authored by cyclops's avatar cyclops
Browse files

bugs

parent 3f61561e
......@@ -44,7 +44,7 @@ RealPslDriver::~RealPslDriver() {
* init
*/
void RealPslDriver::init() {
//readInfos();
readInfos();
}
/*
......@@ -57,16 +57,19 @@ void RealPslDriver::clear() {
* writeParam
*/
void RealPslDriver::writeParam() {
ostringstream buf_conf;
cout << " writeParam " << endl;
string err;
buf_conf << "SetAcquisitionMode;"<< boost::format("%03d") %PslDriver::MODE[owner()->acqmode()];
err = writeAndRead(buf_conf.str(), TERMINATOR);
buf_conf.str("");
cout << " write "<< buf_conf.str() << endl;
buf_conf.str("");
buf_conf.clear();
if (err != "True") {
cerr << "error SetAcquisitionMode " << endl;
......@@ -103,13 +106,13 @@ void RealPslDriver::writeParam() {
cerr << "error SetIntensifierGain " << endl;
}
// owner()->nbFrame=1;
// buf_conf << "SetFrameNumber;"<< boost::format("%03d") % owner()->nbFrame();
// err = writeAndRead(buf_conf.str(), TERMINATOR);
// buf_conf.str("");
// buf_conf.clear();
// if (err != "True") {
// cerr << "error SetFrameNumber " << endl;
// }
buf_conf << "SetFrameNumber;"<< boost::format("%03d") % owner()->nbFrame();
err = writeAndRead(buf_conf.str(), TERMINATOR);
buf_conf.str("");
buf_conf.clear();
if (err != "True") {
cerr << "error SetFrameNumber " << endl;
}
}
......@@ -119,12 +122,16 @@ void RealPslDriver::writeParam() {
void RealPslDriver::synchroniseRead() {
string err;
int32 i;
cout << "m_TimeCounter" <<m_TimeCounter.getTime()<< endl;
sleep( 1);
// do {
// err = writeAndRead("WaitForImage", TERMINATOR);
// cout << "Waiting For Image" << endl;
// } while ((err == "False") && (i++ <10 ));
do {
err = writeAndRead("WaitForImage", TERMINATOR);
cout << "Waiting For Image" << endl;
} while ((err == "False") && (i++ <10 ));
// if (err != "True") {
// cerr << "error acquisition " << endl;
// } else {
......@@ -147,14 +154,16 @@ void RealPslDriver::synchroniseRead() {
++iter;
if (iter != tok1.end()) {
cout << " iter 2 : " << *iter << endl;
int32 xsize = lexical_cast<int32>(*iter);
// int32 xsize = lexical_cast<int32>(*iter);
++iter;
if (iter != tok1.end()) {
cout << " iter 3 : " << *iter << endl;
int32 ysize = lexical_cast<int32>(*iter);;
int32 xsize = lexical_cast<int32>(*iter);
// int32 ysize = lexical_cast<int32>(*iter);;
++iter;
if (iter != tok1.end()) {
cout << " iter 4 : " << *iter << endl;
int32 ysize = lexical_cast<int32>(*iter);;
int32 size = xsize * ysize;//lexical_cast<int32>(*iter);
//sleep(5);
string datas = owner()->read(size * 2);
......@@ -250,7 +259,9 @@ void RealPslDriver::start() {
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
}
m_TimeCounter.clear();
}
/*
......@@ -286,7 +297,7 @@ void RealPslDriver::readStatus() {
int32 status = 0;
if (owner()->startActivated() == true) {
if (actualtime > owner()->time.setpoint()) {
if (actualtime > owner()->time.setpoint()+0.5) {
status |= END;
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
......@@ -324,9 +335,11 @@ void RealPslDriver::readInfos() {
std::string RealPslDriver::writeAndRead(const std::string& command,
const std::string& terminator) {
string buf;
owner()->connect();
cout << "<-- " << command << endl;
owner()->connect();
// usleep(10000);
cout << "<-- " << command << endl;
owner()->write(command, terminator);
// usleep(10000);
cout << "<-- OK " << command << endl;
buf = owner()->read();
cout << "--> " << buf << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment