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

* Refactored rdcatch(1) to use the notification mechanism instead of
	the 'StopDeck' catch command.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-10-31 11:49:29 -04:00
parent 47cf0d34e4
commit eb060e37c9
12 changed files with 191 additions and 181 deletions

View File

@@ -90,12 +90,6 @@ void RDCatchConnect::reloadDropboxes()
}
void RDCatchConnect::stop(int deck)
{
SendCommand(QString::asprintf("SR %d!",deck));
}
void RDCatchConnect::monitor(int deck,bool state)
{
SendCommand(QString::asprintf("MN %d %d!",deck,state));

View File

@@ -49,7 +49,6 @@ class RDCatchConnect : public QObject
void reloadDropboxes();
public slots:
void stop(int deck);
void monitor(int deck,bool state);
void toggleMonitor(int deck);
void setExitCode(int id,RDRecording::ExitCode code,const QString &msg);

View File

@@ -73,6 +73,18 @@ void RDCatchEvent::setHostName(const QString &str)
}
QString RDCatchEvent::targetHostName() const
{
return d_target_host_name;
}
void RDCatchEvent::setTargetHostName(const QString &str)
{
d_target_host_name=str;
}
unsigned RDCatchEvent::eventId() const
{
return d_event_id;
@@ -141,7 +153,7 @@ bool RDCatchEvent::isValid() const
bool RDCatchEvent::read(const QString &str)
{
printf("RDCatchEvent::read(\"%s\")\n",str.toUtf8().constData());
// printf("RDCatchEvent::read(\"%s\")\n",str.toUtf8().constData());
RDCatchEvent::Operation op=RDCatchEvent::NullOp;
QStringList f0=str.split(" ");
@@ -216,6 +228,17 @@ bool RDCatchEvent::read(const QString &str)
}
}
if(ok&&(op==RDCatchEvent::StopDeckOp)) {
if(f0.size()!=5) {
return false;
}
d_operation=op;
d_host_name=f0.at(1);
d_target_host_name=f0.at(3);
d_deck_channel=f0.at(4).toInt();
return true;
}
return false;
}
@@ -252,6 +275,11 @@ QString RDCatchEvent::write() const
case RDCatchEvent::NullOp:
case RDCatchEvent::LastOp:
break;
case RDCatchEvent::StopDeckOp:
ret+=" "+d_target_host_name;
ret+=QString::asprintf(" %u",d_deck_channel);
break;
}
return ret;
@@ -290,6 +318,12 @@ QString RDCatchEvent::dump() const
ret+=QString::asprintf("cut number: %d\n",d_cut_number);
break;
case RDCatchEvent::StopDeckOp:
ret+="operation: RDCatchEvent::DeckEventProcessedOp\n";
ret+="target hostname: "+d_target_host_name+"\n";
ret+=QString::asprintf("deck channel: %u\n",d_deck_channel);
break;
case RDCatchEvent::NullOp:
case RDCatchEvent::LastOp:
break;

View File

@@ -31,13 +31,15 @@ class RDCatchEvent
public:
enum Operation {NullOp=0,DeckEventProcessedOp=1,
DeckStatusQueryOp=2,DeckStatusResponseOp=3,
LastOp=5};
StopDeckOp=5,LastOp=6};
RDCatchEvent(RDDeck::Status status);
RDCatchEvent();
Operation operation() const;
void setOperation(Operation op);
QString hostName() const;
void setHostName(const QString &str);
QString targetHostName() const;
void setTargetHostName(const QString &str);
unsigned eventId() const;
void setEventId(unsigned id);
unsigned cartNumber() const;
@@ -59,6 +61,7 @@ class RDCatchEvent
private:
Operation d_operation;
QString d_host_name;
QString d_target_host_name;
unsigned d_event_id;
unsigned d_cart_number;
int d_cut_number;