From f9022eb4a7177152899a46156e59b73843c6a071 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 27 Feb 2015 15:51:09 -0500 Subject: [PATCH] 2015-02-27 Fred Gleason * Renamed the 'SAS User Serial Interface' driver to 'SAS USI (3 digit)'. * Added an 'SAS USI (2 digit)' swticher driver in 'ripcd/sasusi2digit.cpp' and 'ripcd/sasusi2digit.h'. --- ChangeLog | 2 + docs/SWITCHERS.txt | 20 +++++++ lib/rdmatrix.cpp | 19 ++++-- lib/rdmatrix.h | 2 +- ripcd/Makefile.am | 2 + ripcd/loaddrivers.cpp | 5 ++ ripcd/sasusi2digit.cpp | 132 +++++++++++++++++++++++++++++++++++++++++ ripcd/sasusi2digit.h | 65 ++++++++++++++++++++ ripcd/sasusi3digit.cpp | 2 +- 9 files changed, 241 insertions(+), 8 deletions(-) create mode 100644 ripcd/sasusi2digit.cpp create mode 100644 ripcd/sasusi2digit.h diff --git a/ChangeLog b/ChangeLog index 6069db0c..bc196109 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14800,3 +14800,5 @@ 2015-02-27 Fred Gleason * Renamed the 'SAS User Serial Interface' driver to 'SAS USI (3 digit)'. + * Added an 'SAS USI (2 digit)' swticher driver in + 'ripcd/sasusi2digit.cpp' and 'ripcd/sasusi2digit.h'. diff --git a/docs/SWITCHERS.txt b/docs/SWITCHERS.txt index ba7efebc..ad829406 100644 --- a/docs/SWITCHERS.txt +++ b/docs/SWITCHERS.txt @@ -25,6 +25,7 @@ Quartz Electronics Type 1 Routing Protocol Serial Port Modem Control Lines Sierra Automated Systems 32000 Audio Router Sierra Automated Systems 64000 Audio Router +Sierra Automated Systems User Serial Interface (USI) (2 digit) Sierra Automated Systems User Serial Interface (USI) (3 digit) Sine Systems ACU-1 (Prophet version) Software Authority Protocol @@ -590,6 +591,25 @@ and no terminator. This driver allows control of the system's GPO outputs as well as audio crosspoints. +---------------------------------------------------------------------------- +SIERRA AUTOMATED SYSTEMS User Serial Interface (USI) (2 digit) + +Driver Name: SAS USI (2 digit) + +Supported RML Commands: + Switch Take ('ST') + +GENERAL NOTES: +Control can done by means of an RS-232C connection to the 'User Serial +Interface' port on the unit. Serial port parameters should be: + +Baud Rate: 9600 +Parity: None +Data Bits: 8 +Stop Bits: 1 +Terminator: None + + ---------------------------------------------------------------------------- SIERRA AUTOMATED SYSTEMS User Serial Interface (USI) (3 digit) diff --git a/lib/rdmatrix.cpp b/lib/rdmatrix.cpp index ab11d2db..4e33105c 100644 --- a/lib/rdmatrix.cpp +++ b/lib/rdmatrix.cpp @@ -43,7 +43,7 @@ bool __mx_primary_controls[RDMatrix::LastType][RDMatrix::LastControl]= {0,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,0,0}, // BT 16x1 {0,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,0,0}, // BT 8x2 {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 ACS 8.2 - {1,1,1,1,0,0,1,1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0}, // SAS USI + {1,1,1,1,0,0,1,1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0}, // SAS USI 3 {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 16x2 {0,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,0,0}, // BT SS 12.4 {0,0,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}, // Local Adapter @@ -64,7 +64,8 @@ bool __mx_primary_controls[RDMatrix::LastType][RDMatrix::LastControl]= {0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0}, // BT Sentinel 4 Web {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}, // BT GPI-16 {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,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 USI 2 }; bool __mx_backup_controls[RDMatrix::LastType][RDMatrix::LastControl]= { @@ -82,7 +83,7 @@ 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}, // BT 16x1 {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 8x2 {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 ACS 8.2 - {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 USI + {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 USI 3 {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 16x2 {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 SS 12.4 {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}, // Local Adapter @@ -103,7 +104,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}, // BT Sentinel 4 Web {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 GPI-16 {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}, // 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 USI 2 }; int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]= @@ -122,7 +124,7 @@ int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]= {0,0,0,0,0,0,0,0,0,0,0,16,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT 16x1 {0,0,0,0,0,0,0,0,0,0,0,8,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT 8x2 {0,0,0,0,0,0,0,0,0,0,0,8,2,16,16,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT ACS 8.2 - {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}, // SAS USI + {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}, // SAS USI 3 {0,0,0,0,0,0,0,0,0,0,0,16,2,16,16,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT 16x2 {0,0,0,0,0,0,0,0,0,0,0,12,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT SS 12.4 {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}, // Local Adapter @@ -143,7 +145,8 @@ int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]= {1,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT Sentinel 4 Web {0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, // BT GPI-16 {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 + {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 USI 2 }; RDMatrix::RDMatrix(const QString &station,int matrix) @@ -603,6 +606,10 @@ QString RDMatrix::typeString(RDMatrix::Type type) return QString("BroadcastTools ACS 8.2"); break; + case RDMatrix::SasUsi2Digit: + return QString("SAS USI (2 digit)"); + break; + case RDMatrix::SasUsi3Digit: return QString("SAS USI (3 digit)"); break; diff --git a/lib/rdmatrix.h b/lib/rdmatrix.h index 7219dfe9..d77c0306 100644 --- a/lib/rdmatrix.h +++ b/lib/rdmatrix.h @@ -38,7 +38,7 @@ 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,LastType=34}; + SoftwareAuthority=33,SasUsi2Digit=34,LastType=35}; 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 ee2d1619..c551c52a 100644 --- a/ripcd/Makefile.am +++ b/ripcd/Makefile.am @@ -63,6 +63,7 @@ dist_ripcd_SOURCES = acu1p.cpp acu1p.h\ sas32000.cpp sas32000.h\ sas64000.cpp sas64000.h\ sas64000gpi.cpp sas64000gpi.h\ + sasusi2digit.cpp sasusi2digit.h\ sasusi3digit.cpp sasusi3digit.h\ starguide3.cpp starguide3.h\ starguide_feed.cpp starguide_feed.h\ @@ -101,6 +102,7 @@ nodist_ripcd_SOURCES = moc_am16.cpp\ moc_sas32000.cpp\ moc_sas64000.cpp\ moc_sas64000gpi.cpp\ + moc_sasusi2digit.cpp\ moc_sasusi3digit.cpp\ moc_starguide3.cpp\ moc_swauthority.cpp\ diff --git a/ripcd/loaddrivers.cpp b/ripcd/loaddrivers.cpp index 6d60ba53..3b9b635e 100644 --- a/ripcd/loaddrivers.cpp +++ b/ripcd/loaddrivers.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,10 @@ bool MainObject::LoadSwitchDriver(int matrix_num) ripcd_switcher[matrix_num]=new Sas64000Gpi(matrix,this); break; + case RDMatrix::SasUsi2Digit: + ripcd_switcher[matrix_num]=new SasUsi2Digit(matrix,this); + break; + case RDMatrix::SasUsi3Digit: ripcd_switcher[matrix_num]=new SasUsi3Digit(matrix,this); break; diff --git a/ripcd/sasusi2digit.cpp b/ripcd/sasusi2digit.cpp new file mode 100644 index 00000000..0289abe5 --- /dev/null +++ b/ripcd/sasusi2digit.cpp @@ -0,0 +1,132 @@ +// sasusi2digit.cpp +// +// A Rivendell switcher driver for the SAS USI Protocol (2 digit) +// +// (C) Copyright 2002-2015 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 +#include +#include + +SasUsi2Digit::SasUsi2Digit(RDMatrix *matrix,QObject *parent,const char *name) + : Switcher(matrix,parent,name) +{ + RDTty *tty; + sas_matrix=matrix->matrix(); + sas_ptr=0; + + // + // Get Matrix Parameters + // + sas_inputs=matrix->inputs(); + sas_outputs=matrix->outputs(); + sas_gpis=matrix->gpis(); + sas_gpos=matrix->gpos(); + + // + // Initialize the connection + // + tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary)); + sas_device=new RDTTYDevice(); + if(tty->active()) { + sas_device->setName(tty->port()); + sas_device->setSpeed(tty->baudRate()); + sas_device->setWordLength(tty->dataBits()); + sas_device->setParity(tty->parity()); + sas_device->open(IO_Raw|IO_ReadWrite); + } + delete tty; +} + + +RDMatrix::Type SasUsi2Digit::type() +{ + return RDMatrix::SasUsi2Digit; +} + + +unsigned SasUsi2Digit::gpiQuantity() +{ + return sas_gpis; +} + + +unsigned SasUsi2Digit::gpoQuantity() +{ + return sas_gpos; +} + + +bool SasUsi2Digit::primaryTtyActive() +{ + return true; +} + + +bool SasUsi2Digit::secondaryTtyActive() +{ + return false; +} + + +void SasUsi2Digit::processCommand(RDMacro *cmd) +{ + char str[256]; + + switch(cmd->command()) { + case RDMacro::ST: + if((cmd->arg(1).toInt()<0)||(cmd->arg(1).toInt()>sas_inputs)|| + (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>sas_outputs)) { + cmd->acknowledge(false); + emit rmlEcho(cmd); + return; + } + snprintf(str,256,"%c%02d%02d\x0D\x0A",20, + cmd->arg(1).toInt(),cmd->arg(2).toInt()); + SendCommand(str); + cmd->acknowledge(true); + emit rmlEcho(cmd); + break; + + default: + cmd->acknowledge(false); + emit rmlEcho(cmd); + break; + } +} + + +void SasUsi2Digit::SendCommand(char *str) +{ + LogLine(RDConfig::LogDebug,QString().sprintf("sending USI cmd: %s",(const char *)PrettifyCommand(str))); + + sas_device->writeBlock(str,strlen(str)); +} + + +QString SasUsi2Digit::PrettifyCommand(const char *cmd) const +{ + QString ret; + if(cmd[0]<26) { + ret=QString().sprintf("^%c%s",'@'+cmd[0],cmd+1); + } + else { + ret=cmd; + } + return ret; +} diff --git a/ripcd/sasusi2digit.h b/ripcd/sasusi2digit.h new file mode 100644 index 00000000..fc9cc879 --- /dev/null +++ b/ripcd/sasusi2digit.h @@ -0,0 +1,65 @@ +// sasusi2digit.h +// +// A Rivendell switcher driver for the SAS USI Protocol (2 digit) +// +// (C) Copyright 2002-2015 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 SASUSI2DIGIT_H +#define SASUSI2DIGIT_H + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#define SASUSI2DIGIT_MAX_LENGTH 256 + +class SasUsi2Digit : public Switcher +{ + Q_OBJECT + public: + SasUsi2Digit(RDMatrix *matrix,QObject *parent=0,const char *name=0); + RDMatrix::Type type(); + unsigned gpiQuantity(); + unsigned gpoQuantity(); + bool primaryTtyActive(); + bool secondaryTtyActive(); + void processCommand(RDMacro *cmd); + + private: + void SendCommand(char *str); + QString PrettifyCommand(const char *cmd) const; + RDTTYDevice *sas_device; + char sas_buffer[SASUSI2DIGIT_MAX_LENGTH]; + unsigned sas_ptr; + int sas_matrix; + int sas_ipport; + int sas_inputs; + int sas_outputs; + int sas_gpis; + int sas_gpos; +}; + + +#endif // SASUSI2DIGIT_H diff --git a/ripcd/sasusi3digit.cpp b/ripcd/sasusi3digit.cpp index b9f7aa30..f8bd9103 100644 --- a/ripcd/sasusi3digit.cpp +++ b/ripcd/sasusi3digit.cpp @@ -1,4 +1,4 @@ -// sasusi.cpp +// sasusi3digit.cpp // // A Rivendell switcher driver for the SAS USI Protocol (3 digit) //