2022-10-28 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDCatchEvent' class.
	* Reimplemented the 'Deck Event Processed' command using
	'RDCatchEvent'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-10-28 09:26:37 -04:00
parent 751600dd5d
commit d38349cf39
21 changed files with 863 additions and 153 deletions

View File

@@ -2,7 +2,7 @@
//
// Process local notifications for ripcd(8)
//
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
//
// 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
@@ -36,3 +36,7 @@ void MainObject::RunLocalNotifications(RDNotification *notify)
}
}
void MainObject::RunLocalNotifications(RDCatchEvent *evt)
{
}

View File

@@ -238,18 +238,31 @@ void MainObject::newConnectionData()
void MainObject::notificationReceivedData(const QString &msg,
const QHostAddress &addr)
{
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
rda->syslog(LOG_INFO,"invalid notification received from %s",
(const char *)addr.toString().toUtf8());
QStringList f0=msg.split(msg,QString::SkipEmptyParts);
if(msg.at(0)=="NOTIFY") {
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
rda->syslog(LOG_INFO,"invalid notification received from %s",
addr.toString().toUtf8().constData());
delete notify;
return;
}
RunLocalNotifications(notify);
BroadcastCommand("ON "+msg+"!");
delete notify;
return;
}
RunLocalNotifications(notify);
BroadcastCommand("ON "+msg+"!");
delete notify;
if(msg.at(0)=="CATCH") {
RDCatchEvent *evt=new RDCatchEvent();
if(!evt->read(msg)) {
rda->syslog(LOG_INFO,"invalid catch event received from %s",
addr.toString().toUtf8().constData());
delete evt;
return;
}
RunLocalNotifications(evt);
BroadcastCommand("ON "+msg+"!");
delete evt;
}
}
@@ -611,22 +624,43 @@ bool MainObject::DispatchCommand(RipcdConnection *conn)
msg+=QString(cmds[i])+" ";
}
msg=msg.left(msg.length()-1);
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
rda->syslog(LOG_INFO,"invalid notification processed");
QStringList f0=msg.split(" ",QString::SkipEmptyParts);
if(f0.at(0)=="NOTIFY") {
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
rda->syslog(LOG_INFO,"invalid notification processed");
delete notify;
return true;
}
RunLocalNotifications(notify);
BroadcastCommand("ON "+msg+"!",conn->id());
ripcd_notification_mcaster->
send(msg,rda->system()->notificationAddress(),RD_NOTIFICATION_PORT);
rda->syslog(LOG_DEBUG,"sent notification: \"%s\" to %s:%d",
msg.toUtf8().constData(),
rda->system()->notificationAddress().
toString().toUtf8().constData(),
RD_NOTIFICATION_PORT);
delete notify;
return true;
}
RunLocalNotifications(notify);
BroadcastCommand("ON "+msg+"!",conn->id());
ripcd_notification_mcaster->
send(msg,rda->system()->notificationAddress(),RD_NOTIFICATION_PORT);
rda->syslog(LOG_DEBUG,"sent notification: \"%s\" to %s:%d",
(const char *)msg.toUtf8(),
(const char *)rda->system()->notificationAddress().
toString().toUtf8(),
RD_NOTIFICATION_PORT);
delete notify;
if(f0.at(0)=="CATCH") {
RDCatchEvent *evt=new RDCatchEvent();
if(!evt->read(msg)) {
rda->syslog(LOG_INFO,"invalid catch event processed");
delete evt;
return true;
}
RunLocalNotifications(evt);
BroadcastCommand("ON "+msg+"!",conn->id());
ripcd_notification_mcaster->
send(msg,rda->system()->notificationAddress(),RD_NOTIFICATION_PORT);
rda->syslog(LOG_DEBUG,"sent catch event: \"%s\" to %s:%d",
msg.toUtf8().constData(),
rda->system()->notificationAddress().
toString().toUtf8().constData(),
RD_NOTIFICATION_PORT);
delete evt;
}
}
if(cmds[0]=="TA") { // Send Onair Flag State

View File

@@ -2,7 +2,7 @@
//
// Rivendell Interprocess Communication Daemon
//
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
//
// 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
@@ -25,26 +25,25 @@
#include <vector>
#include <qobject.h>
#include <qstring.h>
#include <qsignalmapper.h>
#include <qtcpserver.h>
#include <qtimer.h>
#include <qudpsocket.h>
#include <QSignalMapper>
#include <QTcpServer>
#include <QTimer>
#include <QUdpSocket>
#ifdef JACK
#include <jack/jack.h>
#endif // JACK
#include <rdcatchevent.h>
#include <rdcodetrap.h>
#include <rdmacro.h>
#include <rdmatrix.h>
#include <rdmulticaster.h>
#include <rdnotification.h>
#include <rdsocket.h>
#include <rdttydevice.h>
#include <rdcodetrap.h>
#include <rdstation.h>
#include <rdmatrix.h>
#include <rdmacro.h>
#include <rdmulticaster.h>
#include <rdtty.h>
#include <rdttydevice.h>
#include <ripcd_connection.h>
#include <globals.h>
@@ -95,6 +94,7 @@ class MainObject : public QObject
QString StripPoint(QString);
void LoadLocalMacros();
void RunLocalNotifications(RDNotification *notify);
void RunLocalNotifications(RDCatchEvent *evt);
void RunLocalMacros(RDMacro *rml);
void LoadGpiTable();
void SendGpi(int ch,int matrix);