1
0
mirror of https://github.com/ElvishArtisan/rivendell.git synced 2025-04-24 17:37:53 +02:00

2016-03-20 Fred Gleason <fredg@paravelsystems.com>

* Added a switcher driver for the Broadcast Tools ADMS 44.22.
This commit is contained in:
Fred Gleason 2016-03-20 19:43:38 -04:00
parent b37339970d
commit 422dff4a15
8 changed files with 584 additions and 4 deletions

@ -14965,3 +14965,5 @@
2015-09-18 Fred Gleason <fredg@paravelsystems.com>
* Updated 'NEWS'.
* Updated the package version to 2.11.0.
2016-03-20 Fred Gleason <fredg@paravelsystems.com>
* Added a switcher driver for the Broadcast Tools ADMS 44.22.

@ -7,6 +7,7 @@ Broadcast Tools 10x1 Audio Switcher
Broadcast Tools 16x1 Audio Switcher
Broadcast Tools 16x2 Audio Switcher
Broadcast Tools 8x2 Audio Switcher
Broadcast Tools ADMS 44.22 Analog/AES Digital Matrix Switcher
Broadcast Tools GPI-16 General Purpose Input Module
Broadcast Tools Sentinel 4 Web AES Switcher
Broadcast Tools SS 12.4 Audio Switcher
@ -131,6 +132,40 @@ Operation in 'multidrop' mode is not supported.
----------------------------------------------------------------------------
BROADCAST TOOLS ADMS 44.22 Analog/AES Digital Matrix Switcher
Driver Name: BoradcastTools ADMS 44.22
Supported RML Commands:
GPI Enable ('GE')
GPI Set ('GI')
GPO Set ('GO')
Switch Take ('ST')
Switch Add ('SA')
Switch Level ('SL')
Switch Remove ('SR')
GENERAL NOTES:
Control is done by means of a serial connection to the unit's integrated
serial port. The 'OPTIONS' switches on the back of the unit should be set
as follows:
1: OFF (UP)
2: OFF (UP)
3: OFF (UP)
4: OFF (UP)
5: OFF (UP)
6: OFF (UP)
7: ON (DOWN)
8: ON (DOWN)
9: OFF (UP)
10: OFF (UP)
The Rivendell serial interface should be set to use 9600 bits/sec, 8 bits,
1 stop bit and no flow control.
---------------------------------------------------------------------------
BROADCAST TOOLS GPI-16 General Purpose Input Module
Driver Name: BroadcastTools GPI-16

@ -66,7 +66,8 @@ bool __mx_primary_controls[RDMatrix::LastType][RDMatrix::LastControl]=
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, // Modem Lines
{0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0}, // Software Authority
{0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0}, // SAS 16000
{0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0} // Ross NK/SCP
{0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0}, // Ross NK/SCP
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0} // BT ADMS 44.22
};
bool __mx_backup_controls[RDMatrix::LastType][RDMatrix::LastControl]=
{
@ -107,7 +108,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}, // Modem Lines
{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}, // Software Authority
{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}, // SAS 16000
{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} // ROSS NK/SCP
{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}, // ROSS NK/SCP
{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 ADMS 44.22
};
int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]=
@ -149,7 +151,8 @@ int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]=
{0,0,0,0,0,0,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // Modem Lines
{1,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}, // Software Authority
{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}, // SAS 16000
{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} // Ross NK/SCP
{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}, // Ross NK/SCP
{0,0,0,0,0,0,0,0,0,0,0,8,2,16,13,0,0,0,0,0,0,0,0,0,0,0,0,1,0} // BT ADMS 44.22
};
RDMatrix::RDMatrix(const QString &station,int matrix)
@ -705,6 +708,10 @@ QString RDMatrix::typeString(RDMatrix::Type type)
return QString("Ross NK-SCP/A Interface");
break;
case RDMatrix::BtAdms4422:
return QString("BroadcastTools ADMS 44.22");
break;
default:
return QString("Unknown Type");
break;

