Skip to content
Snippets Groups Projects
Commit 0269ff96 authored by Claudio Scafuri's avatar Claudio Scafuri :speech_balloon:
Browse files

fixes and commands

parent f44b9483
No related branches found
No related tags found
1 merge request!1start in OFF state
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
// Reset | reset // Reset | reset
// StartCycling | start_cycling // StartCycling | start_cycling
// Abort | abort // Abort | abort
// fault | fault // Fault | fault
//================================================================ //================================================================
//================================================================ //================================================================
...@@ -486,24 +486,25 @@ void SimulatedE2PS::abort() ...@@ -486,24 +486,25 @@ void SimulatedE2PS::abort()
} }
//-------------------------------------------------------- //--------------------------------------------------------
/** /**
* Command fault related method * Command Fault related method
* Description: Force a simulated faulty condtion * Description: Force a simulated faulty condtion
* *
*/ */
//-------------------------------------------------------- //--------------------------------------------------------
void SimulatedE2PS::fault() void SimulatedE2PS::fault()
{ {
DEBUG_STREAM << "SimulatedE2PS::fault() - " << device_name << std::endl; DEBUG_STREAM << "SimulatedE2PS::Fault() - " << device_name << std::endl;
/*----- PROTECTED REGION ID(SimulatedE2PS::fault) ENABLED START -----*/ /*----- PROTECTED REGION ID(SimulatedE2PS::fault) ENABLED START -----*/
/* clang-format on */ /* clang-format on */
// Add your own code // Add your own code
if (get_state() == Tango::ON) return; // command is idempotent
_current_read = 0.0; _current_read = 0.0;
_current = 0.0; _current = 0.0;
_voltage = 0.0; _voltage = 0.0;
attr_current->set_write_value(_current); attr_current->set_write_value(_current);
push_change_event("current",&_current_read); push_change_event("current", &_current_read);
push_change_event("currentSet",&_current); push_change_event("currentSet", &_current);
set_state(Tango::FAULT); set_state(Tango::FAULT);
push_change_event("State"); push_change_event("State");
/* clang-format off */ /* clang-format off */
......
...@@ -81,7 +81,7 @@ class SimulatedE2PS : public TANGO_BASE_CLASS ...@@ -81,7 +81,7 @@ class SimulatedE2PS : public TANGO_BASE_CLASS
class cyclethread *cycleloop; class cyclethread *cycleloop;
bool thread_running; bool thread_running;
bool abortflag; bool abortflag;
void psdelay(); //void psdelay();
Tango::WAttribute *attr_current; Tango::WAttribute *attr_current;
/* clang-format off */ /* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS::Data Members /*----- PROTECTED REGION END -----*/ // SimulatedE2PS::Data Members
...@@ -245,12 +245,12 @@ public: ...@@ -245,12 +245,12 @@ public:
virtual void abort(); virtual void abort();
virtual bool is_Abort_allowed(const CORBA::Any &any); virtual bool is_Abort_allowed(const CORBA::Any &any);
/** /**
* Command fault related method * Command Fault related method
* Description: Force a simulated faulty condtion * Description: Force a simulated faulty condtion
* *
*/ */
virtual void fault(); virtual void fault();
virtual bool is_fault_allowed(const CORBA::Any &any); virtual bool is_Fault_allowed(const CORBA::Any &any);
//-------------------------------------------------------- //--------------------------------------------------------
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
</argout> </argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<excludedStates>UNKNOWN</excludedStates> <excludedStates>UNKNOWN</excludedStates>
<excludedStates>FAULT</excludedStates>
</commands> </commands>
<commands name="Reset" description="Reset the powersupply to a well known state." execMethod="reset" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> <commands name="Reset" description="Reset the powersupply to a well known state." execMethod="reset" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description=""> <argin description="">
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,7 @@
<excludedStates>UNKNOWN</excludedStates> <excludedStates>UNKNOWN</excludedStates>
<excludedStates>FAULT</excludedStates> <excludedStates>FAULT</excludedStates>
</commands> </commands>
<commands name="fault" description="Force a simulated faulty condtion" execMethod="fault" displayLevel="EXPERT" polledPeriod="0" isDynamic="false"> <commands name="Fault" description="Force a simulated faulty condtion" execMethod="fault" displayLevel="EXPERT" polledPeriod="0" isDynamic="false">
<argin description=""> <argin description="">
<type xsi:type="pogoDsl:VoidType"/> <type xsi:type="pogoDsl:VoidType"/>
</argin> </argin>
......
...@@ -246,7 +246,7 @@ CORBA::Any *AbortClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CO ...@@ -246,7 +246,7 @@ CORBA::Any *AbortClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CO
//-------------------------------------------------------- //--------------------------------------------------------
/** /**
* method : faultClass::execute() * method : FaultClass::execute()
* description : method to trigger the execution of the command. * description : method to trigger the execution of the command.
* *
* @param device The device on which the command must be executed * @param device The device on which the command must be executed
...@@ -255,9 +255,9 @@ CORBA::Any *AbortClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CO ...@@ -255,9 +255,9 @@ CORBA::Any *AbortClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CO
* returns The command output data (packed in the Any object) * returns The command output data (packed in the Any object)
*/ */
//-------------------------------------------------------- //--------------------------------------------------------
CORBA::Any *faultClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) CORBA::Any *FaultClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{ {
TANGO_LOG_INFO << "faultClass::execute(): arrived" << std::endl; TANGO_LOG_INFO << "FaultClass::execute(): arrived" << std::endl;
((static_cast<SimulatedE2PS *>(device))->fault()); ((static_cast<SimulatedE2PS *>(device))->fault());
return new CORBA::Any(); return new CORBA::Any();
} }
...@@ -610,14 +610,14 @@ void SimulatedE2PSClass::command_factory() ...@@ -610,14 +610,14 @@ void SimulatedE2PSClass::command_factory()
Tango::OPERATOR); Tango::OPERATOR);
command_list.push_back(pAbortCmd); command_list.push_back(pAbortCmd);
// Command fault // Command Fault
faultClass *pfaultCmd = FaultClass *pFaultCmd =
new faultClass("fault", new FaultClass("Fault",
Tango::DEV_VOID, Tango::DEV_VOID, Tango::DEV_VOID, Tango::DEV_VOID,
"", "",
"", "",
Tango::EXPERT); Tango::EXPERT);
command_list.push_back(pfaultCmd); command_list.push_back(pFaultCmd);
/*----- PROTECTED REGION ID(SimulatedE2PSClass::command_factory_after) ENABLED START -----*/ /*----- PROTECTED REGION ID(SimulatedE2PSClass::command_factory_after) ENABLED START -----*/
/* clang-format on */ /* clang-format on */
......
...@@ -216,11 +216,11 @@ public: ...@@ -216,11 +216,11 @@ public:
{return (static_cast<SimulatedE2PS *>(dev))->is_Abort_allowed(any);} {return (static_cast<SimulatedE2PS *>(dev))->is_Abort_allowed(any);}
}; };
// Command fault class definition // Command Fault class definition
class faultClass : public Tango::Command class FaultClass : public Tango::Command
{ {
public: public:
faultClass(const char *cmd_name, FaultClass(const char *cmd_name,
Tango::CmdArgType in, Tango::CmdArgType in,
Tango::CmdArgType out, Tango::CmdArgType out,
const char *in_desc, const char *in_desc,
...@@ -228,15 +228,15 @@ public: ...@@ -228,15 +228,15 @@ public:
Tango::DispLevel level) Tango::DispLevel level)
:Command(cmd_name,in,out,in_desc,out_desc, level) {}; :Command(cmd_name,in,out,in_desc,out_desc, level) {};
faultClass(const char *cmd_name, FaultClass(const char *cmd_name,
Tango::CmdArgType in, Tango::CmdArgType in,
Tango::CmdArgType out) Tango::CmdArgType out)
:Command(cmd_name,in,out) {}; :Command(cmd_name,in,out) {};
~faultClass() {}; ~FaultClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<SimulatedE2PS *>(dev))->is_fault_allowed(any);} {return (static_cast<SimulatedE2PS *>(dev))->is_Fault_allowed(any);}
}; };
......
...@@ -185,7 +185,8 @@ bool SimulatedE2PS::is_On_allowed(TANGO_UNUSED(const CORBA::Any &any)) ...@@ -185,7 +185,8 @@ bool SimulatedE2PS::is_On_allowed(TANGO_UNUSED(const CORBA::Any &any))
bool SimulatedE2PS::is_Off_allowed(TANGO_UNUSED(const CORBA::Any &any)) bool SimulatedE2PS::is_Off_allowed(TANGO_UNUSED(const CORBA::Any &any))
{ {
// Compare device state with not allowed states. // Compare device state with not allowed states.
if (get_state()==Tango::UNKNOWN) if (get_state()==Tango::UNKNOWN ||
get_state()==Tango::FAULT)
{ {
/*----- PROTECTED REGION ID(SimulatedE2PS::OffStateAllowed) ENABLED START -----*/ /*----- PROTECTED REGION ID(SimulatedE2PS::OffStateAllowed) ENABLED START -----*/
/* clang-format on */ /* clang-format on */
...@@ -260,17 +261,17 @@ bool SimulatedE2PS::is_Abort_allowed(TANGO_UNUSED(const CORBA::Any &any)) ...@@ -260,17 +261,17 @@ bool SimulatedE2PS::is_Abort_allowed(TANGO_UNUSED(const CORBA::Any &any))
//-------------------------------------------------------- //--------------------------------------------------------
/** /**
* Method : SimulatedE2PS::is_fault_allowed() * Method : SimulatedE2PS::is_Fault_allowed()
* Description: Execution allowed for fault attribute * Description: Execution allowed for Fault attribute
*/ */
//-------------------------------------------------------- //--------------------------------------------------------
bool SimulatedE2PS::is_fault_allowed(TANGO_UNUSED(const CORBA::Any &any)) bool SimulatedE2PS::is_Fault_allowed(TANGO_UNUSED(const CORBA::Any &any))
{ {
// Not any excluded states for fault command. // Not any excluded states for Fault command.
/*----- PROTECTED REGION ID(SimulatedE2PS::faultStateAllowed) ENABLED START -----*/ /*----- PROTECTED REGION ID(SimulatedE2PS::FaultStateAllowed) ENABLED START -----*/
/* clang-format on */ /* clang-format on */
/* clang-format off */ /* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS::faultStateAllowed /*----- PROTECTED REGION END -----*/ // SimulatedE2PS::FaultStateAllowed
return true; return true;
} }
......
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