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 4141 additions and 42 deletions
/*
* update-thread.cpp
*
* $Author: claudio $
*
* $Revision: 1.2 $
*
* $Log: update-thread.cpp,v $
* Revision 1.2 2013-03-06 10:38:43 claudio
* commented out debug print statements
*
* Revision 1.1 2008-11-10 10:54:09 graziano
* thread for update of alarms with time threshold > 0
*
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
*/
#include "update-thread.h"
......@@ -26,9 +8,9 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.2 $";
/*
* alarm_thread::alarm_thread()
*/
update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p)
update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p),Tango::LogAdapter(p)
{
//cout << __FILE__rev << endl;
//TANGO_LOG << __FILE__rev << endl;
}
/*
......@@ -36,6 +18,7 @@ update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p)
*/
update_thread::~update_thread()
{
DEBUG_STREAM << __func__ << "update_thread::~update_thread(): entering!" << endl;
p_Alarm = NULL;
}
......@@ -44,6 +27,7 @@ update_thread::~update_thread()
*/
void update_thread::run(void *)
{
DEBUG_STREAM << __func__ << "update_thread::run(): entering!" << endl;
//printf("update_thread::run(): running...\n");
unsigned int pausasec, pausanano;
pausasec=1;
......@@ -52,14 +36,23 @@ void update_thread::run(void *)
while (!p_Alarm->abortflag) {
try
{
omni_thread::sleep(pausasec,pausanano);
p_Alarm->timer_update();
//omni_thread::sleep(pausasec,pausanano);
abort_sleep(pausasec+(double)pausanano/1000000000);
if(!p_Alarm->abortflag)
p_Alarm->timer_update();
//printf("update_thread::run(): TIMER!!\n");
}
catch(...)
{
printf("update_thread::run(): catched unknown exception!!\n");
INFO_STREAM << "update_thread::run(): catched unknown exception!!";
}
}
//cout << "update_thread::run(): exiting!" << endl;
DEBUG_STREAM << "update_thread::run(): exiting!" << endl;
} /* update_thread::run() */
void update_thread::abort_sleep(double time)
{
omni_mutex_lock sync(*this);
long time_millis = (long)(time*1000);
int res = wait(time_millis);
}
/*
* alarm-thread.h
*
* $Author: graziano $
*
* $Revision: 1.1 $
*
* $Log: update-thread.h,v $
* Revision 1.1 2008-11-10 10:54:09 graziano
* thread for update of alarms with time threshold > 0
*
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
* update-thread.h
*/
#ifndef UPDATE_THREAD_H
#define UPDATE_THREAD_H
#include <omnithread.h>
#include <tango.h>
#include <tango/tango.h>
#include <AlarmHandler.h>
class update_thread : public omni_thread {
class update_thread : public omni_thread, public Tango::TangoMonitor, public Tango::LogAdapter {
public:
update_thread(AlarmHandler_ns::AlarmHandler *p);
~update_thread();
protected:
void run(void *);
private:
void abort_sleep(double time);
AlarmHandler_ns::AlarmHandler *p_Alarm;
};
......
cmake_minimum_required(VERSION 3.2)
project(test NONE)
include(ExternalProject)
ExternalProject_Add(testdevice
SOURCE_DIR ${CMAKE_SOURCE_DIR}/test/testdevice
# PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}"
# INSTALL_DIR ${CMAKE_BINARY_DIR}
# BINARY_DIR ${CMAKE_BINARY_DIR}
# STEP_TARGETS build
# EXCLUDE_FROM_ALL TRUE
)
ExternalProject_Get_property(testdevice SOURCE_DIR)
message("Source dir of testdevice = ${SOURCE_DIR}")
ExternalProject_Get_property(testdevice INSTALL_DIR)
message("Install dir of testdevice = ${INSTALL_DIR}")
ExternalProject_Get_property(testdevice BINARY_DIR)
message("Binary dir of testdevice = ${BINARY_DIR}")
ExternalProject_Get_property(testdevice CMAKE_ARGS)
message("CMqke args for testdevice = ${CMAKE_ARGS}")
#ExternalProject_Get_property(testdevice PREFIX)
#message("Prefix dir of testdevice = ${PREFIX}")
{
"_version": 1,
"_source": "ConfigInjectorDiag.xls",
"_title": "hdbpp mysql innodb test",
"_date": "2020-07-07 14:45:04",
"servers": {
"alarm-handler-srv/01": {
"AlarmHandler": {
"alarm/handler/01": {
"properties": {
},
"attribute_properties": {
}
}
}
},
"testdevice-srv/01": {
"TestDevice": {
"alarm/test/01": {
"properties": {
"Attr_config": [
"condition:bool:0:0.0"
]
},
"attribute_properties": {
}
}
}
}
},
"classes": {
"AlarmHandler": {
"properties": {
"GroupNames": ["gr_none","gr_test"],
"StatisticsTimeWindow": ["60"],
"SubscribeRetryPeriod": ["30"]
}
},
"TestDevice": {
"properties": {
}
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
NAME_SRV = testdevice-srv
CXXFLAGS =
LDFLAGS =
include ./Make-9.3.4.in
# Project Name
testdevice
## Description
Tango device server for storing and distributing a number of variables as device attributes.
## Installation
See your institue guidelines for deploying and configuring a Tango device server.
## Usage
The server is dynamically configured by means of dedicated Methods. The configuration and values are stored in the Tango Database and restored at server restart.
A typical usage is to store and distribute the results of measurments or simulations to a number of differet clients.
## History
## Credits
Elettra-Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
## License
GPL 3
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.