@ -38,7 +38,8 @@ class RDMatrix
BtSs42=19,LiveWireLwrpAudio=20,Quartz1=21,BtSs44=22,BtSrc8III=23,
BtSrc16=24,Harlond=25,Acu1p=26,LiveWireMcastGpio=27,Am16=28,
LiveWireLwrpGpio=29,BtSentinel4Web=30,BtGpi16=31,ModemLines=32,
SoftwareAuthority=33,Sas16000=34,RossNkScp=35,LastType=36};
SoftwareAuthority=33,Sas16000=34,RossNkScp=35,BtAdms4422=36,
LastType=37};
enum Endpoint {Input=0,Output=1};
enum Mode {Stereo=0,Left=1,Right=2};
enum VguestAttribute {VguestEngine=0,VguestDevice=1,VguestSurface=2,

@ -38,6 +38,7 @@ dist_ripcd_SOURCES = acu1p.cpp acu1p.h\
bt16x2.cpp bt16x2.h\
bt8x2.cpp bt8x2.h\
btacs82.cpp btacs82.h\
btadms4422.cpp btadms4422.h\
btgpi16.cpp btgpi16.h\
btsentinel4web.cpp btsentinel4web.h\
btss124.cpp btss124.h\
@ -81,6 +82,7 @@ nodist_ripcd_SOURCES = moc_am16.cpp\
moc_bt16x2.cpp\
moc_bt8x2.cpp\
moc_btacs82.cpp\
moc_btadms4422.cpp\
moc_btgpi16.cpp\
moc_btsentinel4web.cpp\
moc_btsrc16.cpp\

458
ripcd/btadms4422.cpp Normal file

@ -0,0 +1,458 @@
// btadms4422.cpp
//
// A Rivendell switcher driver for the BroadcastTools ADMS 44.22
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
//
// 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 <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btadms4422.h>
BtAdms4422::BtAdms4422(RDMatrix *matrix,QObject *parent,const char *name)
: Switcher(matrix,parent,name)
{
//
// Initialize Data Structures
//
bt_istate=0;
for(int i=0;i<BTADMS4422_GPI_PINS;i++) {
bt_gpi_state[i]=false;
bt_gpi_mask[i]=false;
}
//
// Get Matrix Parameters
//
bt_matrix=matrix->matrix();
bt_inputs=matrix->inputs();
bt_outputs=matrix->outputs();
bt_gpis=matrix->gpis();
bt_gpos=matrix->gpos();
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());
bt_device->setSpeed(tty->baudRate());
bt_device->setWordLength(tty->dataBits());
bt_device->setParity(tty->parity());
if(bt_device->open(IO_Raw|IO_ReadWrite)) {
// Set Mix Mode
bt_device->
writeBlock(QString().sprintf("*%uUM0\r\n",BTADMS4422_UNIT_ID),7);
}
else {
ripcd_config->log("ripcd",RDConfig::LogWarning,
"failed to open port \""+tty->port()+"\"");
}
}
delete tty;
//
// Interval OneShots
//
bt_gpi_oneshot=new RDOneShot(this);
connect(bt_gpi_oneshot,SIGNAL(timeout(void *)),
this,SLOT(gpiOneshotData(int)));
bt_gpo_oneshot=new RDOneShot(this);
connect(bt_gpo_oneshot,SIGNAL(timeout(void *)),
this,SLOT(gpoOneshotData(int)));
//
// The Poll Timer
//
QTimer *timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(processStatus()));
timer->start(BTADMS4422_POLL_INTERVAL);
}
BtAdms4422::~BtAdms4422()
{
delete bt_device;
delete bt_gpi_oneshot;
delete bt_gpo_oneshot;
}
RDMatrix::Type BtAdms4422::type()
{
return RDMatrix::BtAdms4422;
}
unsigned BtAdms4422::gpiQuantity()
{
return bt_gpis;
}
unsigned BtAdms4422::gpoQuantity()
{
return bt_gpos;
}
bool BtAdms4422::primaryTtyActive()
{
return true;
}
bool BtAdms4422::secondaryTtyActive()
{
return false;
}
void BtAdms4422::processCommand(RDMacro *cmd)
{
char str[256];
switch(cmd->command()) {
case RDMacro::GO:
if((cmd->argQuantity()!=5)||
((cmd->arg(1).toString().lower()!="i")&&
(cmd->arg(1).toString().lower()!="o"))||
(cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)||
(cmd->arg(2).toInt()>bt_gpos)||
((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&&
(cmd->arg(1).toString().lower()!="i"))||
((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&&
(cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toString().lower()=="i"))||
(cmd->arg(4).toInt()<0)) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
return;
}
if(cmd->arg(3).toInt()==0) { // Turn OFF
if(cmd->arg(4).toInt()==0) {
if(cmd->arg(1).toString().lower()=="i") {
if(bt_gpi_state[cmd->arg(2).toInt()-1]) {
emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false);
bt_gpi_state[cmd->arg(2).toInt()-1]=false;
}
bt_gpi_mask[cmd->arg(2).toInt()-1]=true;
}
if(cmd->arg(1).toString().lower()=="o") {
if(cmd->arg(2).toInt()<=4) {
sprintf(str,"*%dOR%dF\r\n",BTADMS4422_UNIT_ID,
cmd->arg(2).toInt());
bt_device->writeBlock(str,8);
}
else {
sprintf(str,"*%dOO%dF\r\n",BTADMS4422_UNIT_ID,
cmd->arg(2).toInt()-4);
bt_device->writeBlock(str,9);
}
emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false);
}
}
else {
if(cmd->echoRequested()) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
}
return;
}
}
else {
if(cmd->arg(3).toInt()==-1) { // Clear input
bt_gpi_mask[cmd->arg(2).toInt()-1]=false;
bt_device->writeBlock("*0SPA",5);
}
else {
if(cmd->arg(4).toInt()==0) { // Turn ON
if(cmd->arg(1).toString().lower()=="i") {
if(!bt_gpi_state[cmd->arg(2).toInt()-1]) {
emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true);
bt_gpi_state[cmd->arg(2).toInt()-1]=true;
}
bt_gpi_mask[cmd->arg(2).toInt()-1]=true;
}
if(cmd->arg(1).toString().lower()=="o") {
if(cmd->arg(2).toInt()<=4) {
sprintf(str,"*%dOR%dL\r\n",BTADMS4422_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,8);
}
else {
sprintf(str,"*%dOO%dL\r\n",BTADMS4422_UNIT_ID,
cmd->arg(2).toInt()-4);
bt_device->writeBlock(str,9);
}
emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true);
}
}
else { // Pulse
if(cmd->arg(1).toString().lower()=="i") {
if(!bt_gpi_state[cmd->arg(2).toInt()-1]) {
emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true);
bt_gpi_state[cmd->arg(2).toInt()-1]=true;
}
bt_gpi_mask[cmd->arg(2).toInt()-1]=true;
bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500);
}
if(cmd->arg(1).toString().lower()=="o") {
if(cmd->arg(2).toInt()<=4) {
sprintf(str,"*%dOR%dP\r\n",BTADMS4422_UNIT_ID,
cmd->arg(2).toInt());
bt_device->writeBlock(str,8);
}
else {
sprintf(str,"*%dOO%dP\r\n",BTADMS4422_UNIT_ID,
cmd->arg(2).toInt()-4);
bt_device->writeBlock(str,8);
}
emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true);
bt_gpo_oneshot->start(cmd->arg(2).toInt()-1,500);
}
}
}
}
if(cmd->echoRequested()) {
cmd->acknowledge(true);
emit rmlEcho(cmd);
}
break;
case RDMacro::SA:
if((cmd->arg(1).toInt()<1)||(cmd->arg(1).toInt()>bt_inputs)||
(cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>2)) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
return;
}
sprintf(str,"*%d%02d%d\r\n",BTADMS4422_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,7);
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
case RDMacro::SR:
if((cmd->arg(1).toInt()<1)||(cmd->arg(1).toInt()>bt_inputs)||
(cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>2)) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
return;
}
sprintf(str,"*%d%02dMA%d\r\n",BTADMS4422_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,8);
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
case RDMacro::ST:
if((cmd->arg(1).toInt()<0)||(cmd->arg(1).toInt()>bt_inputs)||
(cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>2)) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
return;
}
if(cmd->arg(1).toInt()==0) {
sprintf(str,"*%dM%d\r\n",BTADMS4422_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,6);
}
else {
sprintf(str,"*%d%02d%d\r\n",BTADMS4422_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,7);
for(int i=1;i<cmd->arg(1).toInt();i++) {
sprintf(str,"*%d%02dMA%d\r\n",BTADMS4422_UNIT_ID,
i,cmd->arg(2).toInt());
bt_device->writeBlock(str,9);
}
for(int i=cmd->arg(1).toInt()+1;i<9;i++) {
sprintf(str,"*%d%02dMA%d\r\n",BTADMS4422_UNIT_ID,
i,cmd->arg(2).toInt());
bt_device->writeBlock(str,9);
}
}
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
case RDMacro::SL:
if((cmd->arg(1).toInt()<=0)||(cmd->arg(1).toInt()>bt_inputs)||
(cmd->arg(2).toInt()>0)) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
return;
}
if(cmd->arg(2).toInt()==0) {
sprintf(str,"*%dDME%d00\r\n",BTADMS4422_UNIT_ID,
cmd->arg(1).toInt());
bt_device->writeBlock(str,10);
}
else {
sprintf(str,"*%dDML%d%d.0\r\n",BTADMS4422_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,13);
sprintf(str,"*%dDME%d01\r\n",BTADMS4422_UNIT_ID,
cmd->arg(1).toInt());
bt_device->writeBlock(str,10);
}
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
default:
cmd->acknowledge(false);
emit rmlEcho(cmd);
break;
}
}
void BtAdms4422::processStatus()
{
char buffer[256];
int n;
int gpi;
while((n=bt_device->readBlock(buffer,255))>0) {
for(int i=0;i<n;i++) {
switch(bt_istate) {
case 0:
if(buffer[i]=='S') {
bt_istate=1;
}
break;
case 1:
if(buffer[i]==(BTADMS4422_UNIT_ID+'0')) {
bt_istate=2;
}
else {
bt_istate=0;
}
break;
case 2:
if(buffer[i]=='P') {
bt_istate=3;
}
else {
bt_istate=0;
}
break;
case 3:
if(buffer[i]==',') {
bt_istate=4;
}
else {
bt_istate=0;
}
break;
case 4:
if(buffer[i]=='A') {
bt_istate=5;
}
else {
bt_istate=0;
}
break;
case 5:
case 7:
case 9:
case 11:
case 13:
case 15:
case 17:
case 19:
case 21:
case 23:
case 25:
case 27:
case 29:
case 31:
case 33:
case 35:
if(buffer[i]==',') {
bt_istate++;
}
else {
bt_istate=0;
}
break;
case 6:
case 8:
case 10:
case 12:
case 14:
case 16:
case 18:
case 20:
case 22:
case 24:
case 26:
case 28:
case 30:
case 32:
case 34:
case 36:
if(buffer[i]=='0') {
gpi=(bt_istate-6)/2;
if(bt_gpi_state[gpi]&&(!bt_gpi_mask[gpi])) {
emit gpiChanged(bt_matrix,gpi,false);
bt_gpi_state[gpi]=false;
}
bt_istate++;
}
if(buffer[i]=='1') {
gpi=(bt_istate-6)/2;
if((!bt_gpi_state[gpi])&&(!bt_gpi_mask[gpi])) {
emit gpiChanged(bt_matrix,gpi,true);
bt_gpi_state[gpi]=true;
}
bt_istate++;
}
break;
default:
bt_istate=0;
}
}
}
}
void BtAdms4422::gpiOneshotData(int value)
{
bt_gpi_mask[value]=false;
bt_device->writeBlock("*0SPA",5);
}
void BtAdms4422::gpoOneshotData(int value)
{
emit gpoChanged(bt_matrix,value,false);
}

