Skip to content
Snippets Groups Projects
Commit 218b8e99 authored by Lucio Zambon's avatar Lucio Zambon
Browse files

Initial import

parent 658b246c
No related branches found
Tags 1.0.0
No related merge requests found
include(/usr/local/qtango/include/qtango6/qtango.pri)
# include(/runtime/elettra/include/qtango4/qtango.pri)
# include(../../../../utils/qmake.custom.3)
SUBDIRS += src
TEMPLATE = app
CONFIG += release
SOURCES += src/acsguntrigger.cpp \
src/main.cpp
HEADERS += src/acsguntrigger.h
FORMS = src/acsguntrigger.ui
TARGET = bin/acsguntrigger
MOC_DIR = moc
OBJECTS_DIR = obj
#INCLUDEPATH = src /usr/local/tango/include /usr/local/omniorb/include /runtime/elettra/include /usr/local/qwt/include
# LIBS = -L/runtime/elettra/lib -lQTango
#LIBS = -L/runtime/elettra/lib -lqtcontrols -L/usr/local/tango/lib -L/usr/local/omniorb/lib -ltango -llog4tango -lomniORB4 -lomniDynamic4 -lomnithread
unix:LIBS -= $${QTANGOLIBS}
inst.files = $${TARGET}
inst.path = $${INSTALL_ROOT}/fermi/panels/bin
INSTALLS += inst
/***************************************************************************
* Copyright (C) 2007 by *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "acsguntrigger.h"
#include <qtango.h>
char tmBuffer[80];
/*
timestamp()
send a timestamp to standard output
*/
void timestamp()
{
struct tm *mytime;
time_t myTime_t;
myTime_t = time(NULL);
mytime = localtime(&myTime_t);
strftime(tmBuffer, 79, "%Y-%m-%d %H:%M:%S ", mytime);
return;
}
acsguntrigger::acsguntrigger(QWidget *parent) : QWidget(parent)
{
// setup User Interface
try {
ui.setupUi(this);
}
catch (const Tango::DevFailed &e) {
timestamp();
cout << tmBuffer << "cannot setup UI" << endl;
}
catch (...) {
timestamp();
cout << tmBuffer << "default exception, cannot setup UI" << endl;
}
// connect to control access server
try {
// plc_server = new Tango::DeviceProxy("ken/plcaccess/0");
plc_server = new Tango::DeviceProxy("booster/accessi/plc_accessi");
}
catch (const Tango::DevFailed &e) {
timestamp();
cout << tmBuffer << "Fatal Error: Access Control Device Server not responding, the application will be terminated immediately" << endl;
exit(1);
}
catch (...) {
timestamp();
cout << tmBuffer << "Fatal Error: Access Control Device Server not responding, the application will be terminated immediately" << endl;
exit(1);
}
refresh();
// init timer
try {
timer = new QTimer(this);
timer->setInterval(1000);
timer->setSingleShot(false);
connect(timer, SIGNAL(timeout()), this, SLOT(refresh()));
timer->start();
}
catch (const Tango::DevFailed &e) {
timestamp();
cout << tmBuffer << "cannot connect UI" << endl;
}
catch (...) {
timestamp();
cout << tmBuffer << "default exception, cannot setup UI" << endl;
}
}
acsguntrigger::~acsguntrigger()
{
}
int acsguntrigger::myReadAttribute(const char *attrName)
{
try {
myAttribute = plc_server->read_attribute(attrName);
return 1;
}
catch (const Tango::DevFailed &e) {
timestamp();
cout << "error reading attribute: " << attrName << endl;
}
catch (...) {
timestamp();
cout << tmBuffer << "default exception reading attribute: " << attrName << endl;
}
return 0;
}
void acsguntrigger::refresh()
{
vector<bool> stat;
bool buf = false;
// stat.size(30);
Tango::DeviceAttribute StateFlags;
if (myReadAttribute("Check_guntr_abi")) {
myAttribute >> stat;
ui.checkBox_0->setCheckState(stat[0]? Qt::Checked: Qt::Unchecked);
ui.checkBox_1->setCheckState(stat[1]? Qt::Checked: Qt::Unchecked);
ui.checkBox_2->setCheckState(stat[2]? Qt::Checked: Qt::Unchecked);
ui.checkBox_3->setCheckState(stat[3]? Qt::Checked: Qt::Unchecked);
ui.checkBox_4->setCheckState(stat[4]? Qt::Checked: Qt::Unchecked);
ui.checkBox_5->setCheckState(stat[5]? Qt::Checked: Qt::Unchecked);
ui.checkBox_6->setCheckState(stat[6]? Qt::Checked: Qt::Unchecked);
ui.checkBox_7->setCheckState(stat[7]? Qt::Checked: Qt::Unchecked);
ui.checkBox_8->setCheckState(stat[8]? Qt::Checked: Qt::Unchecked);
ui.checkBox_9->setCheckState(stat[9]? Qt::Checked: Qt::Unchecked);
ui.checkBox_10->setCheckState(stat[10]? Qt::Checked: Qt::Unchecked);
ui.checkBox_11->setCheckState(stat[11]? Qt::Checked: Qt::Unchecked);
ui.checkBox_12->setCheckState(stat[12]? Qt::Checked: Qt::Unchecked);
ui.checkBox_13->setCheckState(stat[13]? Qt::Checked: Qt::Unchecked);
ui.checkBox_14->setCheckState(stat[14]? Qt::Checked: Qt::Unchecked);
// Iniezione abilitata da scraper anello sez.5 + sez.7
// ui.checkBox_15->setCheckState(stat[15]? Qt::Checked: Qt::Unchecked);
// ui.checkBox_16->setCheckState(stat[16]? Qt::Checked: Qt::Unchecked);
ui.checkBox_17->setCheckState(stat[17]? Qt::Checked: Qt::Unchecked);
ui.checkBox_18->setCheckState(stat[18]? Qt::Checked: Qt::Unchecked);
ui.checkBox_19->setCheckState(stat[19]? Qt::Checked: Qt::Unchecked);
ui.checkBox_20->setCheckState(stat[20]? Qt::Checked: Qt::Unchecked);
ui.checkBox_21->setCheckState(stat[21]? Qt::Checked: Qt::Unchecked);
ui.checkBox_22->setCheckState(stat[22]? Qt::Checked: Qt::Unchecked);
ui.checkBox_23->setCheckState(stat[23]? Qt::Checked: Qt::Unchecked);
ui.checkBox_24->setCheckState(stat[24]? Qt::Checked: Qt::Unchecked);
ui.checkBox_25->setCheckState(stat[25]? Qt::Checked: Qt::Unchecked);
ui.checkBox_26->setCheckState(stat[26]? Qt::Checked: Qt::Unchecked);
ui.checkBox_27->setCheckState(stat[27]? Qt::Checked: Qt::Unchecked);
ui.checkBox_28->setCheckState(stat[28]? Qt::Checked: Qt::Unchecked);
ui.checkBox_29->setCheckState(stat[29]? Qt::Checked: Qt::Unchecked);
}
if (myReadAttribute("Topup_err")) {
myAttribute >> stat;
ui.checkBox_30->setCheckState(!stat[4]? Qt::Checked: Qt::Unchecked);
}
if (myReadAttribute("Check_inj_sr")) {
myAttribute >> stat;
ui.checkBox_31->setCheckState(stat[13]? Qt::Checked: Qt::Unchecked);
}
}
/***************************************************************************
* Copyright (C) 2007 by *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef acsguntrigger_H
#define acsguntrigger_H
#include "ui_acsguntrigger.h"
#include <tango.h>
#include <QProcess>
class acsguntrigger: public QWidget
{
Q_OBJECT
public:
acsguntrigger(QWidget * =NULL);
~acsguntrigger();
public slots:
void refresh();
private:
Ui::acsguntrigger ui;
QTimer *timer;
Tango::DeviceAttribute myAttribute;
Tango::DeviceProxy *plc_server;
int myReadAttribute(const char *);
};
#endif
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2007 by *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QApplication>
#include "acsguntrigger.h"
#include <X11/Xlib.h>
#include <QX11Info>
#define CVSVERSION "$Name: $"
int main( int argc, char ** argv ) {
QApplication a( argc, argv );
a.setApplicationVersion(CVSVERSION);
acsguntrigger mw;
mw.show();
/* register to window manager */
Display *disp = QX11Info::display();
Window root_win = (Window) mw.winId();
XSetCommand(disp, root_win, argv, argc);
return a.exec();
}
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