2019-02-07 Fred Gleason <fredg@paravelsystems.com>

* Replaced the 'Add Event', 'Delete Event' and 'Modify Event'
	commands in the RDCatch Monitor Protocol with multicast update
	events.
This commit is contained in:
Fred Gleason 2019-02-07 13:35:14 -05:00
parent 34e722849a
commit 06dd4c336b
17 changed files with 96 additions and 236 deletions

View File

@ -18460,3 +18460,7 @@
2019-02-05 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdairplay(1) that threw a segfault when processing
a null RML.
2019-02-07 Fred Gleason <fredg@paravelsystems.com>
* Replaced the 'Add Event', 'Delete Event' and 'Modify Event'
commands in the RDCatch Monitor Protocol with multicast update
events.

View File

@ -171,78 +171,6 @@
<computeroutput>RS +!</computeroutput>.
</para>
</sect2>
<sect2 xml:id="sect.privileged_commands.add_event">
<title>Add Event</title>
<para>
Add event to the event list.
</para>
<para>
<userinput>RA <replaceable>event-num</replaceable>!</userinput>
</para>
<variablelist>
<varlistentry>
<term><replaceable>event-num</replaceable></term>
<listitem>
<para>
The number of the event to add.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
<command>rdcatchd</command><manvolnum>8</manvolnum>
will respond with
<computeroutput>RA <replaceable>event-num</replaceable>+!</computeroutput>.
</para>
</sect2>
<sect2 xml:id="sect.privileged_commands.remove_event">
<title>Remove Event</title>
<para>
Remove event from the event list.
</para>
<para>
<userinput>RR <replaceable>event-num</replaceable>!</userinput>
</para>
<variablelist>
<varlistentry>
<term><replaceable>event-num</replaceable></term>
<listitem>
<para>
The number of the event to remove.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
<command>rdcatchd</command><manvolnum>8</manvolnum>
will respond with
<computeroutput>RR <replaceable>event-num</replaceable>+!</computeroutput>.
</para>
</sect2>
<sect2 xml:id="sect.privileged_commands.update_event">
<title>Update Event</title>
<para>
Update event from the event list.
</para>
<para>
<userinput>RU <replaceable>event-num</replaceable>!</userinput>
</para>
<variablelist>
<varlistentry>
<term><replaceable>event-num</replaceable></term>
<listitem>
<para>
The number of the event to update.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
<command>rdcatchd</command><manvolnum>8</manvolnum>
will respond with
<computeroutput>RU <replaceable>event-num</replaceable>+!</computeroutput>.
</para>
</sect2>
<sect2 xml:id="sect.privileged_commands.request_deck_status">
<title>Request Deck Status</title>
<para>

View File

