mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-16 15:41:13 +02:00
2022-11-01 Fred Gleason <fredg@paravelsystems.com>
* Refactored rdcatch(1) to use the notification mechanism instead of the 'Input Monitor State' catch command. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -89,7 +89,7 @@ void RDCatchConnect::reloadDropboxes()
|
||||
SendCommand("RX!");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void RDCatchConnect::monitor(int deck,bool state)
|
||||
{
|
||||
SendCommand(QString::asprintf("MN %d %d!",deck,state));
|
||||
@@ -105,7 +105,7 @@ void RDCatchConnect::toggleMonitor(int deck)
|
||||
SendCommand(QString::asprintf("MN %d 1!",deck));
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void RDCatchConnect::setExitCode(int id,RDRecording::ExitCode code,
|
||||
const QString &msg)
|
||||
@@ -277,6 +277,7 @@ void RDCatchConnect::DispatchCommand()
|
||||
cc_heartbeat_timer->start(CC_HEARTBEAT_INTERVAL);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if(!strcmp(args[0],"MN")) { // Monitor State
|
||||
if(sscanf(args[1],"%d",&deck)!=1) {
|
||||
return;
|
||||
@@ -290,6 +291,7 @@ void RDCatchConnect::DispatchCommand()
|
||||
emit monitorChanged(cc_serial,deck,false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@@ -49,15 +49,15 @@ class RDCatchConnect : public QObject
|
||||
void reloadDropboxes();
|
||||
|
||||
public slots:
|
||||
void monitor(int deck,bool state);
|
||||
void toggleMonitor(int deck);
|
||||
// void monitor(int deck,bool state);
|
||||
// void toggleMonitor(int deck);
|
||||
void setExitCode(int id,RDRecording::ExitCode code,const QString &msg);
|
||||
|
||||
signals:
|
||||
void connected(int serial,bool state);
|
||||
void statusChanged(int serial,unsigned channel,RDDeck::Status status,
|
||||
int id,const QString &cutname);
|
||||
void monitorChanged(int serial,unsigned channel,bool state);
|
||||
// void monitorChanged(int serial,unsigned channel,bool state);
|
||||
void meterLevel(int serial,int deck,int chan,int level);
|
||||
void eventUpdated(int id);
|
||||
void eventPurged(int id);
|
||||
|
@@ -145,9 +145,15 @@ void RDCatchEvent::setDeckStatus(RDDeck::Status status)
|
||||
}
|
||||
|
||||
|
||||
bool RDCatchEvent::isValid() const
|
||||
bool RDCatchEvent::inputMonitorActive() const
|
||||
{
|
||||
return true;
|
||||
return d_input_monitor_active;
|
||||
}
|
||||
|
||||
|
||||
void RDCatchEvent::setInputMonitorActive(bool state)
|
||||
{
|
||||
d_input_monitor_active=state;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,6 +163,11 @@ bool RDCatchEvent::read(const QString &str)
|
||||
|
||||
RDCatchEvent::Operation op=RDCatchEvent::NullOp;
|
||||
QStringList f0=str.split(" ");
|
||||
|
||||
unsigned chan=0;
|
||||
unsigned num=0;
|
||||
RDDeck::Status status=RDDeck::Offline;
|
||||
int state=0;
|
||||
bool ok=false;
|
||||
|
||||
clear();
|
||||
@@ -168,19 +179,24 @@ bool RDCatchEvent::read(const QString &str)
|
||||
return false;
|
||||
}
|
||||
op=(RDCatchEvent::Operation)f0.at(2).toUInt(&ok);
|
||||
if(!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Operation-specific Fields
|
||||
//
|
||||
if(ok&&(op==RDCatchEvent::DeckEventProcessedOp)) {
|
||||
rda->syslog(LOG_NOTICE,"HERE0 op: %u",op);
|
||||
switch(op) {
|
||||
case RDCatchEvent::DeckEventProcessedOp:
|
||||
if(f0.size()!=5) {
|
||||
return false;
|
||||
}
|
||||
unsigned chan=f0.at(3).toUInt(&ok);
|
||||
chan=f0.at(3).toUInt(&ok);
|
||||
if(!ok) {
|
||||
return false;
|
||||
}
|
||||
unsigned num=f0.at(4).toUInt(&ok);
|
||||
num=f0.at(4).toUInt(&ok);
|
||||
if(ok) {
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
@@ -188,24 +204,24 @@ bool RDCatchEvent::read(const QString &str)
|
||||
d_event_number=num;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if(ok&&(op==RDCatchEvent::DeckStatusQueryOp)) {
|
||||
case RDCatchEvent::DeckStatusQueryOp:
|
||||
if(f0.size()!=3) {
|
||||
return false;
|
||||
}
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
if(ok&&(op==RDCatchEvent::DeckStatusResponseOp)) {
|
||||
case RDCatchEvent::DeckStatusResponseOp:
|
||||
if(f0.size()!=8) {
|
||||
return false;
|
||||
}
|
||||
int chan=f0.at(3).toUInt(&ok);
|
||||
chan=f0.at(3).toUInt(&ok);
|
||||
if(ok&&(chan<255)) {
|
||||
RDDeck::Status status=(RDDeck::Status)f0.at(4).toUInt(&ok);
|
||||
status=(RDDeck::Status)f0.at(4).toUInt(&ok);
|
||||
if(ok&&(status<RDDeck::LastStatus)) {
|
||||
unsigned id=f0.at(5).toUInt(&ok);
|
||||
if(ok) {
|
||||
@@ -226,17 +242,60 @@ bool RDCatchEvent::read(const QString &str)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if(ok&&(op==RDCatchEvent::StopDeckOp)) {
|
||||
case 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;
|
||||
chan=f0.at(4).toInt(&ok);
|
||||
if(ok&&(chan<255)) {
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
d_target_host_name=f0.at(3);
|
||||
d_deck_channel=chan;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCatchEvent::SetInputMonitorOp:
|
||||
if(f0.size()!=6) {
|
||||
return false;
|
||||
}
|
||||
chan=f0.at(4).toInt(&ok);
|
||||
if(ok&&(chan<255)) {
|
||||
state=f0.at(5).toUInt(&ok);
|
||||
if((state==0)||(state==1)) {
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
d_target_host_name=f0.at(3);
|
||||
d_deck_channel=chan;
|
||||
d_input_monitor_active=(state==1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCatchEvent::SetInputMonitorResponseOp:
|
||||
if(f0.size()!=5) {
|
||||
return false;
|
||||
}
|
||||
chan=f0.at(3).toInt(&ok);
|
||||
if(ok&&(chan<255)) {
|
||||
state=f0.at(4).toUInt(&ok);
|
||||
if((state==0)||(state==1)) {
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
d_deck_channel=chan;
|
||||
d_input_monitor_active=(state==1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCatchEvent::NullOp:
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -276,6 +335,17 @@ QString RDCatchEvent::write() const
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
|
||||
case RDCatchEvent::SetInputMonitorOp:
|
||||
ret+=" "+d_target_host_name;
|
||||
ret+=QString::asprintf(" %u",d_deck_channel);
|
||||
ret+=QString::asprintf(" %u",d_input_monitor_active);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::SetInputMonitorResponseOp:
|
||||
ret+=QString::asprintf(" %u",d_deck_channel);
|
||||
ret+=QString::asprintf(" %u",d_input_monitor_active);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::StopDeckOp:
|
||||
ret+=" "+d_target_host_name;
|
||||
ret+=QString::asprintf(" %u",d_deck_channel);
|
||||
@@ -324,6 +394,19 @@ QString RDCatchEvent::dump() const
|
||||
ret+=QString::asprintf("deck channel: %u\n",d_deck_channel);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::SetInputMonitorOp:
|
||||
ret+="operation: RDCatchEvent::DeckEventProcessedOp\n";
|
||||
ret+="target hostname: "+d_target_host_name+"\n";
|
||||
ret+=QString::asprintf("deck channel: %u\n",d_deck_channel);
|
||||
ret+=QString::asprintf("input monitor active: %u\n",d_input_monitor_active);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::SetInputMonitorResponseOp:
|
||||
ret+="operation: RDCatchEvent::DeckEventProcessedOp\n";
|
||||
ret+=QString::asprintf("deck channel: %u\n",d_deck_channel);
|
||||
ret+=QString::asprintf("input monitor active: %u\n",d_input_monitor_active);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::NullOp:
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
@@ -337,10 +420,12 @@ void RDCatchEvent::clear()
|
||||
{
|
||||
d_operation=RDCatchEvent::NullOp;
|
||||
d_host_name=rda->station()->name();
|
||||
d_target_host_name="";
|
||||
d_event_id=0;
|
||||
d_cart_number=0;
|
||||
d_cut_number=0;
|
||||
d_deck_channel=0;
|
||||
d_event_number=0;
|
||||
d_input_monitor_active=false;
|
||||
d_deck_status=RDDeck::Offline;
|
||||
}
|
||||
|
@@ -31,7 +31,8 @@ class RDCatchEvent
|
||||
public:
|
||||
enum Operation {NullOp=0,DeckEventProcessedOp=1,
|
||||
DeckStatusQueryOp=2,DeckStatusResponseOp=3,
|
||||
StopDeckOp=5,LastOp=6};
|
||||
StopDeckOp=4,SetInputMonitorOp=5,SetInputMonitorResponseOp=6,
|
||||
LastOp=7};
|
||||
RDCatchEvent(RDDeck::Status status);
|
||||
RDCatchEvent();
|
||||
Operation operation() const;
|
||||
@@ -52,7 +53,8 @@ class RDCatchEvent
|
||||
void setEventNumber(int num);
|
||||
RDDeck::Status deckStatus() const;
|
||||
void setDeckStatus(RDDeck::Status status);
|
||||
bool isValid() const;
|
||||
bool inputMonitorActive() const;
|
||||
void setInputMonitorActive(bool state);
|
||||
bool read(const QString &str);
|
||||
QString write() const;
|
||||
QString dump() const;
|
||||
@@ -67,6 +69,7 @@ class RDCatchEvent
|
||||
int d_cut_number;
|
||||
unsigned d_deck_channel;
|
||||
int d_event_number;
|
||||
bool d_input_monitor_active;
|
||||
RDDeck::Status d_deck_status;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user