70
ripcd/btadms4422.h Normal file

@ -0,0 +1,70 @@
// btadms4422.h
//
// A Rivendell switcher driver for the BroadcastTools ADMS 44.22
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
//
// 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 BTADMS4422_H
#define BTADMS4422_H
#include <rd.h>
#include <rdmatrix.h>
#include <rdmacro.h>
#include <rdtty.h>
#include <rdoneshot.h>
#include <switcher.h>
#define BTADMS4422_UNIT_ID 0
#define BTADMS4422_POLL_INTERVAL 100
#define BTADMS4422_GPI_PINS 16
class BtAdms4422 : public Switcher
{
Q_OBJECT
public:
BtAdms4422(RDMatrix *matrix,QObject *parent=0,const char *name=0);
~BtAdms4422();
RDMatrix::Type type();
unsigned gpiQuantity();
unsigned gpoQuantity();
bool primaryTtyActive();
bool secondaryTtyActive();
void processCommand(RDMacro *cmd);
private slots:
void processStatus();
void gpiOneshotData(int value);
void gpoOneshotData(int value);
private:
RDTTYDevice *bt_device;
RDOneShot *bt_gpi_oneshot;
RDOneShot *bt_gpo_oneshot;
int bt_matrix;
int bt_inputs;
int bt_outputs;
int bt_gpis;
int bt_gpos;
int bt_istate;
bool bt_gpi_state[BTADMS4422_GPI_PINS];
bool bt_gpi_mask[BTADMS4422_GPI_PINS];
};
#endif // BTADMS4422_H

@ -32,6 +32,7 @@
#include <bt16x2.h>
#include <bt8x2.h>
#include <btacs82.h>
#include <btadms4422.h>
#include <btgpi16.h>
#include <btsentinel4web.h>
#include <btsrc16.h>
@ -93,6 +94,10 @@ bool MainObject::LoadSwitchDriver(int matrix_num)
ripcd_switcher[matrix_num]=new BtAcs82(matrix,this);
break;
case RDMatrix::BtAdms4422:
ripcd_switcher[matrix_num]=new BtAdms4422(matrix,this);
break;
case RDMatrix::BtGpi16:
ripcd_switcher[matrix_num]=new BtGpi16(matrix,this);
break;