diff --git a/.#ChangeLog b/.#ChangeLog deleted file mode 120000 index c4328c48..00000000 --- a/.#ChangeLog +++ /dev/null @@ -1 +0,0 @@ -fredg@frozone.paravelsystems.com.26763:1666465399 \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 151300e3..b009ebc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23572,3 +23572,5 @@ 2022-10-30 Fred Gleason * Reimplemented the 'Request Deck Status' command using 'RDCatchEvent'. +2022-10-30 Fred Gleason + * Reimplemented the 'PurgeEvent' command using 'RDCatchEvent'. diff --git a/docs/apis/notification.xml b/docs/apis/notification.xml index e6cf6024..0793e167 100644 --- a/docs/apis/notification.xml +++ b/docs/apis/notification.xml @@ -576,8 +576,42 @@ + - + + Purge Event Operation + + Emitted by rdcatch1 to + report purging of a one-shot event. + + + RDCatch Event Request Fields + + + + + + Field + Value + + + Hostname + String, from STATIONS.NAME + + + Operation + Integer. 4 [RDCatchEvent::PurgeEventOp] + + + Event ID + + Unsigned Integer, from RECORDINGS.ID. + + + + +
+ diff --git a/lib/rdcatch_connect.cpp b/lib/rdcatch_connect.cpp index 6acd67d7..f9deca3b 100644 --- a/lib/rdcatch_connect.cpp +++ b/lib/rdcatch_connect.cpp @@ -318,14 +318,14 @@ void RDCatchConnect::DispatchCommand() } emit eventUpdated(id); } - + /* if(!strcmp(args[0],"PE")) { // Purge Event if(sscanf(args[1],"%d",&id)!=1) { return; } emit eventPurged(id); } - + */ if(!strcmp(args[0],"HB")) { // Heartbeat cc_heartbeat_timer->stop(); cc_heartbeat_timer->start(CC_HEARTBEAT_INTERVAL); diff --git a/lib/rdcatchevent.cpp b/lib/rdcatchevent.cpp index cbfe232f..b58aa138 100644 --- a/lib/rdcatchevent.cpp +++ b/lib/rdcatchevent.cpp @@ -141,6 +141,8 @@ bool RDCatchEvent::isValid() const bool RDCatchEvent::read(const QString &str) { + printf("RDCatchEvent::read(\"%s\")\n",str.toUtf8().constData()); + RDCatchEvent::Operation op=RDCatchEvent::NullOp; QStringList f0=str.split(" "); bool ok=false; @@ -214,6 +216,19 @@ bool RDCatchEvent::read(const QString &str) } } + if(ok&&(op==RDCatchEvent::PurgeEventOp)) { + if(f0.size()!=4) { + return false; + } + unsigned id=f0.at(3).toUInt(&ok); + if(ok) { + d_operation=op; + d_host_name=f0.at(1); + d_event_id=id; + return true; + } + } + return false; } @@ -246,6 +261,10 @@ QString RDCatchEvent::write() const ret+=QString::asprintf(" %d",d_cut_number); break; + case RDCatchEvent::PurgeEventOp: + ret+=QString::asprintf(" %u",d_event_id); + break; + case RDCatchEvent::DeckStatusQueryOp: case RDCatchEvent::NullOp: case RDCatchEvent::LastOp: @@ -288,6 +307,11 @@ QString RDCatchEvent::dump() const ret+=QString::asprintf("cut number: %d\n",d_cut_number); break; + case RDCatchEvent::PurgeEventOp: + ret+="operation: RDCatchEvent::PurgeEventOpOp\n"; + ret+=QString::asprintf("event id: %u\n",d_event_id); + break; + case RDCatchEvent::NullOp: case RDCatchEvent::LastOp: break; diff --git a/lib/rdcatchevent.h b/lib/rdcatchevent.h index 42dc7a80..5dd66cde 100644 --- a/lib/rdcatchevent.h +++ b/lib/rdcatchevent.h @@ -31,7 +31,7 @@ class RDCatchEvent public: enum Operation {NullOp=0,DeckEventProcessedOp=1, DeckStatusQueryOp=2,DeckStatusResponseOp=3, - LastOp=4}; + PurgeEventOp=4,LastOp=5}; RDCatchEvent(RDDeck::Status status); RDCatchEvent(); Operation operation() const; diff --git a/rdcatch/rdcatch.cpp b/rdcatch/rdcatch.cpp index 656e3fdb..d11a14b6 100644 --- a/rdcatch/rdcatch.cpp +++ b/rdcatch/rdcatch.cpp @@ -208,9 +208,11 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) connect(catch_connect.back()->connector(), SIGNAL(eventUpdated(int)), this,SLOT(eventUpdatedData(int))); + /* connect(catch_connect.back()->connector(), SIGNAL(eventPurged(int)), this,SLOT(eventPurgedData(int))); + */ /* connect(catch_connect.back()->connector(), SIGNAL(deckEventSent(int,int,int)), @@ -799,6 +801,20 @@ void MainWidget::catchEventReceivedData(RDCatchEvent *evt) { printf("catchEventReceivedData()\n"); printf("%s\n",evt->dump().toUtf8().constData()); + + switch(evt->operation()) { + case RDCatchEvent::PurgeEventOp: + catch_recordings_model->removeRecord(evt->eventId()); + printf("removed event %u\n",evt->eventId()); + break; + + case RDCatchEvent::DeckEventProcessedOp: + case RDCatchEvent::DeckStatusQueryOp: + case RDCatchEvent::DeckStatusResponseOp: + case RDCatchEvent::NullOp: + case RDCatchEvent::LastOp: + break; + } } @@ -1012,12 +1028,12 @@ void MainWidget::eventUpdatedData(int id) nextEventData(); } - +/* void MainWidget::eventPurgedData(int id) { catch_recordings_model->removeRecord(id); } - +*/ void MainWidget::heartbeatFailedData(int id) { diff --git a/rdcatch/rdcatch.h b/rdcatch/rdcatch.h index 2b99d1fd..09baa53e 100644 --- a/rdcatch/rdcatch.h +++ b/rdcatch/rdcatch.h @@ -103,7 +103,7 @@ class MainWidget : public RDMainWindow void clockData(); void midnightData(); void eventUpdatedData(int id); - void eventPurgedData(int id); + // void eventPurgedData(int id); void heartbeatFailedData(int id); void quitMainWidget(); diff --git a/rdcatchd/rdcatchd.cpp b/rdcatchd/rdcatchd.cpp index 301be2fc..652e22f0 100644 --- a/rdcatchd/rdcatchd.cpp +++ b/rdcatchd/rdcatchd.cpp @@ -2436,9 +2436,14 @@ void MainObject::PurgeEvent(int event) { QString sql=QString::asprintf("delete from `RECORDINGS` where `ID`=%d", catch_events[event].id()); - RDSqlQuery *q=new RDSqlQuery(sql); - delete q; - BroadcastCommand(QString::asprintf("PE %d!",catch_events[event].id())); + RDSqlQuery::apply(sql); + + RDCatchEvent *evt=new RDCatchEvent(); + evt->setOperation(RDCatchEvent::PurgeEventOp); + evt->setEventId(catch_events[event].id()); + rda->ripc()->sendCatchEvent(evt); + delete evt; + switch(catch_events[event].type()) { case RDRecording::Recording: rda->syslog(LOG_INFO,"purged event %d, Type: recording, Cut: %s",