@ -2,7 +2,7 @@
//
// Connect to the Rivendell Netcatcher Daemon.
//
// (C) Copyright 2002-2004,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@ -105,24 +105,6 @@ void RDCatchConnect::reloadDropboxes()
}
void RDCatchConnect::addEvent(int id)
{
SendCommand(QString().sprintf("RA %d!",id));
}
void RDCatchConnect::removeEvent(int id)
{
SendCommand(QString().sprintf("RR %d!",id));
}
void RDCatchConnect::updateEvent(int id)
{
SendCommand(QString().sprintf("RU %d!",id));
}
void RDCatchConnect::reset()
{
SendCommand("RS!");

View File

@ -2,7 +2,7 @@
//
// Connect to the Rivendell Netcatcher Daemon.
//
// (C) Copyright 2002-2004,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@ -49,9 +49,6 @@ class RDCatchConnect : public QObject
void reloadDropboxes();
public slots:
void addEvent(int id);
void removeEvent(int id);
void updateEvent(int id);
void reset();
void reload();
void refresh();

View File

@ -2,7 +2,7 @@
//
// A container class for a Rivendell Notification message.
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2018-2019 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
@ -111,6 +111,10 @@ bool RDNotification::read(const QString &str)
notify_id=QVariant(args[3]);
break;
case RDNotification::CatchEventType:
notify_id=QVariant(args[3].toUInt());
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;
@ -158,6 +162,10 @@ QString RDNotification::write() const
ret+=notify_id.toString();
break;
case RDNotification::CatchEventType:
ret+=QString().sprintf("%u",notify_id.toUInt());
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;
@ -187,6 +195,10 @@ QString RDNotification::typeString(RDNotification::Type type)
ret="DROPBOX";
break;
case RDNotification::CatchEventType:
ret="CATCH_EVENT";
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;

View File

@ -2,7 +2,7 @@
//
// A container class for a Rivendell Notification message.
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2018-2019 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
@ -28,7 +28,7 @@ class RDNotification
{
public:
enum Type {NullType=0,CartType=1,LogType=2,PypadType=3,DropboxType=4,
LastType=5};
CatchEventType=5,LastType=6};
enum Action {NoAction=0,AddAction=1,DeleteAction=2,ModifyAction=3,
LastAction=4};
RDNotification(Type type,Action action,const QVariant &id);

View File

@ -190,7 +190,7 @@ void AddRecording::closeEvent(QCloseEvent *e)
void AddRecording::recordingData()
{
EditRecording *recording=new EditRecording(add_id,NULL,add_filter,this);
if(recording->exec()<0) {
if(!recording->exec()) {
delete recording;
done(-1);
return;
@ -203,7 +203,7 @@ void AddRecording::recordingData()
void AddRecording::playoutData()
{
EditPlayout *playout=new EditPlayout(add_id,NULL,add_filter,this);
if(playout->exec()<0) {
if(!playout->exec()) {
delete playout;
done(-1);
return;
@ -217,7 +217,7 @@ void AddRecording::downloadData()
{
EditDownload *recording=
new EditDownload(add_id,NULL,add_filter,this);
if(recording->exec()<0) {
if(!recording->exec()) {
delete recording;
done(-1);
return;
@ -230,7 +230,7 @@ void AddRecording::downloadData()
void AddRecording::uploadData()
{
EditUpload *recording=new EditUpload(add_id,NULL,add_filter,this);
if(recording->exec()<0) {
if(!recording->exec()) {
delete recording;
done(-1);
return;
@ -243,7 +243,7 @@ void AddRecording::uploadData()
void AddRecording::macroData()
{
EditCartEvent *recording=new EditCartEvent(add_id,NULL,this);
if(recording->exec()<0) {
if(!recording->exec()) {
delete recording;
done(-1);
return;
@ -256,7 +256,7 @@ void AddRecording::macroData()
void AddRecording::switchData()
{
EditSwitchEvent *recording=new EditSwitchEvent(add_id,NULL,this);
if(recording->exec()<0) {
if(!recording->exec()) {
delete recording;
done(-1);
return;

View File

@ -365,13 +365,13 @@ void EditCartEvent::okData()
return;
}
Save();
done(0);
done(true);
}
void EditCartEvent::cancelData()
{
done(-1);
done(false);
}

View File

@ -545,13 +545,13 @@ void EditDownload::okData()
return;
}
Save();
done(0);
done(true);
}
void EditDownload::cancelData()
{
done(-1);
done(false);
}

View File

@ -340,13 +340,13 @@ void EditPlayout::saveasData()
void EditPlayout::okData()
{
Save();
done(0);
done(true);
}
void EditPlayout::cancelData()
{
done(-1);
done(false);
}

View File

@ -747,13 +747,13 @@ void EditRecording::okData()
return;
}
Save();
done(0);
done(true);
}
void EditRecording::cancelData()
{
done(-1);
done(false);
}

View File

@ -482,13 +482,13 @@ void EditSwitchEvent::okData()
return;
}
Save();
done(0);
done(true);
}
void EditSwitchEvent::cancelData()
{
done(-1);
done(false);
}

View File

@ -568,13 +568,13 @@ void EditUpload::okData()
return;
}
Save();
done(0);
done(true);
}
void EditUpload::cancelData()
{
done(-1);
done(false);
}

View File

@ -2,7 +2,7 @@
//
// The Event Schedule Manager for Rivendell.
//
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@ -197,9 +197,6 @@ MainWidget::MainWidget(QWidget *parent)
str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":";
setWindowTitle(str+" "+rda->config()->stationName());
// connect(RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)),
// this,SLOT(log(RDConfig::LogPriority,const QString &)));
//
// Allocate Global Resources
//
@ -665,6 +662,7 @@ void MainWidget::addData()
RDSqlQuery *q;
RDListViewItem *item;
int conn;
RDNotification *notify=NULL;
if(!rda->user()->editCatches()) {
return;
@ -679,6 +677,10 @@ void MainWidget::addData()
case RDRecording::SwitchEvent:
case RDRecording::Download:
case RDRecording::Upload:
notify=new RDNotification(RDNotification::CatchEventType,
RDNotification::AddAction,n);
rda->ripc()->sendNotification(*notify);
delete notify;
item=new RDListViewItem(catch_recordings_list);
item->setBackgroundColor(catch_recordings_list->palette().color(QPalette::Active,QColorGroup::Base));
item->setText(28,QString().sprintf("%d",n));
@ -690,7 +692,6 @@ void MainWidget::addData()
}
catch_recordings_list->setSelected(item,true);
catch_recordings_list->ensureItemVisible(item);
catch_connect[conn]->connector()->addEvent(n);
nextEventData();
break;
@ -706,8 +707,6 @@ void MainWidget::addData()
void MainWidget::editData()
{
int old_conn;
int new_conn;
std::vector<int> new_events;
RDListViewItem *item=(RDListViewItem *)catch_recordings_list->selectedItem();
@ -717,6 +716,7 @@ void MainWidget::editData()
EditSwitchEvent *switch_event;
EditDownload *download;
EditUpload *upload;
bool updated=false;
if(!rda->user()->editCatches()) {
return;
@ -739,111 +739,54 @@ void MainWidget::editData()
}
EnableScroll(false);
int id=item->text(28).toInt();
old_conn=GetConnection(item->text(24));
if(old_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
switch((RDRecording::Type)item->text(29).toInt()) {
case RDRecording::Recording:
recording=new EditRecording(id,&new_events,&catch_filter,this);
if(recording->exec()>=0) {
RefreshLine(item);
new_conn=GetConnection(item->text(24));
if(new_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[old_conn]->connector()->removeEvent(id);
catch_connect[new_conn]->connector()->addEvent(id);
nextEventData();
}
updated=recording->exec();
delete recording;
break;
case RDRecording::Playout:
playout=new EditPlayout(id,&new_events,&catch_filter,this);
if(playout->exec()>=0) {
RefreshLine(item);
new_conn=GetConnection(item->text(24));
if(new_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[old_conn]->connector()->removeEvent(id);
catch_connect[new_conn]->connector()->addEvent(id);
nextEventData();
}
updated=playout->exec();
delete playout;
break;
case RDRecording::MacroEvent:
event=new EditCartEvent(id,&new_events,this);
if(event->exec()>=0) {
RefreshLine(item);
new_conn=GetConnection(item->text(24));
if(new_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[old_conn]->connector()->removeEvent(id);
catch_connect[new_conn]->connector()->addEvent(id);
nextEventData();
}
updated=event->exec();
delete event;
break;
case RDRecording::SwitchEvent:
switch_event=new EditSwitchEvent(id,&new_events,this);
if(switch_event->exec()>=0) {
RefreshLine(item);
new_conn=GetConnection(item->text(24));
if(new_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[old_conn]->connector()->removeEvent(id);
catch_connect[new_conn]->connector()->addEvent(id);
nextEventData();
}
updated=switch_event->exec();
delete switch_event;
break;
case RDRecording::Download:
download=new EditDownload(id,&new_events,&catch_filter,this);
if(download->exec()>=0) {
RefreshLine(item);
new_conn=GetConnection(item->text(24));
if(new_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[old_conn]->connector()->removeEvent(id);
catch_connect[new_conn]->connector()->addEvent(id);
nextEventData();
}
updated=download->exec();
delete download;
break;
case RDRecording::Upload:
upload=new EditUpload(id,&new_events,&catch_filter,this);
if(upload->exec()>=0) {
RefreshLine(item);
new_conn=GetConnection(item->text(24));
if(new_conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[old_conn]->connector()->removeEvent(id);
catch_connect[new_conn]->connector()->addEvent(id);
nextEventData();
}
updated=upload->exec();
delete upload;
break;
case RDRecording::LastType:
break;
}
if(updated) {
RDNotification *notify=new RDNotification(RDNotification::CatchEventType,
RDNotification::ModifyAction,id);
rda->ripc()->sendNotification(*notify);
delete notify;
RefreshLine(item);
nextEventData();
}
ProcessNewRecords(&new_events);
}
@ -879,11 +822,15 @@ void MainWidget::deleteData()
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[conn]->connector()->removeEvent(item->text(28).toInt());
sql=QString("delete from RECORDINGS where ")+
"ID="+item->text(28);
q=new RDSqlQuery(sql);
delete q;
RDNotification *notify=new RDNotification(RDNotification::CatchEventType,
RDNotification::DeleteAction,
item->text(28).toInt());
rda->ripc()->sendNotification(*notify);
delete notify;
RDListViewItem *next=(RDListViewItem *)item->nextSibling();
catch_recordings_list->removeItem(item);
if(next!=NULL) {
@ -1238,9 +1185,6 @@ void MainWidget::heartbeatFailedData(int id)
if(!catch_host_warnings) {
return;
}
QString str;
str=QString(tr("Control connection timed out to host"));
QString msg=tr("Control connection timed out to host")+
" `"+catch_connect[id]->stationName()+"'?";
QMessageBox::warning(this,"RDCatch - "+tr("Connection Error"),msg);
@ -1602,7 +1546,11 @@ void MainWidget::ProcessNewRecords(std::vector<int> *adds)
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
catch_connect[conn]->connector()->addEvent(adds->at(i));
RDNotification *notify=new RDNotification(RDNotification::CatchEventType,
RDNotification::AddAction,
adds->at(i));
rda->ripc()->sendNotification(*notify);
delete notify;
}
nextEventData();
}

View File

@ -33,7 +33,6 @@
#include <qcombobox.h>
#include <qpixmap.h>
#include <q3scrollview.h>
//Added by qt3to4:
#include <QCloseEvent>
#include <QResizeEvent>
#include <QLabel>

View File

@ -2,7 +2,7 @@
//
// The Rivendell Netcatcher Daemon
//
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@ -61,7 +61,6 @@
#include "rdcatchd.h"
// Logging function that works within and outside the MainObject.
//static RDConfig *rd_config = NULL;
void LogLine(RDConfig::LogPriority prio,const QString &line)
{
FILE *logfile;
@ -305,6 +304,8 @@ MainObject::MainObject(QObject *parent)
this,SLOT(rmlReceivedData(RDMacro *)));
connect(rda->ripc(),SIGNAL(gpiStateChanged(int,int,bool)),
this,SLOT(gpiStateChangedData(int,int,bool)));
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
this,SLOT(notificationReceivedData(RDNotification *)));
//
// CAE Connection
@ -467,6 +468,24 @@ void MainObject::log(RDConfig::LogPriority prio,const QString &msg)
}
void MainObject::notificationReceivedData(RDNotification *notify)
{
if(notify->type()==RDNotification::CatchEventType) {
switch(notify->action()) {
case RDNotification::AddAction:
case RDNotification::ModifyAction:
case RDNotification::DeleteAction:
UpdateEvent(notify->id().toUInt());
break;
case RDNotification::NoAction:
case RDNotification::LastAction:
break;
}
}
}
void MainObject::newConnectionData()
{
int i=0;
@ -568,12 +587,6 @@ void MainObject::startTimerData(int id)
unsigned deck=catch_events[event].channel()-1;
catch_events[event].setStatus(RDDeck::Idle);
for(unsigned i=0;i<catch_events.size();i++) {
if((catch_events[i].status()==RDDeck::Waiting)&&
((catch_events[i].channel()-1)==deck)) {
// waiting=true;
}
}
WriteExitCodeById(id,RDRecording::Ok);
catch_record_deck_status[deck]=RDDeck::Idle;
catch_record_id[deck]=0;
@ -1702,31 +1715,6 @@ void MainObject::DispatchCommand(ServerConnection *conn)
LoadEngine();
}
if((cmds.at(0)=="RA")&&(cmds.size()==2)) { // Add Event
if(AddEvent(cmds.at(1).toInt())) {
EchoArgs(conn->id(),'+');
BroadcastCommand("RU "+cmds.at(1)+"!",conn->id());
}
else {
EchoArgs(conn->id(),'-');
}
}
if((cmds.at(0)=="RR")&&(cmds.size()==2)) { // Remove Event
RemoveEvent(cmds.at(1).toInt());
EchoArgs(conn->id(),'+');
BroadcastCommand("RU "+cmds.at(1)+"!",conn->id());
}
if((cmds.at(0)=="RU")&&(cmds.size()==2)) { // Update Event
if(UpdateEvent(cmds.at(1).toInt())) {
EchoArgs(conn->id(),'+');
}
else {
EchoArgs(conn->id(),'-');
}
}
if(cmds.at(0)=="RD") { // Load Deck List
EchoArgs(conn->id(),'+');
LoadDeckList();
@ -2238,7 +2226,8 @@ bool MainObject::AddEvent(int id)
delete q;
return true;
}
LogLine(RDConfig::LogWarning,QString().sprintf("event %d not found, not loaded",id));
LogLine(RDConfig::LogDebug,QString().
sprintf("event %d not found, not loaded",id));
delete q;
return false;
}
@ -2248,7 +2237,7 @@ void MainObject::RemoveEvent(int id)
{
int event=GetEvent(id);
if(event<0) {
LogLine(RDConfig::LogNotice,QString().
LogLine(RDConfig::LogDebug,QString().
sprintf("event %d not found, not removed",id));
return;
}

View File

@ -2,7 +2,7 @@
//
// The Rivendell Netcatcher.
//
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@ -128,6 +128,7 @@ class MainObject : public QObject
void updateXloadsData();
void startupCartData();
void log(RDConfig::LogPriority prio,const QString &line);
void notificationReceivedData(RDNotification *notify);
//
// batch.cpp