mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-19 14:43:30 +02:00
2022-10-30 Fred Gleason <fredg@paravelsystems.com>
* Reimplemented the 'Request Deck Status' command using 'RDCatchEvent'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
d38349cf39
commit
d65517215b
1
.#ChangeLog
Symbolic link
1
.#ChangeLog
Symbolic link
@ -0,0 +1 @@
|
||||
fredg@frozone.paravelsystems.com.26763:1666465399
|
@ -23569,3 +23569,6 @@
|
||||
* Added an 'RDCatchEvent' class.
|
||||
* Reimplemented the 'Deck Event Processed' command using
|
||||
'RDCatchEvent'.
|
||||
2022-10-30 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Reimplemented the 'Request Deck Status' command using
|
||||
'RDCatchEvent'.
|
||||
|
@ -401,6 +401,10 @@
|
||||
|
||||
<sect2 xml:id="sect.rdcatch_event_processed">
|
||||
<title>Deck Event Processed Operation</title>
|
||||
<para>
|
||||
Emitted by <command>rdcatchd</command><manvolnum>8</manvolnum> every
|
||||
time a 'Cut Event' ['CE'] RML is processed.
|
||||
</para>
|
||||
<table xml:id="table.rdcatch_event_processed" frame="all" pgwide="0">
|
||||
<title>RDCatch Event Fields</title>
|
||||
<tgroup cols="2" align="left" colsep="1" rowsep="1">
|
||||
@ -417,7 +421,7 @@
|
||||
</row>
|
||||
<row>
|
||||
<entry>Operation</entry>
|
||||
<entry>"DE"</entry>
|
||||
<entry>Integer. 1 [RDCatchEvent::DeckEventProcessedOp]</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Deck Channel</entry>
|
||||
@ -439,8 +443,12 @@
|
||||
|
||||
<sect2 xml:id="sect.rdcatch_deck_status">
|
||||
<title>Deck Status Operation</title>
|
||||
<table xml:id="table.rdcatch_deck_status" frame="all" pgwide="0">
|
||||
<title>RDCatch Event Fields</title>
|
||||
<para>
|
||||
Emitted by <command>rdcatch</command><manvolnum>1</manvolnum> at
|
||||
startup to request the current status of all decks.
|
||||
</para>
|
||||
<table xml:id="table.rdcatch_deck_status.request" frame="all" pgwide="0">
|
||||
<title>RDCatch Event Request Fields</title>
|
||||
<tgroup cols="2" align="left" colsep="1" rowsep="1">
|
||||
<colspec colname="Field" colwidth="2.0*"/>
|
||||
<colspec colname="Value" colwidth="2.0*"/>
|
||||
@ -455,7 +463,34 @@
|
||||
</row>
|
||||
<row>
|
||||
<entry>Operation</entry>
|
||||
<entry>"ME"</entry>
|
||||
<entry>Integer. 2 [RDCatchEvent::DeckStatusQueryOp]</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
Emitted by <command>rdcatchd</command><manvolnum>8</manvolnum> whenever
|
||||
the status of a deck changes, or as a set in response to a request.
|
||||
(See <xref linkend="table.rdcatch_deck_status.request" />).
|
||||
</para>
|
||||
<table xml:id="table.rdcatch_deck_status.response" frame="all" pgwide="0">
|
||||
<title>RDCatch Event Response Fields</title>
|
||||
<tgroup cols="2" align="left" colsep="1" rowsep="1">
|
||||
<colspec colname="Field" colwidth="2.0*"/>
|
||||
<colspec colname="Value" colwidth="2.0*"/>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Field</entry>
|
||||
<entry>Value</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Hostname</entry>
|
||||
<entry>String, from STATIONS.NAME</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Operation</entry>
|
||||
<entry>Integer. 3 [RDCatchEvent::DeckStatusResponseOp]</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Deck Channel</entry>
|
||||
@ -469,13 +504,33 @@
|
||||
<entry>
|
||||
Integer. Current status of the specified deck. See
|
||||
<xref linkend="sect.rdcatch_deck_status.deck_status_codes" />
|
||||
for code point values.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Event ID</entry>
|
||||
<entry>
|
||||
Unsigned Integer, from RECORDINGS.ID or 0 if deck is inactive.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Cart Number</entry>
|
||||
<entry>
|
||||
Unsigned Integer, from CART.NUMBER or 0 if deck status is not
|
||||
3 [Active].
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Cut Number</entry>
|
||||
<entry>
|
||||
Integer, from cut part of CUTS.CUTNAME or 0 if deck status is
|
||||
not 3 [Active].
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
|
||||
<sect3 xml:id="sect.rdcatch_deck_status.deck_status_codes">
|
||||
<title>Deck Status Codes</title>
|
||||
<table frame="all">
|
||||
|
@ -316,7 +316,6 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rdcartfilter.cpp\
|
||||
moc_rdcartslot.cpp\
|
||||
moc_rdcatch_connect.cpp\
|
||||
moc_rdcatchevent.cpp\
|
||||
moc_rdcddblookup.cpp\
|
||||
moc_rdcdplayer.cpp\
|
||||
moc_rdcdripper.cpp\
|
||||
|
@ -234,10 +234,10 @@ void RDCatchConnect::DispatchCommand()
|
||||
int deck;
|
||||
int channel;
|
||||
int level;
|
||||
unsigned chan;
|
||||
int status;
|
||||
// unsigned chan;
|
||||
// int status;
|
||||
int id;
|
||||
int number;
|
||||
// int number;
|
||||
|
||||
if(!strcmp(args[0],"PW")) { // Password Response
|
||||
if(args[1][0]=='+') {
|
||||
@ -248,7 +248,7 @@ void RDCatchConnect::DispatchCommand()
|
||||
emit connected(cc_serial,false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(!strcmp(args[0],"DE")) { // Deck Event
|
||||
if(sscanf(args[1],"%d",&deck)!=1) {
|
||||
return;
|
||||
@ -297,7 +297,7 @@ void RDCatchConnect::DispatchCommand()
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
if(!strcmp(args[0],"RM")) { // Meter Level
|
||||
if(sscanf(args[1],"%d",&deck)!=1) {
|
||||
return;
|
||||
|
@ -67,7 +67,7 @@ class RDCatchConnect : public QObject
|
||||
void meterLevel(int serial,int deck,int chan,int level);
|
||||
void eventUpdated(int id);
|
||||
void eventPurged(int id);
|
||||
void deckEventSent(int serial,int chan,int number);
|
||||
// void deckEventSent(int serial,int chan,int number);
|
||||
void heartbeatFailed(int id);
|
||||
|
||||
private slots:
|
||||
|
@ -73,6 +73,42 @@ void RDCatchEvent::setHostName(const QString &str)
|
||||
}
|
||||
|
||||
|
||||
unsigned RDCatchEvent::eventId() const
|
||||
{
|
||||
return d_event_id;
|
||||
}
|
||||
|
||||
|
||||
void RDCatchEvent::setEventId(unsigned id)
|
||||
{
|
||||
d_event_id=id;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDCatchEvent::cartNumber() const
|
||||
{
|
||||
return d_cart_number;
|
||||
}
|
||||
|
||||
|
||||
void RDCatchEvent::setCartNumber(unsigned cartnum)
|
||||
{
|
||||
d_cart_number=cartnum;
|
||||
}
|
||||
|
||||
|
||||
int RDCatchEvent::cutNumber() const
|
||||
{
|
||||
return d_cut_number;
|
||||
}
|
||||
|
||||
|
||||
void RDCatchEvent::setCutNumber(int cutnum)
|
||||
{
|
||||
d_cut_number=cutnum;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDCatchEvent::deckChannel() const
|
||||
{
|
||||
return d_deck_channel;
|
||||
@ -105,6 +141,7 @@ bool RDCatchEvent::isValid() const
|
||||
|
||||
bool RDCatchEvent::read(const QString &str)
|
||||
{
|
||||
RDCatchEvent::Operation op=RDCatchEvent::NullOp;
|
||||
QStringList f0=str.split(" ");
|
||||
bool ok=false;
|
||||
|
||||
@ -116,12 +153,12 @@ bool RDCatchEvent::read(const QString &str)
|
||||
if((f0.size()<3)||(f0.at(0)!="CATCH")) {
|
||||
return false;
|
||||
}
|
||||
op=(RDCatchEvent::Operation)f0.at(2).toUInt(&ok);
|
||||
|
||||
//
|
||||
// Operation-specific Fields
|
||||
//
|
||||
if(f0.at(2)==
|
||||
RDCatchEvent::operationString(RDCatchEvent::DeckEventProcessedOp)) {
|
||||
if(ok&&(op==RDCatchEvent::DeckEventProcessedOp)) {
|
||||
if(f0.size()!=5) {
|
||||
return false;
|
||||
}
|
||||
@ -131,33 +168,52 @@ bool RDCatchEvent::read(const QString &str)
|
||||
}
|
||||
unsigned num=f0.at(4).toUInt(&ok);
|
||||
if(ok) {
|
||||
d_operation=RDCatchEvent::DeckEventProcessedOp;
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
d_deck_channel=chan;
|
||||
d_event_number=num;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(f0.at(2)==
|
||||
RDCatchEvent::operationString(RDCatchEvent::DeckEventProcessedOp)) {
|
||||
if(f0.size()!=5) {
|
||||
|
||||
if(ok&&(op==RDCatchEvent::DeckStatusQueryOp)) {
|
||||
if(f0.size()!=3) {
|
||||
return false;
|
||||
}
|
||||
unsigned chan=f0.at(3).toUInt(&ok);
|
||||
if(!ok) {
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(ok&&(op==RDCatchEvent::DeckStatusResponseOp)) {
|
||||
if(f0.size()!=8) {
|
||||
return false;
|
||||
}
|
||||
unsigned val=f0.at(4).toUInt(&ok);
|
||||
if(ok&&(val<RDDeck::LastStatus)) {
|
||||
d_operation=RDCatchEvent::DeckEventProcessedOp;
|
||||
int chan=f0.at(3).toUInt(&ok);
|
||||
if(ok&&(chan<255)) {
|
||||
RDDeck::Status status=(RDDeck::Status)f0.at(4).toUInt(&ok);
|
||||
if(ok&&(status<RDDeck::LastStatus)) {
|
||||
unsigned id=f0.at(5).toUInt(&ok);
|
||||
if(ok) {
|
||||
unsigned cartnum=f0.at(6).toUInt(&ok);
|
||||
if(ok&&(cartnum<=RD_MAX_CART_NUMBER)) {
|
||||
int cutnum=f0.at(7).toInt(&ok);
|
||||
if(ok&&(cutnum>=0)&&(cutnum<=RD_MAX_CUT_NUMBER)) {
|
||||
d_operation=op;
|
||||
d_host_name=f0.at(1);
|
||||
d_deck_channel=chan;
|
||||
d_deck_status=(RDDeck::Status)val;
|
||||
d_deck_status=status;
|
||||
d_event_id=id;
|
||||
d_cart_number=cartnum;
|
||||
d_cut_number=cutnum;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -171,17 +227,26 @@ QString RDCatchEvent::write() const
|
||||
//
|
||||
ret+="CATCH ";
|
||||
ret+=d_host_name+" ";
|
||||
ret+=QString::asprintf("%u",d_operation);
|
||||
|
||||
//
|
||||
// Operation-specific Fields
|
||||
//
|
||||
ret+=RDCatchEvent::operationString(d_operation);
|
||||
switch(d_operation) {
|
||||
case RDCatchEvent::DeckEventProcessedOp:
|
||||
ret+=QString::asprintf(" %u",d_deck_channel);
|
||||
ret+=QString::asprintf(" %u",d_event_number);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::DeckStatusResponseOp:
|
||||
ret+=QString::asprintf(" %u",d_deck_channel);
|
||||
ret+=QString::asprintf(" %u",d_deck_status);
|
||||
ret+=QString::asprintf(" %u",d_event_id);
|
||||
ret+=QString::asprintf(" %u",d_cart_number);
|
||||
ret+=QString::asprintf(" %d",d_cut_number);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::DeckStatusQueryOp:
|
||||
case RDCatchEvent::NullOp:
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
@ -203,13 +268,26 @@ QString RDCatchEvent::dump() const
|
||||
//
|
||||
// Operation-specific Fields
|
||||
//
|
||||
ret+="operation: "+RDCatchEvent::operationString(d_operation)+"\n";
|
||||
switch(d_operation) {
|
||||
case RDCatchEvent::DeckEventProcessedOp:
|
||||
ret+="operation: RDCatchEvent::DeckEventProcessedOp\n";
|
||||
ret+=QString::asprintf("deck channel: %u\n",d_deck_channel);
|
||||
ret+=QString::asprintf("event number: %u\n",d_event_number);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::DeckStatusQueryOp:
|
||||
ret+="operation: RDCatchEvent::DeckStatusQueryOp\n";
|
||||
break;
|
||||
|
||||
case RDCatchEvent::DeckStatusResponseOp:
|
||||
ret+="operation: RDCatchEvent::DeckStatusResponseOp\n";
|
||||
ret+=QString::asprintf("deck channel: %u\n",d_deck_channel);
|
||||
ret+=QString::asprintf("deck status: %u\n",d_deck_status);
|
||||
ret+=QString::asprintf("event id: %u\n",d_event_id);
|
||||
ret+=QString::asprintf("cart number: %u\n",d_cart_number);
|
||||
ret+=QString::asprintf("cut number: %d\n",d_cut_number);
|
||||
break;
|
||||
|
||||
case RDCatchEvent::NullOp:
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
@ -223,25 +301,10 @@ void RDCatchEvent::clear()
|
||||
{
|
||||
d_operation=RDCatchEvent::NullOp;
|
||||
d_host_name=rda->station()->name();
|
||||
d_event_id=0;
|
||||
d_cart_number=0;
|
||||
d_cut_number=0;
|
||||
d_deck_channel=0;
|
||||
d_event_number=0;
|
||||
d_deck_status=RDDeck::Offline;
|
||||
}
|
||||
|
||||
|
||||
QString RDCatchEvent::operationString(Operation op)
|
||||
{
|
||||
QString ret="UNKNOWN";
|
||||
|
||||
switch(op) {
|
||||
case RDCatchEvent::DeckEventProcessedOp:
|
||||
ret="DE";
|
||||
break;
|
||||
|
||||
case RDCatchEvent::NullOp:
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -29,13 +29,21 @@
|
||||
class RDCatchEvent
|
||||
{
|
||||
public:
|
||||
enum Operation {NullOp=0,DeckEventProcessedOp=1,LastOp=2};
|
||||
enum Operation {NullOp=0,DeckEventProcessedOp=1,
|
||||
DeckStatusQueryOp=2,DeckStatusResponseOp=3,
|
||||
LastOp=4};
|
||||
RDCatchEvent(RDDeck::Status status);
|
||||
RDCatchEvent();
|
||||
Operation operation() const;
|
||||
void setOperation(Operation op);
|
||||
QString hostName() const;
|
||||
void setHostName(const QString &str);
|
||||
unsigned eventId() const;
|
||||
void setEventId(unsigned id);
|
||||
unsigned cartNumber() const;
|
||||
void setCartNumber(unsigned cartnum);
|
||||
int cutNumber() const;
|
||||
void setCutNumber(int cutnum);
|
||||
unsigned deckChannel() const;
|
||||
void setDeckChannel(unsigned chan);
|
||||
int eventNumber() const;
|
||||
@ -47,11 +55,13 @@ class RDCatchEvent
|
||||
QString write() const;
|
||||
QString dump() const;
|
||||
void clear();
|
||||
static QString operationString(Operation op);
|
||||
|
||||
private:
|
||||
Operation d_operation;
|
||||
QString d_host_name;
|
||||
unsigned d_event_id;
|
||||
unsigned d_cart_number;
|
||||
int d_cut_number;
|
||||
unsigned d_deck_channel;
|
||||
int d_event_number;
|
||||
RDDeck::Status d_deck_status;
|
||||
|
@ -250,7 +250,7 @@ void RDRipc::DispatchCommand()
|
||||
RDMacro macro;
|
||||
QString str;
|
||||
|
||||
// printf("RDRipc::DispatchCommand: %s\n",(const char *)ripc_accum.toUtf8());
|
||||
// printf("RDRipc::DispatchCommand: %s\n",ripc_accum.toUtf8().constData());
|
||||
QStringList cmds=ripc_accum.split(" ",QString::SkipEmptyParts);
|
||||
|
||||
if(cmds.size()==0) {
|
||||
|
@ -234,6 +234,11 @@ void DeckMon::processCatchEvent(RDCatchEvent *evt)
|
||||
if(evt->operation()==RDCatchEvent::DeckEventProcessedOp) {
|
||||
mon_event_light->trigger(evt->eventNumber());
|
||||
}
|
||||
|
||||
if(evt->operation()==RDCatchEvent::DeckStatusResponseOp) {
|
||||
setStatus(evt->deckStatus(),evt->eventId(),
|
||||
RDCut::cutName(evt->cartNumber(),evt->cutNumber()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,10 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
connect(rda->ripc(),SIGNAL(connected(bool)),
|
||||
this,SLOT(ripcConnectedData(bool)));
|
||||
connect(rda,SIGNAL(userChanged()),this,SLOT(ripcUserData()));
|
||||
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||
rda->ripc()->
|
||||
connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||
connect(rda->ripc(),SIGNAL(catchEventReceived(RDCatchEvent *)),
|
||||
this,SLOT(catchEventReceivedData(RDCatchEvent *)));
|
||||
|
||||
//
|
||||
// CAE Connection
|
||||
@ -732,6 +735,14 @@ void MainWidget::ripcUserData()
|
||||
catch_add_button->setEnabled(modification_allowed);
|
||||
catch_edit_button->setEnabled(modification_allowed);
|
||||
catch_delete_button->setEnabled(modification_allowed);
|
||||
|
||||
//
|
||||
// Request Deck Statuses
|
||||
//
|
||||
RDCatchEvent *evt=new RDCatchEvent();
|
||||
evt->setOperation(RDCatchEvent::DeckStatusQueryOp);
|
||||
rda->ripc()->sendCatchEvent(evt);
|
||||
delete evt;
|
||||
}
|
||||
|
||||
|
||||
|
@ -354,6 +354,7 @@ void RecordListModel::channelCounts(int chan,int *waiting,int *active,
|
||||
|
||||
case RDDeck::Offline:
|
||||
case RDDeck::Idle:
|
||||
case RDDeck::LastStatus:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -950,6 +951,7 @@ void RecordListModel::UpdateStatus(int line)
|
||||
{
|
||||
switch(d_statuses.at(line)) {
|
||||
case RDDeck::Offline:
|
||||
case RDDeck::LastStatus:
|
||||
d_back_colors[line]=QColor(EVENT_ERROR_COLOR);
|
||||
break;
|
||||
|
||||
|
@ -289,6 +289,8 @@ MainObject::MainObject(QObject *parent)
|
||||
this,SLOT(gpiStateChangedData(int,int,bool)));
|
||||
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
|
||||
this,SLOT(notificationReceivedData(RDNotification *)));
|
||||
connect(rda->ripc(),SIGNAL(catchEventReceived(RDCatchEvent *)),
|
||||
this,SLOT(catchEventReceivedData(RDCatchEvent *)));
|
||||
|
||||
//
|
||||
// CAE Connection
|
||||
@ -463,6 +465,51 @@ void MainObject::notificationReceivedData(RDNotification *notify)
|
||||
}
|
||||
|
||||
|
||||
void MainObject::catchEventReceivedData(RDCatchEvent *evt)
|
||||
{
|
||||
rda->syslog(LOG_NOTICE,"catchEventReceivedData(): %s",
|
||||
evt->dump().toUtf8().constData());
|
||||
|
||||
if(evt->operation()==RDCatchEvent::DeckStatusQueryOp) {
|
||||
SendFullEventResponse(rda->station()->address());
|
||||
}
|
||||
/*
|
||||
chan=cmds.at(1).toInt(&ok);
|
||||
if(!ok) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
return;
|
||||
}
|
||||
if(chan==0) {
|
||||
SendFullStatus(conn->id());
|
||||
return;
|
||||
}
|
||||
chan--;
|
||||
if(chan<MAX_DECKS) {
|
||||
if(catch_record_deck_status[chan]==RDDeck::Offline) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
return;
|
||||
}
|
||||
EchoCommand(conn->id(),QString::asprintf("RE %u %d %d!",
|
||||
chan+1,
|
||||
catch_record_deck_status[chan],
|
||||
catch_record_id[chan]));
|
||||
EchoCommand(conn->id(),QString::asprintf("MN %u %d!",chan+1,
|
||||
catch_monitor_state[chan]));
|
||||
return;
|
||||
}
|
||||
if((chan>=128)&&(chan<(MAX_DECKS+128))) {
|
||||
if(catch_playout_deck_status[chan-128]==RDDeck::Offline) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
return;
|
||||
}
|
||||
EchoCommand(conn->id(),
|
||||
QString::asprintf("RE %u %d %d!",
|
||||
chan+1,catch_playout_deck_status[chan-128],
|
||||
catch_playout_id[chan-128]));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::newConnectionData()
|
||||
{
|
||||
int i=0;
|
||||
@ -516,10 +563,14 @@ void MainObject::gpiStateChangedData(int matrix,int line,bool state)
|
||||
catch_events[i].gpiOffsetTimer()->
|
||||
start(catch_events[i].startOffset());
|
||||
catch_events[i].gpiStartTimer()->stop();
|
||||
SendEventResponse(catch_events[i].channel(),RDDeck::Ready,
|
||||
catch_events[i].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
catch_events[i].channel(),
|
||||
RDDeck::Ready,
|
||||
catch_events[i].id()).toUtf8());
|
||||
*/
|
||||
}
|
||||
else {
|
||||
if(StartRecording(i)) {
|
||||
@ -567,9 +618,12 @@ void MainObject::startTimerData(int id)
|
||||
WriteExitCodeById(id,RDRecording::Ok);
|
||||
catch_record_deck_status[deck]=RDDeck::Idle;
|
||||
catch_record_id[deck]=0;
|
||||
SendEventResponse(deck+1,catch_record_deck_status[deck],id,"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck+1,catch_record_deck_status[deck],
|
||||
id).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_INFO,"gpi start window closes: event: %d, gpi: %d:%d",
|
||||
id,catch_events[event].startMatrix(),
|
||||
catch_events[event].startLine());
|
||||
@ -624,10 +678,14 @@ void MainObject::engineData(int id)
|
||||
catch_events[event].channel()-128,
|
||||
catch_events[event].id());
|
||||
WriteExitCode(event,RDRecording::DeviceBusy);
|
||||
SendEventResponse(0,RDDeck::Recording,catch_events[event].id(),
|
||||
catch_events[event].cutName());
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d %s!",RDDeck::Recording,
|
||||
catch_events[event].id(),
|
||||
catch_events[event].cutName().
|
||||
toUtf8().constData()).toUtf8());
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -639,12 +697,17 @@ void MainObject::engineData(int id)
|
||||
case RDRecording::Recording:
|
||||
if(!RDCut::exists(catch_events[event].cutName())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].channel()-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE %d %d %d!",
|
||||
catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].
|
||||
channel()-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"record aborted: no such cut: %s, id: %d",
|
||||
catch_events[event].cutName().toUtf8().constData(),
|
||||
catch_events[event].id());
|
||||
@ -713,11 +776,16 @@ void MainObject::engineData(int id)
|
||||
catch_events[event].id();
|
||||
catch_events[event].setStatus(RDDeck::Waiting);
|
||||
WriteExitCode(event,RDRecording::Waiting);
|
||||
SendEventResponse(catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].channel()-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].
|
||||
channel()-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_INFO,"gpi start window opens: event: %d, gpi: %d:%d",
|
||||
id,catch_events[event].startMatrix(),
|
||||
catch_events[event].startLine());
|
||||
@ -728,12 +796,17 @@ void MainObject::engineData(int id)
|
||||
case RDRecording::Playout:
|
||||
if(!RDCut::exists(catch_events[event].cutName())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(catch_events[event].channel(),
|
||||
catch_playout_deck_status[catch_events[event].channel()-129],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE %d %d %d!",
|
||||
catch_events[event].channel(),
|
||||
catch_playout_deck_status[catch_events[event].
|
||||
channel()-129],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"playout aborted: no such cut: %s, id: %d",
|
||||
(const char *)catch_events[event].cutName().toUtf8(),
|
||||
catch_events[event].id());
|
||||
@ -771,8 +844,11 @@ void MainObject::engineData(int id)
|
||||
case RDRecording::MacroEvent:
|
||||
if(!RDCart::exists(catch_events[event].macroCart())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(0,RDDeck::Offline,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"macro aborted: no such cart: %u, id: %d",
|
||||
catch_events[event].macroCart(),
|
||||
catch_events[event].id());
|
||||
@ -788,8 +864,11 @@ void MainObject::engineData(int id)
|
||||
case RDRecording::Download:
|
||||
if(!RDCut::exists(catch_events[event].cutName())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(0,RDDeck::Offline,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"download aborted: no such cut: %s, id: %d",
|
||||
(const char *)catch_events[event].cutName().toUtf8(),
|
||||
catch_events[event].id());
|
||||
@ -832,8 +911,11 @@ void MainObject::engineData(int id)
|
||||
case RDRecording::Upload:
|
||||
if(!RDCut::exists(catch_events[event].cutName())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(0,RDDeck::Offline,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"upload aborted: no such cut: %s, id: %d",
|
||||
(const char *)catch_events[event].cutName().toUtf8(),
|
||||
catch_events[event].id());
|
||||
@ -904,9 +986,13 @@ void MainObject::recordLoadedData(int card,int stream)
|
||||
{
|
||||
int deck=GetRecordDeck(card,stream);
|
||||
catch_record_deck_status[deck-1]=RDDeck::Ready;
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1]).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_DEBUG,"Loaded - Card: %d Stream: %d\n",card,stream);
|
||||
}
|
||||
|
||||
@ -921,10 +1007,14 @@ void MainObject::recordingData(int card,int stream)
|
||||
if(event>=0) {
|
||||
cutname=catch_events[event].cutName();
|
||||
}
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1],cutname);
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d %s!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1],
|
||||
cutname.toUtf8().constData()).toUtf8());
|
||||
*/
|
||||
catch_record_status[deck-1]=true;
|
||||
if(debug) {
|
||||
printf("Recording - Card: %d Stream: %d, Id: %d\n",card,stream,
|
||||
@ -982,9 +1072,12 @@ void MainObject::recordUnloadedData(int card,int stream,unsigned msecs)
|
||||
(const char *)catch_record_name[deck-1].toUtf8());
|
||||
WriteExitCodeById(catch_record_id[deck-1],RDRecording::Ok);
|
||||
}
|
||||
SendEventResponse(deck,RDDeck::Idle,catch_record_id[deck-1],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,RDDeck::Idle,
|
||||
catch_record_id[deck-1]).toUtf8());
|
||||
*/
|
||||
catch_record_id[deck-1]=0;
|
||||
if(debug) {
|
||||
printf("Unloaded - Card: %d Stream: %d\n",card,stream);
|
||||
@ -1019,9 +1112,13 @@ void MainObject::playLoadedData(int handle)
|
||||
{
|
||||
int deck=GetPlayoutDeck(handle);
|
||||
catch_playout_deck_status[deck-129]=RDDeck::Ready;
|
||||
SendEventResponse(deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129]).toUtf8());
|
||||
*/
|
||||
if(debug) {
|
||||
printf("Play Loaded - Card: %d Stream: %d\n",
|
||||
catch_playout_card[deck-129],
|
||||
@ -1036,9 +1133,13 @@ void MainObject::playingData(int handle)
|
||||
catch_playout_deck_status[deck-129]=RDDeck::Recording;
|
||||
WriteExitCodeById(catch_playout_id[deck-129],
|
||||
RDRecording::PlayActive);
|
||||
SendEventResponse(deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129]).toUtf8());
|
||||
*/
|
||||
catch_playout_status[GetPlayoutDeck(handle)]=true;
|
||||
if(debug) {
|
||||
printf("Playing - Card: %d Stream: %d\n",
|
||||
@ -1075,9 +1176,13 @@ void MainObject::playUnloadedData(int handle)
|
||||
(const char *)catch_playout_name[deck-129].toUtf8());
|
||||
catch_playout_deck_status[deck-129]=RDDeck::Idle;
|
||||
WriteExitCodeById(catch_playout_id[deck-129],RDRecording::Ok);
|
||||
SendEventResponse(deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",deck,
|
||||
catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129]).toUtf8());
|
||||
*/
|
||||
if(debug) {
|
||||
printf("Play unloaded - Card: %d Stream: %d\n",
|
||||
catch_playout_card[deck-129],catch_playout_stream[deck-129]);
|
||||
@ -1133,9 +1238,12 @@ void MainObject::eventFinishedData(int id)
|
||||
return;
|
||||
}
|
||||
catch_events[event].setStatus(RDDeck::Idle);
|
||||
SendEventResponse(0,RDDeck::Idle,catch_macro_event_id[id],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",
|
||||
RDDeck::Idle,
|
||||
catch_macro_event_id[id]).toUtf8());
|
||||
*/
|
||||
if(catch_events[event].oneShot()) {
|
||||
PurgeEvent(event);
|
||||
}
|
||||
@ -1182,10 +1290,14 @@ void MainObject::updateXloadsData()
|
||||
case RDRecording::ServerError:
|
||||
case RDRecording::InternalError:
|
||||
it=catch_active_xloads.begin()+i;
|
||||
SendEventResponse(0,RDDeck::Idle,
|
||||
catch_events[catch_active_xloads[i]].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 %d %d!",RDDeck::Idle,
|
||||
catch_events[catch_active_xloads[i]].id()).
|
||||
toUtf8());
|
||||
*/
|
||||
catch_active_xloads.erase(it,it+1);
|
||||
break;
|
||||
|
||||
@ -1234,9 +1346,13 @@ bool MainObject::StartRecording(int event)
|
||||
if((catch_record_card[deck-1]<0)||
|
||||
(catch_record_stream[deck-1]<0)) {
|
||||
WriteExitCodeById(catch_events[event].id(),RDRecording::InternalError);
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"invalid audio device for deck: %d, event: %d",
|
||||
deck,catch_events[event].id());
|
||||
return false;
|
||||
@ -1248,9 +1364,13 @@ bool MainObject::StartRecording(int event)
|
||||
if((catch_record_deck_status[deck-1]!=RDDeck::Idle)&&
|
||||
(catch_record_deck_status[deck-1]!=RDDeck::Waiting)) {
|
||||
WriteExitCodeById(catch_events[event].id(),RDRecording::DeviceBusy);
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,
|
||||
"device busy for deck: %d, event: %d | in use by event: %d",
|
||||
deck,catch_events[event].id(),catch_record_id[deck-1]);
|
||||
@ -1505,9 +1625,12 @@ void MainObject::StartDownloadEvent(int event)
|
||||
if(!catch_xload_timer->isActive()) {
|
||||
catch_xload_timer->start(XLOAD_UPDATE_INTERVAL);
|
||||
}
|
||||
SendEventResponse(0,RDDeck::Recording,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",
|
||||
RDDeck::Recording,
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
StartBatch(catch_events[event].id());
|
||||
}
|
||||
|
||||
@ -1536,8 +1659,11 @@ bool MainObject::ExecuteMacroCart(RDCart *cart,int id,int event)
|
||||
catch_events[event].setStatus(RDDeck::Recording);
|
||||
}
|
||||
if(id!=-1) {
|
||||
SendEventResponse(0,RDDeck::Recording,id,"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Recording,id).
|
||||
toUtf8());
|
||||
*/
|
||||
}
|
||||
catch_macro_event_id[event_id]=id;
|
||||
catch_event_pool[event_id]=
|
||||
@ -1552,30 +1678,87 @@ bool MainObject::ExecuteMacroCart(RDCart *cart,int id,int event)
|
||||
}
|
||||
|
||||
|
||||
void MainObject::SendFullStatus(int ch)
|
||||
void MainObject::SendEventResponse(int chan,RDDeck::Status status,int id,
|
||||
const QString &cutname)
|
||||
{
|
||||
RDCatchEvent *evt=new RDCatchEvent();
|
||||
|
||||
evt->setOperation(RDCatchEvent::DeckStatusResponseOp);
|
||||
evt->setDeckChannel(chan);
|
||||
evt->setDeckStatus(status);
|
||||
evt->setEventId(id);
|
||||
if(!cutname.isEmpty()) {
|
||||
evt->setCartNumber(RDCut::cartNumber(cutname));
|
||||
evt->setCutNumber(RDCut::cutNumber(cutname));
|
||||
}
|
||||
rda->ripc()->sendCatchEvent(evt);
|
||||
|
||||
delete evt;
|
||||
}
|
||||
|
||||
|
||||
void MainObject::SendFullEventResponse(const QHostAddress &addr)
|
||||
{
|
||||
RDCatchEvent *evt=new RDCatchEvent();
|
||||
|
||||
//
|
||||
// Deck-less Events
|
||||
//
|
||||
evt->clear();
|
||||
evt->setOperation(RDCatchEvent::DeckStatusResponseOp);
|
||||
evt->setDeckChannel(0);
|
||||
for(unsigned i=0;i<catch_events.size();i++) {
|
||||
if(catch_events[i].status()!=RDDeck::Idle) {
|
||||
EchoCommand(ch,QString::asprintf("RE 0 %d %d!",
|
||||
catch_events[i].status(),
|
||||
catch_events[i].id()));
|
||||
evt->setDeckStatus(catch_events[i].status());
|
||||
evt->setEventId(catch_events[i].id());
|
||||
rda->ripc()->sendCatchEvent(evt);
|
||||
}
|
||||
}
|
||||
evt->setDeckStatus(RDDeck::Recording);
|
||||
for(unsigned i=0;i<catch_active_xloads.size();i++) {
|
||||
EchoCommand(ch,QString::asprintf("RE 0 %d %d",
|
||||
RDDeck::Recording,
|
||||
catch_events[catch_active_xloads[i]].
|
||||
id()));
|
||||
evt->setEventId(catch_events[catch_active_xloads[i]].id());
|
||||
rda->ripc()->sendCatchEvent(evt);
|
||||
}
|
||||
|
||||
//
|
||||
// Decks
|
||||
//
|
||||
evt->clear();
|
||||
evt->setOperation(RDCatchEvent::DeckStatusResponseOp);
|
||||
for(int i=0;i<MAX_DECKS;i++) {
|
||||
EchoCommand(ch,QString::asprintf("RE %d %d %d!",i+1,
|
||||
catch_record_deck_status[i],
|
||||
catch_record_id[i]));
|
||||
EchoCommand(ch,QString::asprintf("RE %d %d %d!",i+129,
|
||||
catch_playout_deck_status[i],
|
||||
catch_playout_id[i]));
|
||||
EchoCommand(ch,QString::asprintf("MN %u %d!",i+1,catch_monitor_state[i]));
|
||||
//
|
||||
// Record Decks
|
||||
//
|
||||
evt->setDeckChannel(i+1);
|
||||
evt->setDeckStatus(catch_record_deck_status[i]);
|
||||
evt->setEventId(catch_record_id[i]);
|
||||
if(catch_record_deck_status[i]==RDDeck::Recording) {
|
||||
evt->setCartNumber(RDCut::cartNumber(catch_record_name[i]));
|
||||
evt->setCutNumber(RDCut::cutNumber(catch_record_name[i]));
|
||||
}
|
||||
else {
|
||||
evt->setCartNumber(0);
|
||||
evt->setCutNumber(0);
|
||||
}
|
||||
rda->ripc()->sendCatchEvent(evt);
|
||||
|
||||
//
|
||||
// Play Decks
|
||||
//
|
||||
evt->setDeckChannel(i+129);
|
||||
evt->setDeckStatus(catch_playout_deck_status[i]);
|
||||
evt->setEventId(catch_playout_id[i]);
|
||||
if(catch_playout_deck_status[i]==RDDeck::Recording) {
|
||||
evt->setCartNumber(RDCut::cartNumber(catch_playout_name[i]));
|
||||
evt->setCutNumber(RDCut::cutNumber(catch_playout_name[i]));
|
||||
}
|
||||
else {
|
||||
evt->setCartNumber(0);
|
||||
evt->setCutNumber(0);
|
||||
}
|
||||
rda->ripc()->sendCatchEvent(evt);
|
||||
}
|
||||
delete evt;
|
||||
}
|
||||
|
||||
|
||||
@ -1685,6 +1868,7 @@ void MainObject::DispatchCommand(ServerConnection *conn)
|
||||
}
|
||||
|
||||
if((cmds.at(0)=="RE")&&(cmds.size()==2)) { // Request Status
|
||||
/*
|
||||
chan=cmds.at(1).toInt(&ok);
|
||||
if(!ok) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
@ -1720,6 +1904,7 @@ void MainObject::DispatchCommand(ServerConnection *conn)
|
||||
return;
|
||||
}
|
||||
EchoArgs(conn->id(),'-');
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1808,12 +1993,15 @@ void MainObject::DispatchCommand(ServerConnection *conn)
|
||||
return;
|
||||
}
|
||||
WriteExitCode(event,(RDRecording::ExitCode)code,str);
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Idle,id));
|
||||
SendEventResponse(0,RDDeck::Idle,id,"");
|
||||
// BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Idle,id));
|
||||
if((RDRecording::ExitCode)code==RDRecording::Ok) {
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Idle,id));
|
||||
SendEventResponse(0,RDDeck::Idle,id,"");
|
||||
// BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Idle,id));
|
||||
}
|
||||
else {
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Offline,id));
|
||||
SendEventResponse(0,RDDeck::Offline,id,"");
|
||||
// BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Offline,id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <rdcart.h>
|
||||
#include <rdcatch_conf.h>
|
||||
#include <rdcatch_connect.h>
|
||||
#include <rdcatchevent.h>
|
||||
#include <rdcmd_switch.h>
|
||||
#include <rddeck.h>
|
||||
#include <rdmacro_event.h>
|
||||
@ -113,6 +114,7 @@ class MainObject : public QObject
|
||||
void updateXloadsData();
|
||||
void startupCartData();
|
||||
void notificationReceivedData(RDNotification *notify);
|
||||
void catchEventReceivedData(RDCatchEvent *evt);
|
||||
|
||||
//
|
||||
// batch.cpp
|
||||
@ -145,7 +147,9 @@ class MainObject : public QObject
|
||||
void StartDownloadEvent(int event);
|
||||
void StartUploadEvent(int event);
|
||||
bool ExecuteMacroCart(RDCart *cart,int id=-1,int event=-1);
|
||||
void SendFullStatus(int ch);
|
||||
void SendEventResponse(int chan,RDDeck::Status status,int id,
|
||||
const QString &cutname);
|
||||
void SendFullEventResponse(const QHostAddress &addr);
|
||||
void SendMeterLevel(int deck,short levels[2]);
|
||||
void SendDeckEvent(int deck,int number);
|
||||
void ParseCommand(int);
|
||||
|
Loading…
x
Reference in New Issue
Block a user