mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-01 16:39:41 +02:00
2014-10-07 Fred Gleason <fredg@paravelsystems.com>
* Added a 'GPIO_EVENTS' table to the database. * Incremented the database version to 240. * Implemented GPIO event logging in 'ripcd/local_macros.cpp' and 'ripcd/ripcd.h'. * Added an 'Events Log' area to RDGpiMon(1) in 'utils/rdgpimon/rdgpimon.cpp' and 'utils/rdgpimon/rdgpimon.h'. * Added code in rdmaint(1) to purge logged GPIO events in 'utils/rdmaint/rdmaint.cpp' and 'utils/rdmaint/rdmaint.h'.
This commit is contained in:
parent
d244ef75af
commit
4189ce7bb1
11
ChangeLog
11
ChangeLog
@ -14504,7 +14504,7 @@
|
|||||||
'rdlogmanager/edit_clock.h' [GitHub pull request #000030].
|
'rdlogmanager/edit_clock.h' [GitHub pull request #000030].
|
||||||
2014-09-24 Fred Gleason <fredg@paravelsystems.com>
|
2014-09-24 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Applied a patch from albanpeignier for RDLogEdit that appends
|
* Applied a patch from albanpeignier for RDLogEdit that appends
|
||||||
a new cart to a log if 'Add' is touch with no long line highlighted
|
a new cart to a log if 'Add' is touched with no log line highlighted
|
||||||
[GitHub pull request #000031.
|
[GitHub pull request #000031.
|
||||||
2014-09-24 Fred Gleason <fredg@paravelsystems.com>
|
2014-09-24 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Added code in 'rdlogedit/edit_log.cpp' to append a cart to the
|
* Added code in 'rdlogedit/edit_log.cpp' to append a cart to the
|
||||||
@ -14512,3 +14512,12 @@
|
|||||||
2014-09-24 Fred Gleason <fredg@paravelsystems.com>
|
2014-09-24 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Applied a patch from smowton that fixed a clashing id problem
|
* Applied a patch from smowton that fixed a clashing id problem
|
||||||
when auto-refreshing logs in RDAirPlay [GitHub pull request #000028].
|
when auto-refreshing logs in RDAirPlay [GitHub pull request #000028].
|
||||||
|
2014-10-07 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added a 'GPIO_EVENTS' table to the database.
|
||||||
|
* Incremented the database version to 240.
|
||||||
|
* Implemented GPIO event logging in 'ripcd/local_macros.cpp' and
|
||||||
|
'ripcd/ripcd.h'.
|
||||||
|
* Added an 'Events Log' area to RDGpiMon(1) in
|
||||||
|
'utils/rdgpimon/rdgpimon.cpp' and 'utils/rdgpimon/rdgpimon.h'.
|
||||||
|
* Added code in rdmaint(1) to purge logged GPIO events in
|
||||||
|
'utils/rdmaint/rdmaint.cpp' and 'utils/rdmaint/rdmaint.h'.
|
||||||
|
@ -41,6 +41,7 @@ EXTRA_DIST = audio_perms.txt\
|
|||||||
encoders.txt\
|
encoders.txt\
|
||||||
extended_panel_names.txt\
|
extended_panel_names.txt\
|
||||||
feed_perms.txt\
|
feed_perms.txt\
|
||||||
|
gpio_events.txt\
|
||||||
gpis.txt\
|
gpis.txt\
|
||||||
gpos.txt\
|
gpos.txt\
|
||||||
groups.txt\
|
groups.txt\
|
||||||
|
14
docs/tables/gpio_events.txt
Normal file
14
docs/tables/gpio_events.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
GPIO_EVENTS Table Layout for Rivendell
|
||||||
|
|
||||||
|
The GPIO_EVENTS table holds data concerning past GPIO events processed
|
||||||
|
by the system.
|
||||||
|
|
||||||
|
FIELD NAME TYPE REMARKS
|
||||||
|
------------------------------------------------------------------
|
||||||
|
ID int(10) unsigned Primary key, auto increment
|
||||||
|
STATION_NAME char(64) From STATIONS.NAME
|
||||||
|
MATRIX int(10) unsigned From MATRICES.MATRIX
|
||||||
|
NUMBER int(11)
|
||||||
|
TYPE int(11) 0 = GPI, 1 = GPO
|
||||||
|
EDGE int(11) 1 = Rising, 0 = Falling
|
||||||
|
EVENT_DATETIME datetime
|
@ -26,7 +26,7 @@
|
|||||||
/*
|
/*
|
||||||
* Current Database Version
|
* Current Database Version
|
||||||
*/
|
*/
|
||||||
#define RD_VERSION_DATABASE 239
|
#define RD_VERSION_DATABASE 240
|
||||||
|
|
||||||
|
|
||||||
#endif // DBVERSION_H
|
#endif // DBVERSION_H
|
||||||
|
@ -2345,16 +2345,32 @@ bool CreateDb(QString name,QString pwd)
|
|||||||
//
|
//
|
||||||
// Create DROPBOX_SCHED_CODES table
|
// Create DROPBOX_SCHED_CODES table
|
||||||
//
|
//
|
||||||
sql=QString("create table if not exists DROPBOX_SCHED_CODES(")+
|
sql=QString("create table if not exists DROPBOX_SCHED_CODES(")+
|
||||||
"ID int auto_increment not null primary key,"+
|
"ID int auto_increment not null primary key,"+
|
||||||
"DROPBOX_ID int not null,"+
|
"DROPBOX_ID int not null,"+
|
||||||
"SCHED_CODE char(11) not null,"
|
"SCHED_CODE char(11) not null,"
|
||||||
"index DROPBOX_ID_IDX(DROPBOX_ID),"+
|
"index DROPBOX_ID_IDX(DROPBOX_ID),"+
|
||||||
"index SCHED_CODE_IDX(SCHED_CODE))";
|
"index SCHED_CODE_IDX(SCHED_CODE))";
|
||||||
if(!RunQuery(sql)) {
|
if(!RunQuery(sql)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create GPIO_EVENTS table
|
||||||
|
//
|
||||||
|
sql=QString("create table if not exists GPIO_EVENTS(")+
|
||||||
|
"ID int auto_increment not null primary key,"+
|
||||||
|
"STATION_NAME char(64) not null,"+
|
||||||
|
"MATRIX int not null,"+
|
||||||
|
"NUMBER int not null,"+
|
||||||
|
"TYPE int not null,"+
|
||||||
|
"EDGE int not null,"+
|
||||||
|
"EVENT_DATETIME datetime not null,"+
|
||||||
|
"index STATION_NAME_IDX(STATION_NAME,MATRIX,TYPE,EVENT_DATETIME,EDGE))";
|
||||||
|
if(!RunQuery(sql)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8034,6 +8050,20 @@ int UpdateDb(int ver)
|
|||||||
delete q;
|
delete q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ver<240) {
|
||||||
|
sql=QString("create table if not exists GPIO_EVENTS(")+
|
||||||
|
"ID int auto_increment not null primary key,"+
|
||||||
|
"STATION_NAME char(64) not null,"+
|
||||||
|
"MATRIX int not null,"+
|
||||||
|
"NUMBER int not null,"+
|
||||||
|
"TYPE int not null,"+
|
||||||
|
"EDGE int not null,"+
|
||||||
|
"EVENT_DATETIME datetime not null,"+
|
||||||
|
"index STATION_NAME_IDX(STATION_NAME,MATRIX,TYPE,EVENT_DATETIME,EDGE))";
|
||||||
|
q=new QSqlQuery(sql);
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// **** End of version updates ****
|
// **** End of version updates ****
|
||||||
|
@ -50,6 +50,7 @@ void MainObject::gpiChangedData(int matrix,int line,bool state)
|
|||||||
if(ripcd_gpi_macro[matrix][line][state]>0) {
|
if(ripcd_gpi_macro[matrix][line][state]>0) {
|
||||||
ExecCart(ripcd_gpi_macro[matrix][line][state]);
|
ExecCart(ripcd_gpi_macro[matrix][line][state]);
|
||||||
}
|
}
|
||||||
|
LogGpioEvent(matrix,line,RDMatrix::GpioInput,state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ void MainObject::gpoChangedData(int matrix,int line,bool state)
|
|||||||
if(ripcd_gpo_macro[matrix][line][state]>0) {
|
if(ripcd_gpo_macro[matrix][line][state]>0) {
|
||||||
ExecCart(ripcd_gpo_macro[matrix][line][state]);
|
ExecCart(ripcd_gpo_macro[matrix][line][state]);
|
||||||
}
|
}
|
||||||
|
LogGpioEvent(matrix,line,RDMatrix::GpioOutput,state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +127,24 @@ void MainObject::ExecCart(int cartnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::LogGpioEvent(int matrix,int line,RDMatrix::GpioType type,
|
||||||
|
bool state)
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
|
||||||
|
sql=QString("insert into GPIO_EVENTS set ")+
|
||||||
|
"STATION_NAME=\""+RDEscapeString(rdstation->name())+"\","+
|
||||||
|
QString().sprintf("MATRIX=%d,",matrix)+
|
||||||
|
QString().sprintf("NUMBER=%d,",line+1)+
|
||||||
|
QString().sprintf("TYPE=%d,",type)+
|
||||||
|
QString().sprintf("EDGE=%d,",state)+
|
||||||
|
"EVENT_DATETIME=now()";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::LoadLocalMacros()
|
void MainObject::LoadLocalMacros()
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
|
@ -83,6 +83,7 @@ class MainObject : public QObject
|
|||||||
private:
|
private:
|
||||||
void SetUser(QString username);
|
void SetUser(QString username);
|
||||||
void ExecCart(int cartnum);
|
void ExecCart(int cartnum);
|
||||||
|
void LogGpioEvent(int matrix,int line,RDMatrix::GpioType type,bool state);
|
||||||
void ParseCommand(int);
|
void ParseCommand(int);
|
||||||
void DispatchCommand(int);
|
void DispatchCommand(int);
|
||||||
void KillSocket(int);
|
void KillSocket(int);
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
//
|
//
|
||||||
// A Qt-based application for testing General Purpose Input (GPI) devices.
|
// A Qt-based application for testing General Purpose Input (GPI) devices.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2003 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2014 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
|
||||||
// $Id: rdgpimon.cpp,v 1.14.6.4 2014/01/21 21:59:34 cvs Exp $
|
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -39,6 +37,8 @@
|
|||||||
#include <rdgpimon.h>
|
#include <rdgpimon.h>
|
||||||
#include <rdcmd_switch.h>
|
#include <rdcmd_switch.h>
|
||||||
#include <rddbheartbeat.h>
|
#include <rddbheartbeat.h>
|
||||||
|
#include <rdescape_string.h>
|
||||||
|
#include <rdlistviewitem.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Icons
|
// Icons
|
||||||
@ -49,6 +49,8 @@
|
|||||||
MainWidget::MainWidget(QWidget *parent,const char *name)
|
MainWidget::MainWidget(QWidget *parent,const char *name)
|
||||||
:QWidget(parent,name)
|
:QWidget(parent,name)
|
||||||
{
|
{
|
||||||
|
gpi_scroll_mode=false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Command Options
|
// Read Command Options
|
||||||
//
|
//
|
||||||
@ -64,13 +66,17 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
setMaximumHeight(sizeHint().height());
|
setMaximumHeight(sizeHint().height());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Font
|
// Create Fonts
|
||||||
//
|
//
|
||||||
QFont font("helvetica",10,QFont::Normal);
|
QFont font("helvetica",10,QFont::Normal);
|
||||||
font.setPixelSize(10);
|
font.setPixelSize(10);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
|
QFont list_font("helvetica",12,QFont::Normal);
|
||||||
|
list_font.setPixelSize(12);
|
||||||
QFont main_font("helvetica",12,QFont::Bold);
|
QFont main_font("helvetica",12,QFont::Bold);
|
||||||
main_font.setPixelSize(12);
|
main_font.setPixelSize(12);
|
||||||
|
QFont title_font("helvetica",14,QFont::Bold);
|
||||||
|
title_font.setPixelSize(14);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create And Set Icon
|
// Create And Set Icon
|
||||||
@ -138,12 +144,11 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
//
|
//
|
||||||
// Type Selector
|
// Type Selector
|
||||||
//
|
//
|
||||||
gpi_type_box=new QComboBox(this,"gpi_type_box");
|
gpi_type_box=new QComboBox(this);
|
||||||
gpi_type_box->setGeometry(80,10,120,21);
|
gpi_type_box->setGeometry(80,10,120,21);
|
||||||
gpi_type_box->insertItem(tr("GPI (Inputs)"));
|
gpi_type_box->insertItem(tr("GPI (Inputs)"));
|
||||||
gpi_type_box->insertItem(tr("GPO (Outputs)"));
|
gpi_type_box->insertItem(tr("GPO (Outputs)"));
|
||||||
QLabel *label=
|
QLabel *label=new QLabel(gpi_type_box,tr("Show:"),this);
|
||||||
new QLabel(gpi_type_box,tr("Show:"),this,"gpi_type_label");
|
|
||||||
label->setGeometry(20,10,55,21);
|
label->setGeometry(20,10,55,21);
|
||||||
label->setFont(main_font);
|
label->setFont(main_font);
|
||||||
label->setAlignment(AlignRight|AlignVCenter);
|
label->setAlignment(AlignRight|AlignVCenter);
|
||||||
@ -153,12 +158,12 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
//
|
//
|
||||||
// Matrix Selector
|
// Matrix Selector
|
||||||
//
|
//
|
||||||
gpi_matrix_box=new QComboBox(this,"gpi_matrix_box");
|
gpi_matrix_box=new QComboBox(this);
|
||||||
gpi_matrix_box->setGeometry(280,10,80,21);
|
gpi_matrix_box->setGeometry(280,10,80,21);
|
||||||
for(int i=0;i<MAX_MATRICES;i++) {
|
for(int i=0;i<MAX_MATRICES;i++) {
|
||||||
gpi_matrix_box->insertItem(QString().sprintf("%d",i));
|
gpi_matrix_box->insertItem(QString().sprintf("%d",i));
|
||||||
}
|
}
|
||||||
label=new QLabel(gpi_matrix_box,tr("Matrix:"),this,"gpi_matrix_label");
|
label=new QLabel(gpi_matrix_box,tr("Matrix:"),this);
|
||||||
label->setGeometry(220,10,55,21);
|
label->setGeometry(220,10,55,21);
|
||||||
label->setFont(main_font);
|
label->setFont(main_font);
|
||||||
label->setAlignment(AlignRight|AlignVCenter);
|
label->setAlignment(AlignRight|AlignVCenter);
|
||||||
@ -179,11 +184,77 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Events Log
|
||||||
|
//
|
||||||
|
label=new QLabel(tr("Events Log"),this);
|
||||||
|
label->setFont(title_font);
|
||||||
|
label->setAlignment(Qt::AlignCenter);
|
||||||
|
label->setGeometry(110,353,sizeHint().width()-220,30);
|
||||||
|
|
||||||
|
gpi_events_date_edit=new QDateEdit(this);
|
||||||
|
gpi_events_date_edit->setGeometry(155,383,90,20);
|
||||||
|
gpi_events_date_edit->setDate(QDate::currentDate());
|
||||||
|
connect(gpi_events_date_edit,SIGNAL(valueChanged(const QDate &)),
|
||||||
|
this,SLOT(eventsDateChangedData(const QDate &)));
|
||||||
|
gpi_events_date_label=new QLabel(gpi_events_date_edit,tr("Date")+":",this);
|
||||||
|
gpi_events_date_label->setGeometry(100,383,50,20);
|
||||||
|
gpi_events_date_label->setFont(main_font);
|
||||||
|
gpi_events_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
|
|
||||||
|
gpi_events_state_box=new QComboBox(this);
|
||||||
|
gpi_events_state_box->setGeometry(280,383,55,20);
|
||||||
|
gpi_events_state_box->insertItem(tr("On"));
|
||||||
|
gpi_events_state_box->insertItem(tr("Off"));
|
||||||
|
gpi_events_state_box->insertItem(tr("Both"));
|
||||||
|
connect(gpi_events_state_box,SIGNAL(activated(int)),
|
||||||
|
this,SLOT(eventsStateChangedData(int)));
|
||||||
|
gpi_events_state_label=new QLabel(gpi_events_state_box,tr("State")+":",this);
|
||||||
|
gpi_events_state_label->setGeometry(225,383,50,20);
|
||||||
|
gpi_events_state_label->setFont(main_font);
|
||||||
|
gpi_events_state_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
|
|
||||||
|
gpi_events_scroll_button=new QPushButton(tr("Scroll"),this);
|
||||||
|
gpi_events_scroll_button->setGeometry(355,380,60,26);
|
||||||
|
gpi_events_scroll_button->setFont(main_font);
|
||||||
|
connect(gpi_events_scroll_button,SIGNAL(clicked()),
|
||||||
|
this,SLOT(eventsScrollData()));
|
||||||
|
gpi_scroll_color=palette();
|
||||||
|
gpi_scroll_color.setColor(QPalette::Active,QColorGroup::ButtonText,
|
||||||
|
Qt::white);
|
||||||
|
gpi_scroll_color.setColor(QPalette::Active,QColorGroup::Button,
|
||||||
|
Qt::blue);
|
||||||
|
gpi_scroll_color.setColor(QPalette::Active,QColorGroup::Background,
|
||||||
|
lightGray);
|
||||||
|
gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::ButtonText,
|
||||||
|
Qt::white);
|
||||||
|
gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Button,
|
||||||
|
Qt::blue);
|
||||||
|
gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Background,
|
||||||
|
lightGray);
|
||||||
|
|
||||||
|
gpi_events_list=new RDListView(this);
|
||||||
|
gpi_events_list->setFont(main_font);
|
||||||
|
gpi_events_list->setGeometry(110,410,sizeHint().width()-220,170);
|
||||||
|
gpi_events_list->setItemMargin(5);
|
||||||
|
gpi_events_list->setSelectionMode(QListView::NoSelection);
|
||||||
|
|
||||||
|
gpi_events_list->addColumn("Time");
|
||||||
|
gpi_events_list->setColumnAlignment(0,Qt::AlignHCenter);
|
||||||
|
gpi_events_list->setColumnSortType(1,RDListView::TimeSort);
|
||||||
|
|
||||||
|
gpi_events_list->addColumn(tr("Line"));
|
||||||
|
gpi_events_list->setColumnAlignment(1,Qt::AlignHCenter);
|
||||||
|
gpi_events_list->setColumnSortType(1,RDListView::GpioSort);
|
||||||
|
|
||||||
|
gpi_events_list->addColumn(tr("State"));
|
||||||
|
gpi_events_list->setColumnAlignment(2,Qt::AlignHCenter);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Up Button
|
// Up Button
|
||||||
//
|
//
|
||||||
gpi_up_button=
|
gpi_up_button=
|
||||||
new RDTransportButton(RDTransportButton::Up,this,"gpi_up_button");
|
new RDTransportButton(RDTransportButton::Up,this);
|
||||||
gpi_up_button->setGeometry(10,sizeHint().height()-60,80,50);
|
gpi_up_button->setGeometry(10,sizeHint().height()-60,80,50);
|
||||||
connect(gpi_up_button,SIGNAL(clicked()),this,SLOT(upData()));
|
connect(gpi_up_button,SIGNAL(clicked()),this,SLOT(upData()));
|
||||||
|
|
||||||
@ -191,7 +262,7 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
// Down Button
|
// Down Button
|
||||||
//
|
//
|
||||||
gpi_down_button=
|
gpi_down_button=
|
||||||
new RDTransportButton(RDTransportButton::Down,this,"gpi_down_button");
|
new RDTransportButton(RDTransportButton::Down,this);
|
||||||
gpi_down_button->setGeometry(100,sizeHint().height()-60,80,50);
|
gpi_down_button->setGeometry(100,sizeHint().height()-60,80,50);
|
||||||
connect(gpi_down_button,SIGNAL(clicked()),this,SLOT(downData()));
|
connect(gpi_down_button,SIGNAL(clicked()),this,SLOT(downData()));
|
||||||
|
|
||||||
@ -221,7 +292,7 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
//
|
//
|
||||||
// Close Button
|
// Close Button
|
||||||
//
|
//
|
||||||
gpi_close_button=new QPushButton(this,"gpi_close_button");
|
gpi_close_button=new QPushButton(this);
|
||||||
gpi_close_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
|
gpi_close_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
|
||||||
80,50);
|
80,50);
|
||||||
gpi_close_button->setFont(main_font);
|
gpi_close_button->setFont(main_font);
|
||||||
@ -231,9 +302,9 @@ MainWidget::MainWidget(QWidget *parent,const char *name)
|
|||||||
//
|
//
|
||||||
// Start Up Timer
|
// Start Up Timer
|
||||||
//
|
//
|
||||||
QTimer *timer=new QTimer(this,"start_up_timer");
|
gpi_events_startup_timer=new QTimer(this);
|
||||||
connect(timer,SIGNAL(timeout()),this,SLOT(startUpData()));
|
connect(gpi_events_startup_timer,SIGNAL(timeout()),this,SLOT(startUpData()));
|
||||||
timer->start(GPIMON_START_UP_DELAY,true);
|
gpi_events_startup_timer->start(GPIMON_START_UP_DELAY,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -244,7 +315,7 @@ MainWidget::~MainWidget()
|
|||||||
|
|
||||||
QSize MainWidget::sizeHint() const
|
QSize MainWidget::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(528,78*GPIMON_ROWS+110);
|
return QSize(528,78*GPIMON_ROWS+340);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,6 +361,41 @@ void MainWidget::matrixActivatedData(int index)
|
|||||||
gpi_ripc->sendGpoCart(gpi_matrix_box->currentItem());
|
gpi_ripc->sendGpoCart(gpi_matrix_box->currentItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
RefreshEventsList();
|
||||||
|
gpi_events_startup_timer->start(1000,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWidget::eventsDateChangedData(const QDate &date)
|
||||||
|
{
|
||||||
|
RefreshEventsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWidget::eventsStateChangedData(int n)
|
||||||
|
{
|
||||||
|
RefreshEventsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWidget::eventsScrollData()
|
||||||
|
{
|
||||||
|
if(gpi_scroll_mode) {
|
||||||
|
gpi_events_scroll_button->setPalette(palette());
|
||||||
|
gpi_scroll_mode=false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gpi_events_scroll_button->setPalette(gpi_scroll_color);
|
||||||
|
gpi_scroll_mode=true;
|
||||||
|
RDListViewItem *item=(RDListViewItem *)gpi_events_list->firstChild();
|
||||||
|
RDListViewItem *last=NULL;
|
||||||
|
while((item=(RDListViewItem *)item->nextSibling())!=NULL) {
|
||||||
|
last=item;
|
||||||
|
}
|
||||||
|
if(last!=NULL) {
|
||||||
|
gpi_events_list->ensureItemVisible(last);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -308,6 +414,7 @@ void MainWidget::gpiStateChangedData(int matrix,int line,bool state)
|
|||||||
gpi_labels[i]->setState(state);
|
gpi_labels[i]->setState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AddEventsItem(line,state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -326,6 +433,7 @@ void MainWidget::gpoStateChangedData(int matrix,int line,bool state)
|
|||||||
gpi_labels[i]->setState(state);
|
gpi_labels[i]->setState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AddEventsItem(line,state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -412,6 +520,7 @@ void MainWidget::gpoCartChangedData(int matrix,int line,int off_cartnum,
|
|||||||
|
|
||||||
void MainWidget::startUpData()
|
void MainWidget::startUpData()
|
||||||
{
|
{
|
||||||
|
gpi_events_startup_timer->disconnect();
|
||||||
matrixActivatedData(0);
|
matrixActivatedData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,6 +638,76 @@ void MainWidget::UpdateLabelsDown(int first_line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWidget::RefreshEventsList()
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
|
||||||
|
sql=QString("select EVENT_DATETIME,NUMBER,EDGE from GPIO_EVENTS where ")+
|
||||||
|
"(STATION_NAME=\""+RDEscapeString(gpi_station->name())+"\")&&"+
|
||||||
|
QString().sprintf("(MATRIX=%d)&&",gpi_matrix_box->currentItem())+
|
||||||
|
QString().sprintf("(TYPE=%d)&&",gpi_type_box->currentItem())+
|
||||||
|
"(EVENT_DATETIME>=\""+gpi_events_date_edit->date().toString("yyyy-MM-dd")+
|
||||||
|
" 00:00:00\")&&"+
|
||||||
|
"(EVENT_DATETIME<\""+gpi_events_date_edit->date().addDays(1).
|
||||||
|
toString("yyyy-MM-dd")+" 00:00:00\")";
|
||||||
|
if(gpi_events_state_box->currentItem()==0) {
|
||||||
|
sql+="&&(EDGE=1)";
|
||||||
|
}
|
||||||
|
if(gpi_events_state_box->currentItem()==1) {
|
||||||
|
sql+="&&(EDGE=0)";
|
||||||
|
}
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
gpi_events_list->clear();
|
||||||
|
RDListViewItem *item=NULL;
|
||||||
|
while(q->next()) {
|
||||||
|
item=new RDListViewItem(gpi_events_list);
|
||||||
|
item->setText(0,q->value(0).toDateTime().toString("hh:mm:ss"));
|
||||||
|
item->setText(1,QString().sprintf("%d",q->value(1).toInt()));
|
||||||
|
if(q->value(2).toInt()==0) {
|
||||||
|
item->setText(2,tr("Off"));
|
||||||
|
item->setTextColor(Qt::darkRed);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item->setText(2,tr("On"));
|
||||||
|
item->setTextColor(Qt::darkGreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(gpi_scroll_mode&&(item!=NULL)) {
|
||||||
|
gpi_events_list->ensureItemVisible(item);
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWidget::AddEventsItem(int line,bool state)
|
||||||
|
{
|
||||||
|
if(gpi_events_startup_timer->isActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if((gpi_events_state_box->currentItem()==0)&&(!state)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if((gpi_events_state_box->currentItem()==1)&&state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RDListViewItem *item=new RDListViewItem(gpi_events_list);
|
||||||
|
item->setText(0,QTime::currentTime().toString("hh:mm:ss"));
|
||||||
|
item->setText(1,QString().sprintf("%d",line+1));
|
||||||
|
if(state) {
|
||||||
|
item->setText(2,tr("On"));
|
||||||
|
item->setTextColor(Qt::darkGreen);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item->setText(2,tr("Off"));
|
||||||
|
item->setTextColor(Qt::darkRed);
|
||||||
|
}
|
||||||
|
if(gpi_scroll_mode) {
|
||||||
|
gpi_events_list->ensureItemVisible(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc,argv);
|
QApplication a(argc,argv);
|
||||||
|
@ -35,7 +35,10 @@
|
|||||||
#include <qsqldatabase.h>
|
#include <qsqldatabase.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
|
#include <qdatetimeedit.h>
|
||||||
|
#include <qtimer.h>
|
||||||
|
|
||||||
|
#include <rdlistview.h>
|
||||||
#include <rdmatrix.h>
|
#include <rdmatrix.h>
|
||||||
#include <rdconfig.h>
|
#include <rdconfig.h>
|
||||||
#include <rdripc.h>
|
#include <rdripc.h>
|
||||||
@ -62,6 +65,9 @@ class MainWidget : public QWidget
|
|||||||
void userData();
|
void userData();
|
||||||
void typeActivatedData(int index);
|
void typeActivatedData(int index);
|
||||||
void matrixActivatedData(int index);
|
void matrixActivatedData(int index);
|
||||||
|
void eventsDateChangedData(const QDate &date);
|
||||||
|
void eventsStateChangedData(int n);
|
||||||
|
void eventsScrollData();
|
||||||
void gpiStateChangedData(int matrix,int line,bool state);
|
void gpiStateChangedData(int matrix,int line,bool state);
|
||||||
void gpoStateChangedData(int matrix,int line,bool state);
|
void gpoStateChangedData(int matrix,int line,bool state);
|
||||||
void gpiMaskChangedData(int matrix,int line,bool state);
|
void gpiMaskChangedData(int matrix,int line,bool state);
|
||||||
@ -76,6 +82,8 @@ class MainWidget : public QWidget
|
|||||||
private:
|
private:
|
||||||
void UpdateLabelsUp(int last_line);
|
void UpdateLabelsUp(int last_line);
|
||||||
void UpdateLabelsDown(int first_line);
|
void UpdateLabelsDown(int first_line);
|
||||||
|
void RefreshEventsList();
|
||||||
|
void AddEventsItem(int line,bool state);
|
||||||
RDConfig *gpi_config;
|
RDConfig *gpi_config;
|
||||||
QSqlDatabase *gpi_db;
|
QSqlDatabase *gpi_db;
|
||||||
RDRipc *gpi_ripc;
|
RDRipc *gpi_ripc;
|
||||||
@ -90,7 +98,16 @@ class MainWidget : public QWidget
|
|||||||
RDTransportButton *gpi_down_button;
|
RDTransportButton *gpi_down_button;
|
||||||
int gpi_first_line;
|
int gpi_first_line;
|
||||||
int gpi_last_line;
|
int gpi_last_line;
|
||||||
|
QLabel *gpi_events_date_label;
|
||||||
|
QDateEdit *gpi_events_date_edit;
|
||||||
|
QLabel *gpi_events_state_label;
|
||||||
|
QComboBox *gpi_events_state_box;
|
||||||
|
QPushButton *gpi_events_scroll_button;
|
||||||
|
RDListView *gpi_events_list;
|
||||||
|
QTimer *gpi_events_startup_timer;
|
||||||
|
bool gpi_scroll_mode;
|
||||||
|
QPalette gpi_scroll_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif // MAIN_WIDGET_H
|
||||||
|
@ -50,5 +50,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -54,5 +54,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -54,5 +54,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -50,5 +50,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -54,5 +54,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -54,5 +54,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -50,5 +50,37 @@
|
|||||||
<source>User</source>
|
<source>User</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Line</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>State</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Both</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Off</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Scroll</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Events Log</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -132,6 +132,7 @@ void MainObject::RunSystemMaintenance()
|
|||||||
PurgeCuts();
|
PurgeCuts();
|
||||||
PurgeLogs();
|
PurgeLogs();
|
||||||
PurgeElr();
|
PurgeElr();
|
||||||
|
PurgeGpioEvents();
|
||||||
sql="update VERSION set LAST_MAINT_DATETIME=now()";
|
sql="update VERSION set LAST_MAINT_DATETIME=now()";
|
||||||
q=new RDSqlQuery(sql);
|
q=new RDSqlQuery(sql);
|
||||||
delete q;
|
delete q;
|
||||||
@ -268,6 +269,19 @@ void MainObject::PurgeDropboxes()
|
|||||||
delete q;
|
delete q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::PurgeGpioEvents()
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
|
||||||
|
sql=QString("delete from GPIO_EVENTS where ")+
|
||||||
|
"EVENT_DATETIME<\""+
|
||||||
|
QDate::currentDate().addDays(-30).toString("yyyy-MM-dd")+" 00:00:00\"";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,7 @@ class MainObject : public QObject
|
|||||||
void PurgeLogs();
|
void PurgeLogs();
|
||||||
void PurgeElr();
|
void PurgeElr();
|
||||||
void PurgeDropboxes();
|
void PurgeDropboxes();
|
||||||
|
void PurgeGpioEvents();
|
||||||
RDConfig *maint_config;
|
RDConfig *maint_config;
|
||||||
bool maint_verbose;
|
bool maint_verbose;
|
||||||
bool maint_system;
|
bool maint_system;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user