Skip to content
Snippets Groups Projects
Commit c77173d5 authored by Jean Coquet's avatar Jean Coquet
Browse files

flush read buffer before sending a command

parent b2bc27fa
No related branches found
No related tags found
No related merge requests found
......@@ -651,9 +651,24 @@ std::cout << "GpibPrologix::GpibPrologix() -> parameters sent in " << t1.elapsed
void GpibPrologix::write(Tango::DevString argin)
{
DEBUG_STREAM << "GpibPrologix::write(): entering... !" << endl;
static const char LF = 0xA;
// Add your own code to control device here
static const char LF = 0xA;
//- check if there is something in the read buffer before sending a command
if (sock->can_read_without_blocking ())
{
Tango::DevString unexpected_data = this->read ();
std::stringstream s;
s << "write : found unexpected data in input buffer : ["
<< unexpected_data
<< "]";
{
yat::AutoMutex <yat::Mutex> guard (this->m_lock);
failed_cmds.push_back (this->com_last_error);
}
ERROR_STREAM << "GpibPrologix::" << this->com_last_error << std::endl;
}
if ((!sock) || !init_device_done || properties_missing)
{
Tango::Except::throw_exception(static_cast<const char*>("COMMUNICATION_FAILED"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment