Skip to content

Commit

Permalink
add trigger left attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
lrlunin committed Apr 1, 2024
1 parent a22d476 commit 3d01081
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 3 deletions.
22 changes: 22 additions & 0 deletions src/tango-moenchcontrol/tangods/MoenchControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
// rx_tcp_port | Tango::DevLong64 Scalar
// detector_status | Tango::DevEnum Scalar
// rx_zmq_data_stream | Tango::DevBoolean Scalar
// triggers_left | Tango::DevLong64 Scalar
//================================================================

namespace MoenchControl_ns
Expand Down Expand Up @@ -158,6 +159,7 @@ void MoenchControl::delete_device()
delete[] attr_rx_tcp_port_read;
delete[] attr_detector_status_read;
delete[] attr_rx_zmq_data_stream_read;
delete[] attr_triggers_left_read;
}

//--------------------------------------------------------
Expand Down Expand Up @@ -194,6 +196,7 @@ void MoenchControl::init_device()
attr_rx_tcp_port_read = new Tango::DevLong64[1];
attr_detector_status_read = new detector_statusEnum[1];
attr_rx_zmq_data_stream_read = new Tango::DevBoolean[1];
attr_triggers_left_read = new Tango::DevLong64[1];
// No longer if mandatory property not set.
if (mandatoryNotDefined)
return;
Expand Down Expand Up @@ -1027,6 +1030,25 @@ void MoenchControl::write_rx_zmq_data_stream(Tango::WAttribute &attr)
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::write_rx_zmq_data_stream
}
//--------------------------------------------------------
/**
* Read attribute triggers_left related method
*
*
* Data type: Tango::DevLong64
* Attr type: Scalar
*/
//--------------------------------------------------------
void MoenchControl::read_triggers_left(Tango::Attribute &attr)
{
DEBUG_STREAM << "MoenchControl::read_triggers_left(Tango::Attribute &attr) entering... " << std::endl;
/*----- PROTECTED REGION ID(MoenchControl::read_triggers_left) ENABLED START -----*/
/* clang-format on */
*attr_triggers_left_read = detector_ptr->getNumberOfTriggersLeft().front();
attr.set_value(attr_triggers_left_read);
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::read_triggers_left
}

//--------------------------------------------------------
/**
Expand Down
14 changes: 12 additions & 2 deletions src/tango-moenchcontrol/tangods/MoenchControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class MoenchControl : public TANGO_BASE_CLASS
Tango::DevLong64 *attr_rx_tcp_port_read;
detector_statusEnum *attr_detector_status_read;
Tango::DevBoolean *attr_rx_zmq_data_stream_read;
Tango::DevLong64 *attr_triggers_left_read;

// Constructors and destructors
public:
Expand Down Expand Up @@ -232,7 +233,7 @@ class MoenchControl : public TANGO_BASE_CLASS
//--------------------------------------------------------
virtual void write_attr_hardware(std::vector<long> &attr_list);

virtual bool is_detector_read_write_allowed();
virtual bool is_detector_read_write_allowed();

/**
* Attribute exposure related methods
Expand Down Expand Up @@ -383,6 +384,15 @@ class MoenchControl : public TANGO_BASE_CLASS
virtual void read_rx_zmq_data_stream(Tango::Attribute &attr);
virtual void write_rx_zmq_data_stream(Tango::WAttribute &attr);
virtual bool is_rx_zmq_data_stream_allowed(Tango::AttReqType type);
/**
* Attribute triggers_left related methods
*
*
* Data type: Tango::DevLong64
* Attr type: Scalar
*/
virtual void read_triggers_left(Tango::Attribute &attr);
virtual bool is_triggers_left_allowed(Tango::AttReqType type);


//--------------------------------------------------------
Expand Down Expand Up @@ -413,7 +423,7 @@ class MoenchControl : public TANGO_BASE_CLASS
virtual void stop_acquire();
virtual bool is_stop_acquire_allowed(const CORBA::Any &any);

virtual void check_stop_in_backgroud();
virtual void check_stop_in_backgroud();


//--------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions src/tango-moenchcontrol/tangods/MoenchControl.xmi
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="triggers_left" attType="Scalar" rwType="READ" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:LongType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="triggers left" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<preferences docHome="./doc_html" makefileHome="/usr/local/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
23 changes: 23 additions & 0 deletions src/tango-moenchcontrol/tangods/MoenchControlClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,29 @@ void MoenchControlClass::attribute_factory(std::vector<Tango::Attr *> &att_list)
rx_zmq_data_stream->set_memorized_init(true);
att_list.push_back(rx_zmq_data_stream);

// Attribute : triggers_left
triggers_leftAttrib *triggers_left = new triggers_leftAttrib();
Tango::UserDefaultAttrProp triggers_left_prop;
// description not set for triggers_left
triggers_left_prop.set_label("triggers left");
// unit not set for triggers_left
// standard_unit not set for triggers_left
// display_unit not set for triggers_left
// format not set for triggers_left
// max_value not set for triggers_left
// min_value not set for triggers_left
// max_alarm not set for triggers_left
// min_alarm not set for triggers_left
// max_warning not set for triggers_left
// min_warning not set for triggers_left
// delta_t not set for triggers_left
// delta_val not set for triggers_left
triggers_left->set_default_properties(triggers_left_prop);
// Not Polled
triggers_left->set_disp_level(Tango::EXPERT);
// Not Memorized
att_list.push_back(triggers_left);


// Create a list of static attributes
create_static_attribute_list(get_class_attr()->get_attr_list());
Expand Down
13 changes: 13 additions & 0 deletions src/tango-moenchcontrol/tangods/MoenchControlClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ class rx_zmq_data_streamAttrib: public Tango::Attr
{return (static_cast<MoenchControl *>(dev))->is_rx_zmq_data_stream_allowed(ty);}
};

// Attribute triggers_left class definition
class triggers_leftAttrib: public Tango::Attr
{
public:
triggers_leftAttrib():Attr("triggers_left",
Tango::DEV_LONG64, Tango::READ) {};
~triggers_leftAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<MoenchControl *>(dev))->read_triggers_left(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<MoenchControl *>(dev))->is_triggers_left_allowed(ty);}
};


//=========================================
// Define classes for commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,10 @@ bool MoenchControl::is_stop_acquire_allowed(TANGO_UNUSED(const CORBA::Any &any))

/*----- PROTECTED REGION ID(MoenchControl::MoenchControlStateAllowed.AdditionalMethods) ENABLED START -----*/
/* clang-format on */
// Additional Methods
bool MoenchControl::is_triggers_left_allowed(TANGO_UNUSED(const Tango::AttReqType type))
{
return true;
}
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // MoenchControl::MoenchControlStateAllowed.AdditionalMethods

Expand Down

0 comments on commit 3d01081

Please sign in to comment.