Skip to content

Commit

Permalink
add is_allowed for detector read&write methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lrlunin committed Apr 1, 2024
1 parent a207831 commit a22d476
Show file tree
Hide file tree
Showing 3 changed files with 312 additions and 303 deletions.
2 changes: 2 additions & 0 deletions src/tango-moenchcontrol/tangods/MoenchControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ class MoenchControl : public TANGO_BASE_CLASS
//--------------------------------------------------------
virtual void write_attr_hardware(std::vector<long> &attr_list);

virtual bool is_detector_read_write_allowed();

/**
* Attribute exposure related methods
*
Expand Down
37 changes: 22 additions & 15 deletions src/tango-moenchcontrol/tangods/MoenchControlStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
//=============================================================================

#include "MoenchControl.h"
#include "sls/sls_detector_defs.h"

/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::MoenchControlStateMachine.cpp
Expand All @@ -45,7 +46,13 @@ namespace MoenchControl_ns
//=================================================
// Attributes Allowed Methods
//=================================================

bool MoenchControl::is_detector_read_write_allowed(){
auto detector_status = detector_ptr->getDetectorStatus().front();
return (detector_status == slsDetectorDefs::runStatus::IDLE ||
detector_status == slsDetectorDefs::runStatus::RUN_FINISHED ||
detector_status == slsDetectorDefs::runStatus::STOPPED
);
}
//--------------------------------------------------------
/**
* Method : MoenchControl::is_exposure_allowed()
Expand All @@ -65,7 +72,7 @@ bool MoenchControl::is_exposure_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::exposureStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -87,7 +94,7 @@ bool MoenchControl::is_delay_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::delayStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -109,7 +116,7 @@ bool MoenchControl::is_timing_mode_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::timing_modeStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -131,7 +138,7 @@ bool MoenchControl::is_triggers_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::triggersStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -153,7 +160,7 @@ bool MoenchControl::is_frames_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::framesStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -175,7 +182,7 @@ bool MoenchControl::is_high_voltage_allowed(TANGO_UNUSED(Tango::AttReqType type)
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::high_voltageStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -197,7 +204,7 @@ bool MoenchControl::is_gain_mode_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::gain_modeStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -219,7 +226,7 @@ bool MoenchControl::is_period_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::periodStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -241,7 +248,7 @@ bool MoenchControl::is_zmq_rx_ip_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::zmq_rx_ipStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -263,7 +270,7 @@ bool MoenchControl::is_zmq_rx_port_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::zmq_rx_portStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -285,7 +292,7 @@ bool MoenchControl::is_rx_discard_policy_allowed(TANGO_UNUSED(Tango::AttReqType
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::rx_discard_policyStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -307,7 +314,7 @@ bool MoenchControl::is_rx_hostname_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::rx_hostnameStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand All @@ -329,7 +336,7 @@ bool MoenchControl::is_rx_tcp_port_allowed(TANGO_UNUSED(Tango::AttReqType type))
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::rx_tcp_portStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}

//--------------------------------------------------------
Expand Down Expand Up @@ -368,7 +375,7 @@ bool MoenchControl::is_rx_zmq_data_stream_allowed(TANGO_UNUSED(Tango::AttReqType
/* clang-format on */
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::rx_zmq_data_streamStateAllowed_READ
return true;
return is_detector_read_write_allowed();
}


Expand Down
Loading

0 comments on commit a22d476

Please sign in to comment.