2019-12-09 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rdcatchd(8) that failed to send a MODIFY
	notification at the end of a Record or Download event.
This commit is contained in:
Fred Gleason 2019-12-09 03:01:03 -05:00
parent 525573a245
commit c7efd9245c
4 changed files with 42 additions and 1 deletions

View File

@ -19312,3 +19312,6 @@
2019-12-09 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the rdxport service that could cause MODIFY
notifications to fail to be sent by the 'SaveLog' WebAPI call.
2019-12-09 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdcatchd(8) that failed to send a MODIFY
notification at the end of a Record or Download event.

View File

@ -66,16 +66,28 @@ void MainObject::catchConnectedData(int serial,bool state)
exit(256);
}
connect(rda,SIGNAL(userChanged()),this,SLOT(userChangedData()));
rda->ripc()->
connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
}
void MainObject::userChangedData()
{
//
// Dispatch Handler
//
switch(batch_event->type()) {
case RDRecording::Recording:
RunImport(batch_event);
SendNotification(RDNotification::CartType,RDNotification::ModifyAction,
RDCut::cartNumber(batch_event->cutName()));
break;
case RDRecording::Download:
RunDownload(batch_event);
SendNotification(RDNotification::CartType,RDNotification::ModifyAction,
RDCut::cartNumber(batch_event->cutName()));
break;
case RDRecording::Upload:
@ -87,6 +99,15 @@ void MainObject::catchConnectedData(int serial,bool state)
exit(256);
}
QTimer *timer=new QTimer(this);
timer->setSingleShot(true);
connect(timer,SIGNAL(timeout()),this,SLOT(exitData()));
timer->start(5000); // So notifications have a chance to propagate
}
void MainObject::exitData()
{
exit(0);
}
@ -95,7 +116,6 @@ void MainObject::RunBatch(RDCmdSwitch *cmd)
{
bool ok=false;
int id=-1;
// unsigned schema=0;
//
// Set Process Priority
@ -240,6 +260,7 @@ void MainObject::RunDownload(CatchEvent *evt)
catch_connect->setExitCode(evt->id(),RDRecording::Ok,"OK");
}
void MainObject::RunUpload(CatchEvent *evt)
{
RDUpload::ErrorCode conv_err;

View File

@ -978,6 +978,9 @@ void MainObject::recordUnloadedData(int card,int stream,unsigned msecs)
if(debug) {
printf("Unloaded - Card: %d Stream: %d\n",card,stream);
}
SendNotification(RDNotification::CartType,
RDNotification::ModifyAction,
RDCut::cartNumber(catch_events[event].cutName()));
if(catch_events[event].oneShot()) {
PurgeEvent(event);
}
@ -2652,6 +2655,16 @@ void MainObject::StartBatch(int id)
}
void MainObject::SendNotification(RDNotification::Type type,
RDNotification::Action action,
const QVariant &id)
{
RDNotification *notify=new RDNotification(type,action,id);
rda->ripc()->sendNotification(*notify);
delete notify;
}
QString MainObject::GetTempRecordingName(int id) const
{
return QString().sprintf("%s/rdcatchd-record-%d.%s",

View File

@ -128,6 +128,8 @@ class MainObject : public QObject
// batch.cpp
//
void catchConnectedData(int serial,bool state);
void userChangedData();
void exitData();
private:
//
@ -193,6 +195,8 @@ class MainObject : public QObject
void RunRmlRecordingCache(int chan);
void StartRmlRecording(int chan,int cartnum,int cutnum,int maxlen);
void StartBatch(int id);
void SendNotification(RDNotification::Type type,RDNotification::Action,
const QVariant &id);
QString GetTempRecordingName(int id) const;
QString catch_default_user;
QString catch_host;