Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cs/ds/alarm-handler
  • francesco.tripaldi/alarm-handler
2 results
Show changes
Showing
with 10989 additions and 607 deletions
docs/images/alarm_ng.png

206 KiB

docs/images/alarm_ng_history.png

78.6 KiB

docs/images/alarm_notify_properties.png

11.7 KiB

docs/images/free_properties.png

68.8 KiB

<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="Alarm" pogoRevision="9.1">
<description description="Elettra alarm device server" title="Elettra alarm device server" sourcePath="/home/graziano/workspace/git/alarm/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_4Impl" sourcePath=""/>
<identification contact="at elettra.eu - graziano.scalamera" author="graziano.scalamera" emailDomain="elettra.eu" classFamily="SoftwareSystem" siteSpecific="" platform="Unix Like" bus="Not Applicable" manufacturer="" reference=""/>
</description>
<deviceProperties name="AlarmStatus" description="Persistent storage of the alarms status">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="GroupNames" description="Labels for Group mask, first is for mask 0x00">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="ErrThreshold" description="Threshold for Tango error for being internal alarms">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="DbHost" description="Host of the MySQL db">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="DbUser" description="Username for the MySQL db">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="DbPasswd" description="Password for the MySQL db">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="DbName" description="Db name for the MySQL db">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="DbPort" description="Port of the MySQL db">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="InstanceName" description="Name used to associate configured alarm rules to this instance">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="SubscribeRetryPeriod" description="retry period in seconds">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its &lt;i>device_state&lt;/i> data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none.">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="State Code">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its &lt;i>device_status&lt;/i> data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none.">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Status description">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
</commands>
<commands name="Ack" description="Alarm acknowledge" execMethod="ack" displayLevel="OPERATOR" polledPeriod="0">
<argin description="String array containing the alarms to be acknowledged">
<type xsi:type="pogoDsl:StringArrayType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Load" description="Load a new alarm." execMethod="load" displayLevel="OPERATOR" polledPeriod="0">
<argin description="Alarm entry">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Remove" description="Remove alarm." execMethod="remove" displayLevel="OPERATOR" polledPeriod="0">
<argin description="Alarm name">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Configured" description="Alarms configured" execMethod="configured" displayLevel="OPERATOR" polledPeriod="0">
<argin description="String containing a filter for output, if empty return all alarms">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="Alarms configured">
<type xsi:type="pogoDsl:StringArrayType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="StopNew" description="Remove &quot;NEW&quot; field from alarm string (so alarm panel stop sound)" execMethod="stop_new" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Silence" description="Alarm temporarily silence" execMethod="silence" displayLevel="OPERATOR" polledPeriod="0">
<argin description="String array containing the alarms to be silenced">
<type xsi:type="pogoDsl:StringArrayType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Modify" description="Modify an existing alarm." execMethod="modify" displayLevel="OPERATOR" polledPeriod="0">
<argin description="Alarm entry">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<attributes name="alarm" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="1024" maxY="0">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<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>
<dynamicAttributes name="AlarmState" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="true">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="true" libCheckCriteria="true"/>
<archiveEvent fire="true" libCheckCriteria="true"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</dynamicAttributes>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.2.2/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*----- PROTECTED REGION ID(Alarm::DynAttrUtils.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: $";
/*----- PROTECTED REGION ID(AlarmHandler::DynAttrUtils.cpp) ENABLED START -----*/
//=============================================================================
//
// file : AlarmDynAttrUtils.cpp
// file : AlarmHandlerDynAttrUtils.cpp
//
// description : Dynamic attributes utilities file for the Alarm class
// description : Dynamic attributes utilities file for the AlarmHandler class
//
// project : Elettra alarm device server
// project : Elettra alarm handler device server
//
// This file is part of Tango device class.
//
......@@ -23,12 +22,7 @@ static const char *RcsId = "$Id: $";
// You should have received a copy of the GNU General Public License
// along with Tango. If not, see <http://www.gnu.org/licenses/>.
//
// $Author: $
//
// $Revision: $
// $Date: $
//
// $HeadURL: $
//
//=============================================================================
// This file is generated by POGO
......@@ -36,18 +30,19 @@ static const char *RcsId = "$Id: $";
//=============================================================================
#include <Alarm.h>
#include <AlarmClass.h>
#include <AlarmHandler.h>
#include <AlarmHandlerClass.h>
/*----- PROTECTED REGION END -----*/ // Alarm::DynAttrUtils.cpp
/*----- PROTECTED REGION END -----*/ // AlarmHandler::DynAttrUtils.cpp
//================================================================
// Attributes managed is:
// Attributes managed are:
//================================================================
// AlarmState | Tango::DevBoolean Scalar
// AlarmState | Tango::DevEnum Scalar
// AlarmFormula | Tango::DevString Scalar
//================================================================
// For compatibility reason, this file (AlarmDynAttrUtils)
// For compatibility reason, this file (AlarmHandlerDynAttrUtils)
// manage also the dynamic command utilities.
//================================================================
// The following table gives the correspondence
......@@ -57,7 +52,7 @@ static const char *RcsId = "$Id: $";
//================================================================
//================================================================
namespace Alarm_ns
namespace AlarmHandler_ns
{
//=============================================================
// Add/Remove dynamic attribute methods
......@@ -70,7 +65,7 @@ namespace Alarm_ns
* parameter attname: attribute name to be cretated and added.
*/
//--------------------------------------------------------
void Alarm::add_AlarmState_dynamic_attribute(string attname)
void AlarmHandler::add_AlarmState_dynamic_attribute(string attname)
{
// Attribute : AlarmState
AlarmStateAttrib *alarmstate = new AlarmStateAttrib(attname);
......@@ -90,17 +85,38 @@ void Alarm::add_AlarmState_dynamic_attribute(string attname)
// delta_t not set for AlarmState
// delta_val not set for AlarmState
/*----- PROTECTED REGION ID(Alarm::att_AlarmState_dynamic_attribute) ENABLED START -----*/
/*----- PROTECTED REGION ID(AlarmHandler::att_AlarmState_dynamic_attribute) ENABLED START -----*/
DEBUG_STREAM << __func__<<": entering name="<<attname;
alarm_container_t::iterator i = alarms.v_alarm.find(attname);
if(i != alarms.v_alarm.end())
{
alarmstate_prop.set_description(i->second.formula.c_str());
}
else
{
INFO_STREAM << __func__<<": name="<<attname<<" NOT FOUND while looking for formula to add as attribute description";
}
/*----- PROTECTED REGION END -----*/ // Alarm::att_AlarmState_dynamic_attribute
/*----- PROTECTED REGION END -----*/ // AlarmHandler::att_AlarmState_dynamic_attribute
{
vector<string> labels;
labels.push_back("NORM");
labels.push_back("UNACK");
labels.push_back("ACKED");
labels.push_back("RTNUN");
labels.push_back("SHLVD");
labels.push_back("DSUPR");
labels.push_back("OOSRV");
labels.push_back("ERROR");
alarmstate_prop.set_enum_labels(labels);
}
alarmstate->set_default_properties(alarmstate_prop);
// Not Polled
alarmstate->set_disp_level(Tango::OPERATOR);
// Not Memorized
alarmstate->set_change_event(true, true);
alarmstate->set_archive_event(true, true);
AlarmState_data.insert(make_pair(attname, false));
AlarmState_data.insert(make_pair(attname, 0));
add_attribute(alarmstate);
}
//--------------------------------------------------------
......@@ -110,18 +126,79 @@ void Alarm::add_AlarmState_dynamic_attribute(string attname)
* parameter attname: attribute name to be removed.
*/
//--------------------------------------------------------
void Alarm::remove_AlarmState_dynamic_attribute(string attname)
void AlarmHandler::remove_AlarmState_dynamic_attribute(string attname)
{
remove_attribute(attname, true);
map<string,Tango::DevBoolean>::iterator ite;
remove_attribute(attname, true, Tango::Util::instance()->_UseDb);
map<string,Tango::DevEnum>::iterator ite;
if ((ite=AlarmState_data.find(attname))!=AlarmState_data.end())
{
/*----- PROTECTED REGION ID(Alarm::remove_AlarmState_dynamic_attribute) ENABLED START -----*/
/*----- PROTECTED REGION ID(AlarmHandler::remove_AlarmState_dynamic_attribute) ENABLED START -----*/
DEBUG_STREAM << __func__<<": entering name="<<attname;
/*----- PROTECTED REGION END -----*/ // Alarm::remove_AlarmState_dynamic_attribute
/*----- PROTECTED REGION END -----*/ // AlarmHandler::remove_AlarmState_dynamic_attribute
AlarmState_data.erase(ite);
}
}
//--------------------------------------------------------
/**
* Add a AlarmFormula dynamic attribute.
*
* parameter attname: attribute name to be cretated and added.
*/
//--------------------------------------------------------
void AlarmHandler::add_AlarmFormula_dynamic_attribute(string attname)
{
// Attribute : AlarmFormula
AlarmFormulaAttrib *alarmformula = new AlarmFormulaAttrib(attname);
Tango::UserDefaultAttrProp alarmformula_prop;
// description not set for AlarmFormula
// label not set for AlarmFormula
// unit not set for AlarmFormula
// standard_unit not set for AlarmFormula
// display_unit not set for AlarmFormula
// format not set for AlarmFormula
// max_value not set for AlarmFormula
// min_value not set for AlarmFormula
// max_alarm not set for AlarmFormula
// min_alarm not set for AlarmFormula
// max_warning not set for AlarmFormula
// min_warning not set for AlarmFormula
// delta_t not set for AlarmFormula
// delta_val not set for AlarmFormula
/*----- PROTECTED REGION ID(AlarmHandler::att_AlarmFormula_dynamic_attribute) ENABLED START -----*/
DEBUG_STREAM << __func__<<": entering name="<<attname;
/*----- PROTECTED REGION END -----*/ // AlarmHandler::att_AlarmFormula_dynamic_attribute
alarmformula->set_default_properties(alarmformula_prop);
// Not Polled
alarmformula->set_disp_level(Tango::OPERATOR);
// Not Memorized
alarmformula->set_change_event(true, true);
alarmformula->set_archive_event(true, true);
char array[1];
array[0] = '\0';
AlarmFormula_data.insert(make_pair(attname, array));
add_attribute(alarmformula);
}
//--------------------------------------------------------
/**
* remove a AlarmFormula dynamic attribute.
*
* parameter attname: attribute name to be removed.
*/
//--------------------------------------------------------
void AlarmHandler::remove_AlarmFormula_dynamic_attribute(string attname)
{
remove_attribute(attname, true, Tango::Util::instance()->_UseDb);
map<string,Tango::DevString>::iterator ite;
if ((ite=AlarmFormula_data.find(attname))!=AlarmFormula_data.end())
{
/*----- PROTECTED REGION ID(AlarmHandler::remove_AlarmFormula_dynamic_attribute) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmHandler::remove_AlarmFormula_dynamic_attribute
AlarmFormula_data.erase(ite);
}
}
//============================================================
......@@ -134,9 +211,9 @@ void Alarm::remove_AlarmState_dynamic_attribute(string attname)
* parameter attname: the specified attribute name.
*/
//--------------------------------------------------------
Tango::DevBoolean *Alarm::get_AlarmState_data_ptr(string &name)
Tango::DevEnum *AlarmHandler::get_AlarmState_data_ptr(string &name)
{
map<string,Tango::DevBoolean>::iterator ite;
map<string,Tango::DevEnum>::iterator ite;
if ((ite=AlarmState_data.find(name))==AlarmState_data.end())
{
TangoSys_OMemStream tms;
......@@ -144,7 +221,28 @@ Tango::DevBoolean *Alarm::get_AlarmState_data_ptr(string &name)
Tango::Except::throw_exception(
(const char *)"ATTRIBUTE_NOT_FOUND",
tms.str().c_str(),
(const char *)"Alarm::get_AlarmState_data_ptr()");
(const char *)"AlarmHandler::get_AlarmState_data_ptr()");
}
return &(ite->second);
}
//--------------------------------------------------------
/**
* Return a pointer on AlarmFormula data.
*
* parameter attname: the specified attribute name.
*/
//--------------------------------------------------------
Tango::DevString *AlarmHandler::get_AlarmFormula_data_ptr(string &name)
{
map<string,Tango::DevString>::iterator ite;
if ((ite=AlarmFormula_data.find(name))==AlarmFormula_data.end())
{
TangoSys_OMemStream tms;
tms << "Dynamic attribute " << name << " has not been created";
Tango::Except::throw_exception(
(const char *)"ATTRIBUTE_NOT_FOUND",
tms.str().c_str(),
(const char *)"AlarmHandler::get_AlarmFormula_data_ptr()");
}
return &(ite->second);
}
......
This diff is collapsed.
This diff is collapsed.
cmake_minimum_required(VERSION 3.2)
# source files
set(SRC_FILES ${SRC_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/AlarmHandler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AlarmHandlerClass.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AlarmHandlerDynAttrUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AlarmHandlerStateMachine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/alarm_table.cpp
${CMAKE_CURRENT_SOURCE_DIR}/alarm-thread.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ClassFactory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cmd_thread.cpp
${CMAKE_CURRENT_SOURCE_DIR}/event_table.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SubscribeThread.cpp
${CMAKE_CURRENT_SOURCE_DIR}/update-thread.cpp
PARENT_SCOPE)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* alarm-thread.h
*
* $Author: graziano $
*
* $Revision: 1.3 $
*
* $Log: alarm-thread.h,v $
* Revision 1.3 2008-04-23 15:00:57 graziano
* small code cleanings
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
......@@ -20,8 +10,8 @@
#define ALARM_THREAD_H
#include <omnithread.h>
#include <tango.h>
#include <Alarm.h>
#include <tango/tango.h>
#include <AlarmHandler.h>
#define ALARM_THREAD_EXIT "alarm_thread_exit"
#define ALARM_THREAD_EXIT_VALUE -100
......@@ -30,13 +20,13 @@
class alarm_thread : public omni_thread {
public:
alarm_thread(Alarm_ns::Alarm *p);
alarm_thread(AlarmHandler_ns::AlarmHandler *p);
~alarm_thread();
//int period;
protected:
void run(void *);
private:
Alarm_ns::Alarm *p_Alarm;
AlarmHandler_ns::AlarmHandler *p_Alarm;
};
#endif /* ALARM_THREAD_H */
......
This diff is collapsed.