mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-10 16:43:35 +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:
@@ -50,6 +50,7 @@ void MainObject::gpiChangedData(int matrix,int line,bool state)
|
||||
if(ripcd_gpi_macro[matrix][line][state]>0) {
|
||||
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) {
|
||||
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()
|
||||
{
|
||||
QString sql;
|
||||
|
@@ -83,6 +83,7 @@ class MainObject : public QObject
|
||||
private:
|
||||
void SetUser(QString username);
|
||||
void ExecCart(int cartnum);
|
||||
void LogGpioEvent(int matrix,int line,RDMatrix::GpioType type,bool state);
|
||||
void ParseCommand(int);
|
||||
void DispatchCommand(int);
|
||||
void KillSocket(int);
|
||||
|
Reference in New Issue
Block a user