diff --git a/ChangeLog b/ChangeLog index 60257baa..d0c22189 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16014,3 +16014,6 @@ 2017-09-01 Fred Gleason * Renamed 'Origin' field to 'Ingest' in the 'Cut Info/Record' dialog in RDLibrary. +2017-09-02 Fred Gleason + * Implemented a driver for the Broadcast Tools Universal 4.1 MLR>>Web + switcher. diff --git a/docs/SWITCHERS.txt b/docs/SWITCHERS.txt index 1ec90354..b76f2fd7 100644 --- a/docs/SWITCHERS.txt +++ b/docs/SWITCHERS.txt @@ -18,6 +18,7 @@ Broadcast Tools SS 4.2 Audio Switcher Broadcast Tools SS 4.4 Audio Switcher Broadcast Tools ACS 8.2 Audio Control Switcher Broadcast Tools SS 8.2 Audio Switcher +Broadcast Tools Universal 4.1MLR>>Web Harlond Virtual Mixer Kernel GPIO LiveWire LWRP Audio @@ -438,6 +439,20 @@ Tools documentation), then you will also need to be sure that DIP switch SW-14-10 is ON. +---------------------------------------------------------------------------- +BROADCAST TOOLS UNIVERSAL 4.1MLR>>WEB + +Driver Name: BroadcastTools 4.1 MLR>>Web + +Supported RML Commands: + GPI Enable ('GE') + GPI Set ('GI') + Switch Take ('ST') + +Control is by means of a TCP/IP connection to port 56. In 'Email/Network +Setup' on the web configuration page, both the 'TCP Enabled' and 'PIP Mode +Enabled' controls must be set to 'Enabled'. + ---------------------------------------------------------------------------- Harlond Virtual Mixer diff --git a/lib/rdmatrix.cpp b/lib/rdmatrix.cpp index 912071f8..61943747 100644 --- a/lib/rdmatrix.cpp +++ b/lib/rdmatrix.cpp @@ -70,7 +70,8 @@ bool __mx_primary_controls[RDMatrix::LastType][RDMatrix::LastControl]= {0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, // Modbus {0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, // Kernel GPIO {0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, // WheatNet SLIO - {0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0} // WheatNet LIO + {0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, // WheatNet LIO + {0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0} // BT Universale 4.1 MLR>>Web }; bool __mx_backup_controls[RDMatrix::LastType][RDMatrix::LastControl]= { @@ -117,7 +118,8 @@ bool __mx_backup_controls[RDMatrix::LastType][RDMatrix::LastControl]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // Modbus {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // Kernel GPIO {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // WheatNet SLIO - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} // WheatNet LIO + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // WheatNet LIO + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} // BT Universal 4.1 MLR>>Web }; int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]= @@ -165,7 +167,8 @@ int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]= {1,0,0,502,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // Modbus {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // Kernel GPIO {1,0,0,55776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // WheatNet SLIO - {1,0,0,55776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0} // WheatNet LIO + {1,0,0,55776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // WheatNet LIO + {1,0,0,56,0,0,0,0,0,0,0,4,1,5,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0} // BT Universal 4.1 MLR>>Web }; RDMatrix::RDMatrix(const QString &station,int matrix) @@ -745,6 +748,10 @@ QString RDMatrix::typeString(RDMatrix::Type type) return QString("WheatNet LIO"); break; + case RDMatrix::BtU41MlrWeb: + return QString("BroadcastTools 4.1 MLR>>Web"); + break; + default: return QString("Unknown Type"); break; diff --git a/lib/rdmatrix.h b/lib/rdmatrix.h index c16a408b..3641d2dd 100644 --- a/lib/rdmatrix.h +++ b/lib/rdmatrix.h @@ -39,7 +39,7 @@ class RDMatrix LiveWireLwrpGpio=29,BtSentinel4Web=30,BtGpi16=31,ModemLines=32, SoftwareAuthority=33,Sas16000=34,RossNkScp=35,BtAdms4422=36, BtSs41Mlr=37,Modbus=38,KernelGpio=39,WheatnetSlio=40, - WheatnetLio=41,LastType=42}; + WheatnetLio=41,BtU41MlrWeb=42,LastType=43}; enum Endpoint {Input=0,Output=1}; enum Mode {Stereo=0,Left=1,Right=2}; enum VguestAttribute {VguestEngine=0,VguestDevice=1,VguestSurface=2, diff --git a/ripcd/Makefile.am b/ripcd/Makefile.am index a4affe95..0353209d 100644 --- a/ripcd/Makefile.am +++ b/ripcd/Makefile.am @@ -49,6 +49,7 @@ dist_ripcd_SOURCES = acu1p.cpp acu1p.h\ btss82.cpp btss82.h\ btsrc16.cpp btsrc16.h\ btsrc8iii.cpp btsrc8iii.h\ + btu41mlrweb.cpp btu41mlrweb.h\ harlond.cpp harlond.h\ kernelgpio.cpp kernelgpio.h\ livewire_lwrpaudio.cpp livewire_lwrpaudio.h\ @@ -98,6 +99,7 @@ nodist_ripcd_SOURCES = moc_am16.cpp\ moc_btss42.cpp\ moc_btss44.cpp\ moc_btss82.cpp\ + moc_btu41mlrweb.cpp\ moc_harlond.cpp\ moc_kernelgpio.cpp\ moc_livewire_lwrpaudio.cpp\ diff --git a/ripcd/btu41mlrweb.cpp b/ripcd/btu41mlrweb.cpp new file mode 100644 index 00000000..2f6a5f19 --- /dev/null +++ b/ripcd/btu41mlrweb.cpp @@ -0,0 +1,201 @@ +// btu41mlrweb.cpp +// +// Rivendell switcher driver for the BroadcastTools Universal 4.1 MLR>>Web +// +// (C) Copyright 2017 Fred Gleason +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#include + +#include "btu41mlrweb.h" + +BtU41MlrWeb::BtU41MlrWeb(RDMatrix *matrix,QObject *parent) + : Switcher(matrix,parent) +{ + bt_watchdog_active=false; + + bt_ip_address=matrix->ipAddress(RDMatrix::Primary); + bt_ip_port=matrix->ipPort(RDMatrix::Primary); + + for(int i=0;iconnectToHost(bt_ip_address.toString(),bt_ip_port); + + bt_keepalive_timer=new QTimer(this); + connect(bt_keepalive_timer,SIGNAL(timeout()),this,SLOT(keepaliveData())); + + bt_watchdog_timer=new QTimer(this); + connect(bt_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogData())); +} + + +BtU41MlrWeb::~BtU41MlrWeb() +{ + delete bt_watchdog_timer; + delete bt_keepalive_timer; + delete bt_socket; +} + + +RDMatrix::Type BtU41MlrWeb::type() +{ + return RDMatrix::BtU41MlrWeb; +} + + +unsigned BtU41MlrWeb::gpiQuantity() +{ + return BTU41MLRWEB_GPI_QUAN; +} + + +unsigned BtU41MlrWeb::gpoQuantity() +{ + return BTU41MLRWEB_GPO_QUAN; +} + + +bool BtU41MlrWeb::primaryTtyActive() +{ + return false; +} + + +bool BtU41MlrWeb::secondaryTtyActive() +{ + return false; +} + + +void BtU41MlrWeb::processCommand(RDMacro *cmd) +{ + switch(cmd->command()) { + case RDMacro::ST: + if((cmd->arg(1).toInt()<0)||(cmd->arg(1).toInt()>BTU41MLRWEB_INPUT_QUAN)|| + (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>2)) { + cmd->acknowledge(false); + emit rmlEcho(cmd); + return; + } + if(cmd->arg(1).toInt()==0) { + SendCommand("*0MA"); + } + else { + SendCommand(QString().sprintf("*0%02d",cmd->arg(1).toInt())); + } + break; + + default: + break; + } +} + + +void BtU41MlrWeb::connectedData() +{ + syslog(LOG_INFO, + "connection to BroadcastTools device at %s:%u established", + (const char *)bt_ip_address.toString(),0xffff&bt_ip_port); + bt_watchdog_active=false; + SendCommand("*0SPA"); + bt_keepalive_timer->start(BTU41MLRWEB_KEEPALIVE_INTERVAL); + bt_watchdog_timer->start(BTU41MLRWEB_WATCHDOG_INTERVAL); +} + + +void BtU41MlrWeb::readyReadData() +{ + char data[1501]; + int n=0; + + while((n=bt_socket->readBlock(data,1500))>0) { + data[n]=0; + for(int i=0;istop(); + bt_watchdog_active=true; + } + bt_socket->close(); + bt_socket->connectToHost(bt_ip_address.toString(),bt_ip_port); +} + + +void BtU41MlrWeb::ProcessCommand(const QString &cmd) +{ + // syslog(LOG_NOTICE,"ProcessCommand(%s)\n",(const char *)cmd); + + QStringList cmds=cmds.split(",",cmd); + + if((cmds.size()==7)&&(cmds[0]=="S0P")) { + for(int i=0;istop(); + bt_watchdog_timer->start(BTU41MLRWEB_WATCHDOG_INTERVAL); + } +} + + +void BtU41MlrWeb::SendCommand(const QString &cmd) +{ + bt_socket->writeBlock(cmd,cmd.length()); +} diff --git a/ripcd/btu41mlrweb.h b/ripcd/btu41mlrweb.h new file mode 100644 index 00000000..8e464eb2 --- /dev/null +++ b/ripcd/btu41mlrweb.h @@ -0,0 +1,77 @@ +// btu41mlrweb.h +// +// Rivendell switcher driver for the BroadcastTools Universal 4.1 MLR>>Web +// +// (C) Copyright 2017 Fred Gleason +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#ifndef BTU41MLRWEB_H +#define BTU41MLRWEB_H + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#define BTU41MLRWEB_INPUT_QUAN 4 +#define BTU41MLRWEB_OUTPUT_QUAN 1 +#define BTU41MLRWEB_GPI_QUAN 5 +#define BTU41MLRWEB_GPO_QUAN 0 +#define BTU41MLRWEB_KEEPALIVE_INTERVAL 2000 +#define BTU41MLRWEB_WATCHDOG_INTERVAL 5000 + +class BtU41MlrWeb : public Switcher +{ + Q_OBJECT + public: + BtU41MlrWeb(RDMatrix *matrix,QObject *parent=0); + ~BtU41MlrWeb(); + RDMatrix::Type type(); + unsigned gpiQuantity(); + unsigned gpoQuantity(); + bool primaryTtyActive(); + bool secondaryTtyActive(); + void processCommand(RDMacro *cmd); + + private slots: + void connectedData(); + void readyReadData(); + void errorData(int err); + void keepaliveData(); + void watchdogData(); + + private: + void ProcessCommand(const QString &cmd); + void SendCommand(const QString &cmd); + QSocket *bt_socket; + QTimer *bt_watchdog_timer; + bool bt_watchdog_active; + QHostAddress bt_ip_address; + uint16_t bt_ip_port; + QString bt_accum; + bool bt_gpi_states[BTU41MLRWEB_GPI_QUAN]; + QTimer *bt_keepalive_timer; +}; + + +#endif // BTU41MLRWEB_H diff --git a/ripcd/loaddrivers.cpp b/ripcd/loaddrivers.cpp index 637d8105..084da9f2 100644 --- a/ripcd/loaddrivers.cpp +++ b/ripcd/loaddrivers.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -141,6 +142,10 @@ bool MainObject::LoadSwitchDriver(int matrix_num) ripcd_switcher[matrix_num]=new BtSs82(matrix,this); break; + case RDMatrix::BtU41MlrWeb: + ripcd_switcher[matrix_num]=new BtU41MlrWeb(matrix,this); + break; + case RDMatrix::Harlond: ripcd_switcher[matrix_num]=new Harlond(matrix,this); break;