2015-05-28 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDMatrix::RossNkScp' value to the 'RDMatrix::Type'
	enumeration in 'lib/rdmatrix.cpp' and 'lib/rdmatrix.h'.
	* Implemented a switcher driver for the Ross NK line of video
	switchers via the SCP/A serial interface in 'ripcd/rossnkscp.cpp'
	and 'riptcd/rossnkscp.h'.
This commit is contained in:
Fred Gleason
2015-05-29 07:13:05 -04:00
parent 16284179cc
commit 888711270d
8 changed files with 210 additions and 4 deletions

View File

@@ -60,6 +60,7 @@ dist_ripcd_SOURCES = acu1p.cpp acu1p.h\
ripcd.cpp ripcd.h globals.h\
ripcd_connection.cpp ripcd_connection.h\
ripcd_socket.cpp ripcd_socket.h\
rossnkscp.cpp rossnkscp.h\
sas32000.cpp sas32000.h\
sas64000.cpp sas64000.h\
sas64000gpi.cpp sas64000gpi.h\
@@ -99,6 +100,7 @@ nodist_ripcd_SOURCES = moc_am16.cpp\
moc_quartz1.cpp\
moc_ripcd.cpp\
moc_ripcd_socket.cpp\
moc_rossnkscp.cpp\
moc_sas32000.cpp\
moc_sas64000.cpp\
moc_sas64000gpi.cpp\

View File

@@ -49,6 +49,7 @@
#include <local_gpio.h>
#include <modemlines.h>
#include <quartz1.h>
#include <rossnkscp.h>
#include <sas16000.h>
#include <sas32000.h>
#include <sas64000.h>
@@ -164,6 +165,10 @@ bool MainObject::LoadSwitchDriver(int matrix_num)
ripcd_switcher[matrix_num]=new Quartz1(matrix,this);
break;
case RDMatrix::RossNkScp:
ripcd_switcher[matrix_num]=new RossNkScp(matrix,this);
break;
case RDMatrix::Sas16000:
ripcd_switcher[matrix_num]=new Sas16000(matrix,this);
break;

114
ripcd/rossnkscp.cpp Normal file
View File

@@ -0,0 +1,114 @@
// rossnkscp.cpp
//
// A Rivendell switcher driver for the Ross NK switchers via the SCP/A
//
// (C) Copyright 2002-2015 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 <stdlib.h>
#include <globals.h>
#include <rossnkscp.h>
RossNkScp::RossNkScp(RDMatrix *matrix,QObject *parent,const char *name)
: Switcher(matrix,parent,name)
{
//
// Get Matrix Parameters
//
ross_inputs=matrix->inputs();
ross_outputs=matrix->outputs();
ross_breakaway=matrix->card()+1;
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
ross_device=new RDTTYDevice();
if(tty->active()) {
ross_device->setName(tty->port());
ross_device->setSpeed(tty->baudRate());
ross_device->setWordLength(tty->dataBits());
ross_device->setParity(tty->parity());
ross_device->open(IO_Raw|IO_ReadWrite);
}
delete tty;
}
RossNkScp::~RossNkScp()
{
delete ross_device;
}
RDMatrix::Type RossNkScp::type()
{
return RDMatrix::RossNkScp;
}
unsigned RossNkScp::gpiQuantity()
{
return 0;
}
unsigned RossNkScp::gpoQuantity()
{
return 0;
}
bool RossNkScp::primaryTtyActive()
{
return true;
}
bool RossNkScp::secondaryTtyActive()
{
return false;
}
void RossNkScp::processCommand(RDMacro *cmd)
{
char str[11];
switch(cmd->command()) {
case RDMacro::ST:
if((cmd->arg(1).toInt()<=0)||(cmd->arg(1).toInt()>ross_inputs)||
(cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>ross_outputs)) {
cmd->acknowledge(false);
emit rmlEcho(cmd);
return;
}
sprintf(str,"X%03d,%03d,%d\x0d",cmd->arg(2).toInt()-1,
cmd->arg(1).toInt()-1,ross_breakaway);
syslog(LOG_WARNING,"sent: %s\n",str);
ross_device->writeBlock(str,11);
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
default:
cmd->acknowledge(false);
emit rmlEcho(cmd);
break;
}
}

55
ripcd/rossnkscp.h Normal file
View File

@@ -0,0 +1,55 @@
// rossnkscp.h
//
// A Rivendell switcher driver for the Ross NK switchers via the SCP/A
//
// (C) Copyright 2015 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 ROSSNKSCP_H
#define ROSSNKSCP_H
#include <rd.h>
#include <rdmatrix.h>
#include <rdmacro.h>
#include <rdtty.h>
#include <switcher.h>
#define ROSSNKSCP_MIN_GAIN -99
#define ROSSNKSCP_MAX_GAIN 28
class RossNkScp : public Switcher
{
Q_OBJECT
public:
RossNkScp(RDMatrix *matrix,QObject *parent=0,const char *name=0);
~RossNkScp();
RDMatrix::Type type();
unsigned gpiQuantity();
unsigned gpoQuantity();
bool primaryTtyActive();
bool secondaryTtyActive();
void processCommand(RDMacro *cmd);
private:
RDTTYDevice *ross_device;
int ross_inputs;
int ross_outputs;
int ross_breakaway;
};
#endif // ROSSNKSCP_H