Skip to content
Snippets Groups Projects
Commit 8baf33b5 authored by Sebastien Leport's avatar Sebastien Leport
Browse files

- fault and alarm state have got now a higher priority

parent 20ebf262
No related branches found
No related tags found
No related merge requests found
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/SY2527Channel/src/SY2527Channel.cpp,v 1.7 2007-10-15 15:40:42 sebleport Exp $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/SY2527Channel/src/SY2527Channel.cpp,v 1.8 2007-11-19 09:12:41 sebleport Exp $";
//+=============================================================================
//
// file : SY2527Channel.cpp
......@@ -13,9 +13,13 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
//
// $Author: sebleport $
//
// $Revision: 1.7 $
// $Revision: 1.8 $
//
// $Log: not supported by cvs2svn $
// Revision 1.7 2007/10/15 15:40:42 sebleport
// - in get_device_property(), we write properties in database only if they have never been written
// - slotNumber and channelNumber are described in status attribute
//
// Revision 1.6 2007/09/07 13:14:56 sebleport
// - add position_in_crate (vector) data member
//
......@@ -484,8 +488,9 @@ Tango::DevState SY2527Channel::dev_state()
// Add your own code to control device here
Tango::DevState state_to_return;
std::stringstream s;
Tango::DevState state_to_return;
// concatenate internal message string
s << message << endl;
......@@ -510,75 +515,56 @@ Tango::DevState SY2527Channel::dev_state()
}
s << "No Communication with SY2527Crate, try to init the SY2527Crate DS again"<<endl;
state_to_return = Tango::FAULT;
set_status(s.str().c_str());
return state_to_return;
return Tango::FAULT;
}
// Manage the returned value
// Manage the returned state
// STANDBY State
if( status_byte & 0x01) // bit 0
{
s << "Channel is on"<<endl;
state_to_return = Tango::STANDBY;
}
else
// FAULT State
if( status_byte & 0x400) // bit 10
{
s << "Channel is off"<<endl;
state_to_return = Tango::OFF;
}
s << "Channel is in calibration error"<<endl;
set_status(s.str().c_str());
return Tango::FAULT;
// RUNNING State
if(status_byte & 0x02) // bit 1
{
s << "Channel is ramping up"<<endl;
state_to_return = Tango::RUNNING;
}
if( status_byte & 0x04) // bit 2
if( status_byte & 0x800) // bit 11
{
s << "Channel is ramping down"<<endl;
state_to_return = Tango::RUNNING;
s << "Channel is unplugged"<<endl;
set_status(s.str().c_str());
return Tango::FAULT;
}
// ALARM State
if( status_byte & 0x08) // bit 3
{
s << "Channel is over current"<<endl;
state_to_return = Tango::ALARM;
set_status(s.str().c_str());
return Tango::ALARM;
}
if( status_byte & 0x10) // bit 4
{
s << "Channel is over voltage"<<endl;
state_to_return = Tango::ALARM;
set_status(s.str().c_str());
return Tango::ALARM;
}
if( status_byte & 0x20) // bit 5
{
s << "Channel is under voltage"<<endl;
state_to_return = Tango::ALARM;
set_status(s.str().c_str());
return Tango::ALARM;
}
if( status_byte & 0x80) // bit 7
{
s << "Channel is in max V"<<endl;
state_to_return = Tango::ALARM;
}
// FAULT State
if( status_byte & 0x400) // bit 10
{
s << "Channel is in calibration error"<<endl;
state_to_return = Tango::FAULT;
}
if( status_byte & 0x800) // bit 11
{
s << "Channel is unplugged"<<endl;
state_to_return = Tango::FAULT;
set_status(s.str().c_str());
return Tango::ALARM;
}
// NO corresponding state because transient conditions
......@@ -599,7 +585,38 @@ Tango::DevState SY2527Channel::dev_state()
s << "Channel is in internal trip"<<endl;
}
// STANDBY State
if( status_byte & 0x01) // bit 0
{
s << "Channel is on"<<endl;
state_to_return = Tango::STANDBY;
set_status(s.str().c_str());
}
else
{
s << "Channel is off"<<endl;
state_to_return = Tango::OFF;
set_status(s.str().c_str());
}
// RUNNING State
if(status_byte & 0x02) // bit 1
{
s << "Channel is ramping up"<<endl;
state_to_return = Tango::RUNNING;
set_status(s.str().c_str());
}
if( status_byte & 0x04) // bit 2
{
s << "Channel is ramping down"<<endl;
state_to_return = Tango::RUNNING;
set_status(s.str().c_str());
}
return state_to_return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment