2018-03-11 Fred Gleason <fredg@paravelsystems.com>

* Converted ripcd(8) to use RDApplication.
	* Documented a 'Notification' message type in
	'docs/apis/notification.xml'.
	* Added an 'RDMulticaster' class.
	* Added an 'mcast_recv_test' program in 'tests/'.
	* Added a 'SYSTEM.NOTIFICATION_ADDRESS' field to the database.
	* Incremented the database version to 276.
	* Added an 'Mcast Address for Notifications' control to the
	'System-Wide Settings' dialog in rdadmin(1).
	* Implemented the 'Process Notification' ['ON'] command in
	ripcd(8).
	* Added an 'RDRipc::sendNotification()' method.
	* Added an 'RDRipc::notificationReceived()' signal.
This commit is contained in:
Fred Gleason 2018-03-11 20:24:39 -04:00
parent 7835be386e
commit 7ce4b2ff10
71 changed files with 1302 additions and 368 deletions

1
.gitignore vendored
View File

@ -89,6 +89,7 @@ tests/audio_import_test
tests/audio_peaks_test
tests/datedecode_test
tests/log_unlink_test
tests/mcast_recv_test
tests/rdxml_parse_test
tests/reserve_carts_test
tests/sas_switch_torture

View File

@ -16709,3 +16709,17 @@
* Refactored the RDSoundPanel class to use RDApplication.
2018-02-24 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDUpload class to use RDApplication.
2018-03-11 Fred Gleason <fredg@paravelsystems.com>
* Converted ripcd(8) to use RDApplication.
* Documented a 'Notification' message type in
'docs/apis/notification.xml'.
* Added an 'RDMulticaster' class.
* Added an 'mcast_recv_test' program in 'tests/'.
* Added a 'SYSTEM.NOTIFICATION_ADDRESS' field to the database.
* Incremented the database version to 276.
* Added an 'Mcast Address for Notifications' control to the
'System-Wide Settings' dialog in rdadmin(1).
* Implemented the 'Process Notification' ['ON'] command in
ripcd(8).
* Added an 'RDRipc::sendNotification()' method.
* Added an 'RDRipc::notificationReceived()' signal.

View File

@ -35,6 +35,8 @@ all-local: cae.html\
cae.pdf\
catchd.html\
catchd.pdf\
notification.html\
notification.pdf\
ripc.html\
ripc.pdf\
web_api.html\
@ -46,6 +48,9 @@ EXTRA_DIST = cae.html\
catchd.html\
catchd.pdf\
catchd.xml\
notifcation.html\
notifcation.pdf\
notifcation.xml\
ripc.html\
ripc.pdf\
ripc.xml\

133
docs/apis/notification.xml Normal file
View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<info>
<title>Rivendell Notification Protocol</title>
<author>
<personname>
<firstname>Fred</firstname>
<surname>Gleason</surname>
<email>fredg@paravelsystems.com</email>
</personname>
</author>
</info>
<sect1 xml:id="overview">
<title>Overview</title>
<para>
This defines the IP protocol used to notify Rivendell components of
changes to the state of database objects. Messages are send by means
of multicast UDP packets to port 20539.
</para>
<para>
The format of a message is as follows:
</para>
<para>
NOTIFY <replaceable choice='req'>obj-type</replaceable>
<replaceable choice='req'>action</replaceable>
<replaceable choice='req'>id</replaceable>
[<replaceable choice='opt'>args</replaceable>]
</para>
<variablelist>
<varlistentry>
<term>
<replaceable>obj-type</replaceable>
</term>
<listitem>
<para>
The object type to which the message pertains.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable>action</replaceable>
</term>
<listitem>
<para>
The action being reported. The following actions are defined:
</para>
<variablelist>
<varlistentry>
<term>
ADD
</term>
<listitem>
<para>
The referenced object has just been added to the database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DELETE
</term>
<listitem>
<para>
The referenced object has just been deleted from the database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
MODIFY
</term>
<listitem>
<para>
The reference object has just been modified in the database.
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable>id</replaceable>
</term>
<listitem>
<para>
Unique id of the object.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable>args</replaceable>
</term>
<listitem>
<para>
Zero or more additional arguments. Varies by
<replaceable>obj-type</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 xml:id="sect.object_types">
<title>Object Types</title>
<para>
The following object types are defined:
</para>
<sect2 xml:id="sect.object_types.cart">
<title>Carts</title>
<para>
<userinput>CART</userinput>
</para>
<table xml:id="table.object_types.carts" frame="all" pgwide="0">
<title>Cart Fields</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colname="Field" colwidth="2.0*"/>
<colspec colname="Value" colwidth="10.0*"/>
<tbody>
<row><entry>Field</entry><entry>Value</entry></row>
<row><entry>obj-type</entry><entry>CART</entry></row>
<row><entry>id</entry><entry>Cart number</entry></row>
</tbody>
</tgroup>
</table>
</sect2>
</sect1>
</article>

View File

@ -608,6 +608,26 @@
</variablelist>
</sect2>
<sect2 xml:id="privileged_commands.process_notification">
<title>Process Notification</title>
<para>
Send or Receive an Object Notification
</para>
<para>
<userinput>ON <replaceable>notify</replaceable>!</userinput>
</para>
<para>
Send the <replaceable>notify</replaceable> to all other active
Rivendell modules.
</para>
<note>
<para>
See the Rivendell Notification Protocol API document for a description
of the contents of <replaceable>notify</replaceable>.
</para>
</note>
</sect2>
</sect1>
</article>

View File

@ -12,3 +12,4 @@ MAX_POST_LENGTH int(10) unsigned
ISCI_XREFERENCE_PATH char(255)
TEMP_CART_GROUP char(10) From 'GROUPS.NAME'
SHOW_USER_LIST enum('N','Y')
NOTIFICATION_ADDRESS char(15)

View File

@ -2,7 +2,7 @@
##
## Automake.am for rivendell/lib
##
## (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
## (C) Copyright 2002-2018 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
@ -182,6 +182,8 @@ dist_librd_la_SOURCES = dbversion.h\
rdmixer.cpp rdmixer.h\
rdmonitor_config.cpp rdmonitor_config.h\
rdmp4.cpp rdmp4.h\
rdmulticaster.cpp rdmulticaster.h\
rdnotification.cpp rdnotification.h\
rdnownext.cpp rdnownext.h\
rdoneshot.cpp rdoneshot.h\
rdpam.cpp rdpam.h\
@ -309,6 +311,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
moc_rdmacro_event.cpp\
moc_rdmarker_bar.cpp\
moc_rdmarker_edit.cpp\
moc_rdmulticaster.cpp\
moc_rdoneshot.cpp\
moc_rdpanel_button.cpp\
moc_rdpasswd.cpp\

View File

@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 275
#define RD_VERSION_DATABASE 276
#endif // DBVERSION_H

View File

@ -94,6 +94,7 @@ SOURCES += rdlogfilter.cpp
SOURCES += rdloglock.cpp
SOURCES += rdmacro.cpp
SOURCES += rdmacro_event.cpp
SOURCES += rdnotification.cpp
SOURCES += rdoneshot.cpp
SOURCES += rdplaymeter.cpp
SOURCES += rdprofile.cpp
@ -237,6 +238,7 @@ HEADERS += rdlogfilter.h
HEADERS += rdloglock.h
HEADERS += rdmacro.h
HEADERS += rdmacro_event.h
HEADERS += rdnotification.h
HEADERS += rdoneshot.h
HEADERS += rdplaymeter.h
HEADERS += rdprofile.h

View File

@ -572,5 +572,15 @@
*/
#define RD_LOG_LOCK_TIMEOUT 30000
/*
* Default multicast address for sending state updates
*/
#define RD_NOTIFICATION_ADDRESS "239.192.255.72"
/*
* UDP port for sending state updates
*/
#define RD_NOTIFICATION_PORT 20539
#endif // RD_H

142
lib/rdmulticaster.cpp Normal file
View File

@ -0,0 +1,142 @@
// rdmulticaster.cpp
//
// Multi-interface multicast transciever
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library 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 <errno.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <net/if.h>
#include <unistd.h>
#include "rdmulticaster.h"
RDMulticaster::RDMulticaster(QObject *parent)
: QObject(parent)
{
multi_socket=new QSocketDevice(QSocketDevice::Datagram);
multi_notifier=new QSocketNotifier(multi_socket->socket(),
QSocketNotifier::Read,this);
connect(multi_notifier,SIGNAL(activated(int)),this,SLOT(activatedData(int)));
GetInterfaces();
}
bool RDMulticaster::bind(uint16_t port)
{
return multi_socket->bind(QHostAddress("0.0.0.0"),port);
}
void RDMulticaster::enableLoopback(bool state)
{
int var=state;
setsockopt(multi_socket->socket(),IPPROTO_IP,IP_MULTICAST_LOOP,
&var,sizeof(var));
}
void RDMulticaster::subscribe(const QHostAddress &addr)
{
struct ip_mreqn mreq;
for(unsigned i=0;i<multi_iface_addresses.size();i++) {
memset(&mreq,0,sizeof(mreq));
mreq.imr_multiaddr.s_addr=htonl(addr.toIPv4Address());
mreq.imr_address.s_addr=htonl(multi_iface_addresses[i].toIPv4Address());
mreq.imr_ifindex=0;
if(setsockopt(multi_socket->socket(),IPPROTO_IP,IP_ADD_MEMBERSHIP,
&mreq,sizeof(mreq))<0) {
fprintf(stderr,tr("Unable to subscribe to multicast address")+" \""+
addr.toString()+"\" ["+strerror(errno)+"]");
}
}
}
void RDMulticaster::unsubscribe(const QHostAddress &addr)
{
struct ip_mreqn mreq;
for(unsigned i=0;i<multi_iface_addresses.size();i++) {
memset(&mreq,0,sizeof(mreq));
mreq.imr_multiaddr.s_addr=htonl(addr.toIPv4Address());
mreq.imr_address.s_addr=htonl(multi_iface_addresses[i].toIPv4Address());
mreq.imr_ifindex=0;
if(setsockopt(multi_socket->socket(),IPPROTO_IP,IP_DROP_MEMBERSHIP,
&mreq,sizeof(mreq))<0) {
fprintf(stderr,tr("Unable to subscribe to multicast address")+" \""+
addr.toString()+"\" ["+strerror(errno)+"]");
}
}
}
void RDMulticaster::send(const QString &msg,const QHostAddress &m_addr,
uint16_t port)
{
multi_socket->writeBlock(msg.utf8(),msg.utf8().length(),m_addr,port);
}
void RDMulticaster::activatedData(int sock)
{
struct sockaddr_in sa;
socklen_t sa_len=sizeof(struct sockaddr_in);
char data[1501];
int n;
memset(&sa,0,sizeof(sa));
while((n=recvfrom(multi_socket->socket(),data,1500,MSG_DONTWAIT,(sockaddr *)&sa,&sa_len))>0) {
data[n]=0;
QString msg(data);
emit received(msg,QHostAddress(ntohl(sa.sin_addr.s_addr)));
sa_len=sizeof(struct sockaddr_in);
}
}
void RDMulticaster::GetInterfaces()
{
int fd;
struct ifreq ifr;
int index=0;
sockaddr_in *sa=NULL;
if((fd=socket(PF_INET,SOCK_DGRAM,IPPROTO_IP))<0) {
return;
}
memset(&ifr,0,sizeof(ifr));
index=1;
ifr.ifr_ifindex=index;
while(ioctl(fd,SIOCGIFNAME,&ifr)==0) {
if(ioctl(fd,SIOCGIFADDR,&ifr)==0) {
sa=(struct sockaddr_in *)(&(ifr.ifr_addr));
if((ntohl(sa->sin_addr.s_addr)&0xFF000000)!=0x7F000000) {
multi_iface_addresses.push_back(QHostAddress());
multi_iface_addresses.back().setAddress(ntohl(sa->sin_addr.s_addr));
}
}
ifr.ifr_ifindex=++index;
}
::close(fd);
}

60
lib/rdmulticaster.h Normal file
View File

@ -0,0 +1,60 @@
// rdmulticaster.h
//
// Multi-interface multicast transciever
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library 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 RDMULTICASTER_H
#define RDMULTICASTER_H
#include <stdint.h>
#include <vector>
#include <qhostaddress.h>
#include <qobject.h>
#include <qsocketdevice.h>
#include <qsocketnotifier.h>
class RDMulticaster : public QObject
{
Q_OBJECT
public:
RDMulticaster(QObject *parent=0);
bool bind(uint16_t port);
void enableLoopback(bool state);
void subscribe(const QHostAddress &addr);
void unsubscribe(const QHostAddress &addr);
signals:
void received(const QString &msg,const QHostAddress &src_addr);
public slots:
void send(const QString &msg,const QHostAddress &m_addr,uint16_t port);
private slots:
void activatedData(int sock);
private:
void GetInterfaces();
QSocketDevice *multi_socket;
QSocketNotifier *multi_notifier;
std::vector<QHostAddress> multi_iface_addresses;
};
#endif // RDMULTICASTER_H

166
lib/rdnotification.cpp Normal file
View File

@ -0,0 +1,166 @@
// rdnotification.cpp
//
// A container class for a Rivendell Notification message.
//
// (C) Copyright 2018 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 "rdnotification.h"
RDNotification::RDNotification()
{
notify_type=RDNotification::NullType;
notify_action=RDNotification::NoAction;
}
RDNotification::Type RDNotification::type() const
{
return notify_type;
}
void RDNotification::setType(RDNotification::Type type)
{
notify_type=type;
}
RDNotification::Action RDNotification::action() const
{
return notify_action;
}
void RDNotification::setAction(RDNotification::Action action)
{
notify_action=action;
}
QVariant RDNotification::id() const
{
return notify_id;
}
void RDNotification::setId(const QVariant id)
{
notify_id=id;
}
bool RDNotification::isValid() const
{
return true;
}
bool RDNotification::read(const QString &str)
{
notify_type=RDNotification::NullType;
notify_action=RDNotification::NoAction;
notify_id=QVariant();
QStringList args=args.split(" ",str);
if(args.size()==4) {
if(args[0]!="NOTIFY") {
return false;
}
for(int i=0;i<RDNotification::LastType;i++) {
RDNotification::Type type=(RDNotification::Type)i;
if(args[1]==RDNotification::typeString(type)) {
notify_type=type;
notify_id=QVariant(args[2].toUInt());
}
}
if(notify_type==RDNotification::NullType) {
return false;
}
for(int i=0;i<RDNotification::LastAction;i++) {
RDNotification::Action action=(RDNotification::Action)i;
if(args[2]==RDNotification::actionString(action)) {
notify_action=action;
}
}
if(notify_action==RDNotification::NoAction) {
return false;
}
}
return true;
}
QString RDNotification::write() const
{
QString ret="";
ret+="NOTIFY ";
ret+=RDNotification::typeString(notify_type)+" ";
ret+=RDNotification::actionString(notify_action)+" ";
switch(notify_type) {
case RDNotification::CartType:
ret+=QString().sprintf("%u",notify_id.toUInt());
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;
}
return ret;
}
QString RDNotification::typeString(RDNotification::Type type)
{
QString ret="UNKNOWN";
switch(type) {
case RDNotification::CartType:
ret="CART";
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;
}
return ret;
}
QString RDNotification::actionString(Action action)
{
QString ret="UNKNOWN";
switch(action) {
case RDNotification::AddAction:
ret="ADD";
break;
case RDNotification::DeleteAction:
ret="DELETE";
break;
case RDNotification::ModifyAction:
ret="MODIFY";
break;
case RDNotification::NoAction:
case RDNotification::LastAction:
break;
}
return ret;
}

53
lib/rdnotification.h Normal file
View File

@ -0,0 +1,53 @@
// rdnotification.h
//
// A container class for a Rivendell Notification message.
//
// (C) Copyright 2018 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 RDNOTIFICATION_H
#define RDNOTIFICATION_H
#include <qstring.h>
#include <qvariant.h>
class RDNotification
{
public:
enum Type {NullType=0,CartType=1,LastType=2};
enum Action {NoAction=0,AddAction=1,DeleteAction=2,ModifyAction=3,
LastAction=4};
RDNotification();
Type type() const;
void setType(Type type);
Action action() const;
void setAction(Action action);
QVariant id() const;
void setId(const QVariant id);
bool isValid() const;
bool read(const QString &str);
QString write() const;
static QString typeString(Type type);
static QString actionString(Action action);
private:
Type notify_type;
Action notify_action;
QVariant notify_id;
};
#endif // RDNOTIFICATION_H

View File

@ -137,6 +137,12 @@ void RDRipc::sendGpoCart(int matrix)
}
void RDRipc::sendNotification(const RDNotification &notify)
{
SendCommand("ON "+notify.write()+"!");
}
void RDRipc::sendOnairFlag()
{
SendCommand("TA!");
@ -425,4 +431,22 @@ void RDRipc::DispatchCommand()
ripc_onair_flag=args[1][0]=='1';
emit onairFlagChanged(ripc_onair_flag);
}
if(!strcmp(args[0],"ON")) { // Notification Received
if(argnum<4) {
return;
}
QString msg;
for(int i=1;i<argnum;i++) {
msg+=QString(args[i])+" ";
}
msg=msg.left(msg.length()-1);
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
delete notify;
return;
}
emit notificationReceived(notify);
delete notify;
}
}

View File

@ -2,7 +2,7 @@
//
// Connection to the Rivendell Interprocess Communication Daemon
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -27,6 +27,7 @@
#include <rdconfig.h>
#include <rdmacro.h>
#include <rdnotification.h>
#include <rdstation.h>
#ifndef RDRIPC_H
@ -40,8 +41,7 @@ class RDRipc : public QObject
{
Q_OBJECT
public:
// RDRipc(QString stationname,QObject *parent=0);
RDRipc(RDStation *station,RDConfig *config,QObject *parent=0);
RDRipc(RDStation *station,RDConfig *config,QObject *parent=0);
~RDRipc();
QString user() const;
QString station() const;
@ -55,6 +55,7 @@ class RDRipc : public QObject
void sendGpoMask(int matrix);
void sendGpiCart(int matrix);
void sendGpoCart(int matrix);
void sendNotification(const RDNotification &notify);
void sendOnairFlag();
void sendRml(RDMacro *macro);
void reloadHeartbeat();
@ -68,6 +69,7 @@ class RDRipc : public QObject
void gpoMaskChanged(int matrix,int line,bool state);
void gpiCartChanged(int matrix,int line,int off_cartnum,int on_cartnum);
void gpoCartChanged(int matrix,int line,int off_cartnum,int on_cartnum);
void notificationReceived(RDNotification *notify);
void onairFlagChanged(bool state);
void rmlReceived(RDMacro *rml);

View File

@ -174,6 +174,18 @@ void RDSystem::setShowUserList(bool state) const
}
QHostAddress RDSystem::notificationAddress() const
{
return QHostAddress(GetValue("NOTIFICATION_ADDRESS").toString());
}
void RDSystem::setNotificationAddress(const QHostAddress &addr)
{
SetRow("NOTIFICATION_ADDRESS",addr.toString());
}
QString RDSystem::xml() const
{
QString xml="<systemSettings>\n";

View File

@ -21,6 +21,7 @@
#ifndef RDSYSTEM_H
#define RDSYSTEM_H
#include <qhostaddress.h>
#include <qvariant.h>
class RDSystem
@ -41,6 +42,8 @@ class RDSystem
void setTempCartGroup(const QString &str) const;
bool showUserList() const;
void setShowUserList(bool state) const;
QHostAddress notificationAddress() const;
void setNotificationAddress(const QHostAddress &addr);
QString xml() const;
private:

View File

@ -1916,7 +1916,8 @@ bool CreateDb(QString name,QString pwd,RDConfig *config)
RD_DEFAULT_MAX_POST_LENGTH)+
"ISCI_XREFERENCE_PATH char(255),"+
"TEMP_CART_GROUP char(10),"+
"SHOW_USER_LIST enum('N','Y') not null default 'Y')"+
"SHOW_USER_LIST enum('N','Y') not null default 'Y',"+
"NOTIFICATION_ADDRESS char(15) default \""+RD_NOTIFICATION_ADDRESS+"\")"+
config->createTablePostfix();
if(!RunQuery(sql)) {
return false;
@ -8025,6 +8026,14 @@ int UpdateDb(int ver,RDConfig *config)
delete q;
}
if(ver<276) {
sql=QString("alter table SYSTEM ")+
"add column NOTIFICATION_ADDRESS char(15) default \""+
RD_NOTIFICATION_ADDRESS+"\" after SHOW_USER_LIST";
q=new RDSqlQuery(sql,false);
delete q;
}
//
// Maintainer's Note:

View File

@ -118,17 +118,27 @@ EditSettings::EditSettings(QWidget *parent)
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
//
// Maximum POST Size
// Notification Address
//
edit_maxpost_spin=new QSpinBox(this);
edit_maxpost_spin->setGeometry(200,98,60,20);
edit_maxpost_spin->setRange(1,1000);
label=new QLabel(edit_maxpost_spin,tr("Maximum Remote Post Length:"),this);
edit_notification_address_edit=new QLineEdit(this);
edit_notification_address_edit->setGeometry(200,98,150,20);
label=new QLabel(edit_notification_address_edit,tr("Mcast Address for Notifications"),this);
label->setGeometry(10,98,185,20);
label->setFont(font);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
//
// Maximum POST Size
//
edit_maxpost_spin=new QSpinBox(this);
edit_maxpost_spin->setGeometry(200,120,60,20);
edit_maxpost_spin->setRange(1,1000);
label=new QLabel(edit_maxpost_spin,tr("Maximum Remote Post Length:"),this);
label->setGeometry(10,120,185,20);
label->setFont(font);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
label=new QLabel(tr("Mbytes"),this);
label->setGeometry(265,98,60,20);
label->setGeometry(265,120,60,20);
label->setFont(font);
label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
@ -136,7 +146,7 @@ EditSettings::EditSettings(QWidget *parent)
// Temporary Cart Group
//
edit_temp_cart_group_box=new QComboBox(this);
edit_temp_cart_group_box->setGeometry(200,119,100,20);
edit_temp_cart_group_box->setGeometry(200,141,100,20);
sql="select NAME from GROUPS order by NAME";
q=new RDSqlQuery(sql);
while(q->next()) {
@ -144,7 +154,7 @@ EditSettings::EditSettings(QWidget *parent)
}
delete q;
label=new QLabel(edit_temp_cart_group_box,tr("Temporary Cart Group:"),this);
label->setGeometry(10,119,185,20);
label->setGeometry(10,141,185,20);
label->setFont(font);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
@ -152,12 +162,12 @@ EditSettings::EditSettings(QWidget *parent)
// Show User List
//
edit_show_user_list_box=new QCheckBox(this);
edit_show_user_list_box->setGeometry(20,143,15,15);
edit_show_user_list_box->setGeometry(20,165,15,15);
connect(edit_show_user_list_box,SIGNAL(toggled(bool)),
this,SLOT(duplicatesCheckedData(bool)));
label=
new QLabel(edit_show_user_list_box,tr("Show User List in RDLogin"),this);
label->setGeometry(40,141,sizeHint().width()-50,20);
label->setGeometry(40,163,sizeHint().width()-50,20);
label->setFont(font);
label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
@ -167,11 +177,11 @@ EditSettings::EditSettings(QWidget *parent)
edit_duplicate_label=new RDLabel(this);
edit_duplicate_label->setText(tr("The following duplicate titles must be corrected before \"Allow Duplicate Values\" can be turned off."));
edit_duplicate_label->setWordWrapEnabled(true);
edit_duplicate_label->setGeometry(15,164,sizeHint().width()-30,50);
edit_duplicate_label->setGeometry(15,186,sizeHint().width()-30,50);
edit_duplicate_label->setFont(normal_font);
edit_duplicate_label->hide();
edit_duplicate_list=new QListView(this);
edit_duplicate_list->setGeometry(10,187,sizeHint().width()-20,200);
edit_duplicate_list->setGeometry(10,209,sizeHint().width()-20,200);
edit_duplicate_list->setItemMargin(5);
edit_duplicate_list->setAllColumnsShowFocus(true);
edit_duplicate_list->addColumn(tr("CART"));
@ -181,7 +191,7 @@ EditSettings::EditSettings(QWidget *parent)
edit_duplicate_list->hide();
edit_save_button=new QPushButton(this);
edit_save_button->
setGeometry(sizeHint().width()-85,392,70,25);
setGeometry(sizeHint().width()-85,414,70,25);
edit_save_button->setFont(normal_font);
edit_save_button->setText(tr("&Save List"));
connect(edit_save_button,SIGNAL(clicked()),this,SLOT(saveData()));
@ -213,6 +223,8 @@ EditSettings::EditSettings(QWidget *parent)
duplicatesCheckedData(edit_system->allowDuplicateCartTitles());
edit_maxpost_spin->setValue(edit_system->maxPostLength()/1000000);
edit_isci_path_edit->setText(edit_system->isciXreferencePath());
edit_notification_address_edit->
setText(edit_system->notificationAddress().toString());
edit_show_user_list_box->setChecked(edit_system->showUserList());
for(int i=0;i<edit_sample_rate_box->count();i++) {
@ -239,7 +251,7 @@ EditSettings::~EditSettings()
QSize EditSettings::sizeHint() const
{
return QSize(500,240+y_pos);
return QSize(500,262+y_pos);
}
@ -398,6 +410,8 @@ void EditSettings::okData()
edit_system->setSampleRate(edit_sample_rate_box->currentText().toUInt());
edit_system->setMaxPostLength(edit_maxpost_spin->value()*1000000);
edit_system->setIsciXreferencePath(edit_isci_path_edit->text());
edit_system->
setNotificationAddress(QHostAddress(edit_notification_address_edit->text()));
edit_system->setTempCartGroup(edit_temp_cart_group_box->currentText());
edit_system->setShowUserList(edit_show_user_list_box->isChecked());

View File

@ -62,6 +62,7 @@ class EditSettings : public QDialog
QComboBox *edit_temp_cart_group_box;
QCheckBox *edit_show_user_list_box;
QListView *edit_duplicate_list;
QLineEdit *edit_notification_address_edit;
QPushButton *edit_settings_button;
QPushButton *edit_save_button;
QPushButton *edit_ok_button;

View File

@ -3548,6 +3548,10 @@ Přepsat?</translation>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -3500,6 +3500,10 @@ Overwrite?</source>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -3547,6 +3547,10 @@ Overwrite?</source>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -3160,6 +3160,10 @@ Overwrite?</source>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -3499,6 +3499,10 @@ Overwrite?</source>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -3499,6 +3499,10 @@ Overwrite?</source>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -3492,6 +3492,10 @@ Overwrite?</source>
<source>Show User List in RDLogin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mcast Address for Notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

View File

@ -20,6 +20,8 @@
#include <stdlib.h>
#include <rdapplication.h>
#include <globals.h>
#include <acu1p.h>
@ -40,7 +42,7 @@ Acu1p::Acu1p(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools 10x1
//
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2003,2016-2018 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
@ -20,9 +20,10 @@
#include <stdlib.h>
#include <globals.h>
#include <bt10x1.h>
#include <rdapplication.h>
#include "bt10x1.h"
#include "globals.h"
Bt10x1::Bt10x1(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -36,7 +37,7 @@ Bt10x1::Bt10x1(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools 16x1
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -20,8 +20,10 @@
#include <stdlib.h>
#include <globals.h>
#include <bt16x1.h>
#include <rdapplication.h>
#include "bt16x1.h"
#include "globals.h"
Bt16x1::Bt16x1(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -35,7 +37,7 @@ Bt16x1::Bt16x1(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools 16x2
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <bt16x2.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "bt16x2.h"
#include "globals.h"
Bt16x2::Bt16x2(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ Bt16x2::Bt16x2(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools 8x2
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -20,8 +20,10 @@
#include <stdlib.h>
#include <globals.h>
#include <bt8x2.h>
#include <rdapplication.h>
#include "bt8x2.h"
#include "globals.h"
Bt8x2::Bt8x2(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -35,7 +37,7 @@ Bt8x2::Bt8x2(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools ACS 8.2
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btacs82.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btacs82.h"
#include "globals.h"
BtAcs82::BtAcs82(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ BtAcs82::BtAcs82(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools ADMS 44.22
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btadms4422.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btadms4422.h"
#include "globals.h"
BtAdms4422::BtAdms4422(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ BtAdms4422::BtAdms4422(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());
@ -62,8 +64,8 @@ BtAdms4422::BtAdms4422(RDMatrix *matrix,QObject *parent)
writeBlock(QString().sprintf("*%uUM0\r\n",BTADMS4422_UNIT_ID),7);
}
else {
ripcd_config->log("ripcd",RDConfig::LogWarning,
"failed to open port \""+tty->port()+"\"");
rda->config()->log("ripcd",RDConfig::LogWarning,
"failed to open port \""+tty->port()+"\"");
}
}
delete tty;

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools GPI-16
//
// (C) Copyright 2002-2005,2010,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2010,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btgpi16.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btgpi16.h"
#include "globals.h"
BtGpi16::BtGpi16(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -46,7 +48,7 @@ BtGpi16::BtGpi16(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// Rivendell switcher driver for the BroadcastTools Sentinel4Web AES switcher
//
// (C) Copyright 2002-2013,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2013,2016-2018 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
@ -19,9 +19,12 @@
//
#include <stdlib.h>
#include <rdapplication.h>
#include <rddb.h>
#include <globals.h>
#include <btsentinel4web.h>
#include "btsentinel4web.h"
#include "globals.h"
BtSentinel4Web::BtSentinel4Web(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -130,7 +133,7 @@ void BtSentinel4Web::processCommand(RDMacro *cmd)
void BtSentinel4Web::connectedData()
{
bt_socket->writeBlock("*0U",3);
ripcd_config->log("ripcd",RDConfig::LogInfo,"connected to BT Sentinel4Web device at "+
rda->config()->log("ripcd",RDConfig::LogInfo,"connected to BT Sentinel4Web device at "+
bt_socket->peerAddress().toString());
}
@ -154,7 +157,7 @@ void BtSentinel4Web::readyReadData()
void BtSentinel4Web::watchdogData()
{
ripcd_config->log("ripcd",RDConfig::LogWarning,"lost connection to BT Sentinel4Web device at "+
rda->config()->log("ripcd",RDConfig::LogWarning,"lost connection to BT Sentinel4Web device at "+
bt_socket->peerAddress().toString());
bt_watchdog_reset_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL,true);
}

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SRC-16
//
// (C) Copyright 2002-2005,2010,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2010,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btsrc16.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btsrc16.h"
#include "globals.h"
BtSrc16::BtSrc16(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -47,7 +49,7 @@ BtSrc16::BtSrc16(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SRC-8 III
//
// (C) Copyright 2002-2005,2010,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2010,2016-2018 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
@ -18,13 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btsrc8iii.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btsrc8iii.h"
#include "globals.h"
BtSrc8Iii::BtSrc8Iii(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -48,7 +49,7 @@ BtSrc8Iii::BtSrc8Iii(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 12.4
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btss124.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btss124.h"
#include "globals.h"
BtSs124::BtSs124(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -38,7 +40,7 @@ BtSs124::BtSs124(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 16.4
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btss164.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btss164.h"
#include "globals.h"
BtSs164::BtSs164(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ BtSs164::BtSs164(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 4.1 MLR
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -18,14 +18,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdlib.h>
#include <qstringlist.h>
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btss41mlr.h>
#include <rdapplication.h>
#include "btss41mlr.h"
#include "globals.h"
BtSs41Mlr::BtSs41Mlr(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -51,7 +52,7 @@ BtSs41Mlr::BtSs41Mlr(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 4.2
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btss42.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btss42.h"
#include "globals.h"
BtSs42::BtSs42(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ BtSs42::BtSs42(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 4.4
//
// (C) Copyright 2002-2005,2009,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2009,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btss44.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btss44.h"
#include "globals.h"
BtSs44::BtSs44(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ BtSs44::BtSs44(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 8.2
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -18,12 +18,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qtimer.h>
#include <stdlib.h>
#include <globals.h>
#include <btss82.h>
#include <qtimer.h>
#include <rdapplication.h>
#include "btss82.h"
#include "globals.h"
BtSs82::BtSs82(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -49,7 +51,7 @@ BtSs82::BtSs82(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
bt_device=new RDTTYDevice();
if(tty->active()) {
bt_device->setName(tty->port());

View File

@ -21,17 +21,14 @@
#ifndef GLOBALS_H
#define GLOBALS_H
#include <rdcae.h>
#include <rdstation.h>
#include <qstring.h>
#include <rd.h>
#include <rdconfig.h>
//
// Global Objects
//
extern RDConfig *ripcd_config;
extern RDCae *rdcae;
extern RDStation *rdstation;
extern QString ripcd_active_locks[MAX_MATRICES];
extern void LogLine(RDConfig::LogPriority prio,const QString &line);

View File

@ -2,7 +2,7 @@
//
// A Rivendell LWRP audio switcher driver for LiveWire networks.
//
// (C) Copyright 2002-2013,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2013,2016-2018 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
@ -19,9 +19,12 @@
//
#include <stdlib.h>
#include <rdapplication.h>
#include <rddb.h>
#include <globals.h>
#include <livewire_lwrpaudio.h>
#include "globals.h"
#include "livewire_lwrpaudio.h"
LiveWireLwrpAudio::LiveWireLwrpAudio(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -32,7 +35,7 @@ LiveWireLwrpAudio::LiveWireLwrpAudio(RDMatrix *matrix,QObject *parent)
//
// Get Matrix Parameters
//
livewire_stationname=rdstation->name();
livewire_stationname=rda->station()->name();
livewire_matrix=matrix->matrix();
//

View File

@ -2,7 +2,7 @@
//
// A Rivendell multicast GPIO driver for LiveWire networks.
//
// (C) Copyright 2013,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2013,2016-2018 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
@ -18,19 +18,20 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdlib.h>
#include <syslog.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <syslog.h>
#include <time.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <rdapplication.h>
#include <rddb.h>
#include <rdescape_string.h>
#include <globals.h>
#include <livewire_mcastgpio.h>
#include "globals.h"
#include "livewire_mcastgpio.h"
LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -45,7 +46,7 @@ LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent)
//
// Get Matrix Parameters
//
livewire_stationname=rdstation->name();
livewire_stationname=rda->station()->name();
livewire_matrix=matrix->matrix();
livewire_gpios=matrix->gpis();
livewire_interface_addr=matrix->ipAddress(RDMatrix::Primary);

View File

@ -2,7 +2,7 @@
//
// Load Switcher drivers for ripcd(8)
//
// (C) Copyright 2002-2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -20,54 +20,56 @@
#include <stdlib.h>
#include <ripcd.h>
#include <switcher.h>
#include <globals.h>
#include <acu1p.h>
#include <am16.h>
#include <bt10x1.h>
#include <bt16x1.h>
#include <bt16x2.h>
#include <bt8x2.h>
#include <btacs82.h>
#include <btadms4422.h>
#include <btgpi16.h>
#include <btsentinel4web.h>
#include <btsrc16.h>
#include <btsrc8iii.h>
#include <btss124.h>
#include <btss164.h>
#include <btss41mlr.h>
#include <btss42.h>
#include <btss44.h>
#include <btss82.h>
#include <btu41mlrweb.h>
#include <harlond.h>
#include <kernelgpio.h>
#include <livewire_lwrpaudio.h>
#include <livewire_lwrpgpio.h>
#include <livewire_mcastgpio.h>
#include <local_audio.h>
#include <local_gpio.h>
#include <modbus.h>
#include <modemlines.h>
#include <quartz1.h>
#include <rossnkscp.h>
#include <sas16000.h>
#include <sas32000.h>
#include <sas64000.h>
#include <sas64000gpi.h>
#include <sasusi.h>
#include <starguide3.h>
#include <swauthority.h>
#include <unity4000.h>
#include <vguest.h>
#include <wheatnet_lio.h>
#include <wheatnet_slio.h>
#include <rdapplication.h>
#include "ripcd.h"
#include "switcher.h"
#include "globals.h"
#include "acu1p.h"
#include "am16.h"
#include "bt10x1.h"
#include "bt16x1.h"
#include "bt16x2.h"
#include "bt8x2.h"
#include "btacs82.h"
#include "btadms4422.h"
#include "btgpi16.h"
#include "btsentinel4web.h"
#include "btsrc16.h"
#include "btsrc8iii.h"
#include "btss124.h"
#include "btss164.h"
#include "btss41mlr.h"
#include "btss42.h"
#include "btss44.h"
#include "btss82.h"
#include "btu41mlrweb.h"
#include "harlond.h"
#include "kernelgpio.h"
#include "livewire_lwrpaudio.h"
#include "livewire_lwrpgpio.h"
#include "livewire_mcastgpio.h"
#include "local_audio.h"
#include "local_gpio.h"
#include "modbus.h"
#include "modemlines.h"
#include "quartz1.h"
#include "rossnkscp.h"
#include "sas16000.h"
#include "sas32000.h"
#include "sas64000.h"
#include "sas64000gpi.h"
#include "sasusi.h"
#include "starguide3.h"
#include "swauthority.h"
#include "unity4000.h"
#include "vguest.h"
#include "wheatnet_lio.h"
#include "wheatnet_slio.h"
bool MainObject::LoadSwitchDriver(int matrix_num)
{
RDMatrix *matrix=new RDMatrix(rdstation->name(),matrix_num);
RDMatrix *matrix=new RDMatrix(rda->station()->name(),matrix_num);
switch(matrix->type()) {
case RDMatrix::Acu1p:

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools 10x1
//
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2003,2016-2018 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
@ -21,9 +21,10 @@
#include <stdlib.h>
#include <rd.h>
#include <rdapplication.h>
#include <globals.h>
#include <local_audio.h>
#include "globals.h"
#include "local_audio.h"
LocalAudio::LocalAudio(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -84,19 +85,19 @@ void LocalAudio::processCommand(RDMacro *cmd)
}
if(cmd->arg(1).toInt()==0) {
for(int i=0;i<bt_inputs;i++) {
rdcae->
rda->cae()->
setPassthroughVolume(bt_card,i,cmd->arg(2).toInt()-1,-10000);
}
}
else {
rdcae->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
rda->cae()->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
cmd->arg(2).toInt()-1,0);
for(int i=0;i<(cmd->arg(1).toInt()-1);i++) {
rdcae->
rda->cae()->
setPassthroughVolume(bt_card,i,cmd->arg(2).toInt()-1,-10000);
}
for(int i=cmd->arg(1).toInt();i<bt_inputs;i++) {
rdcae->
rda->cae()->
setPassthroughVolume(bt_card,i,cmd->arg(2).toInt()-1,-10000);
}
}
@ -111,7 +112,7 @@ void LocalAudio::processCommand(RDMacro *cmd)
emit rmlEcho(cmd);
return;
}
rdcae->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
rda->cae()->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
cmd->arg(2).toInt()-1,0);
cmd->acknowledge(true);
emit rmlEcho(cmd);
@ -124,7 +125,7 @@ void LocalAudio::processCommand(RDMacro *cmd)
emit rmlEcho(cmd);
return;
}
rdcae->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
rda->cae()->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
cmd->arg(2).toInt()-1,RD_MUTE_DEPTH);
cmd->acknowledge(true);
emit rmlEcho(cmd);
@ -138,7 +139,7 @@ void LocalAudio::processCommand(RDMacro *cmd)
emit rmlEcho(cmd);
return;
}
rdcae->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
rda->cae()->setPassthroughVolume(bt_card,cmd->arg(1).toInt()-1,
cmd->arg(2).toInt()-1,cmd->arg(3).toInt());
cmd->acknowledge(true);
emit rmlEcho(cmd);

View File

@ -2,7 +2,7 @@
//
// Local RML Macros for the Rivendell Interprocess Communication Daemon
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -23,13 +23,13 @@
#include <sys/wait.h>
#include <rd.h>
#include <rdapplication.h>
#include <rdconf.h>
#include <rdescape_string.h>
#include <rdmatrix.h>
#include <rdtty.h>
#include <rduser.h>
#include <rddb.h>
#include <ripcd.h>
#include <rdescape_string.h>
#include "ripcd.h"
void MainObject::gpiChangedData(int matrix,int line,bool state)
{
@ -117,7 +117,7 @@ void MainObject::ExecCart(int cartnum)
RDMacro rml;
rml.setRole(RDMacro::Cmd);
rml.setCommand(RDMacro::EX);
rml.setAddress(rdstation->address());
rml.setAddress(rda->station()->address());
rml.setEchoRequested(false);
rml.setArgQuantity(1);
rml.setArg(0,cartnum);
@ -132,7 +132,7 @@ void MainObject::LogGpioEvent(int matrix,int line,RDMatrix::GpioType type,
RDSqlQuery *q;
sql=QString("insert into GPIO_EVENTS set ")+
"STATION_NAME=\""+RDEscapeString(rdstation->name())+"\","+
"STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\","+
QString().sprintf("MATRIX=%d,",matrix)+
QString().sprintf("NUMBER=%d,",line+1)+
QString().sprintf("TYPE=%d,",type)+
@ -163,7 +163,7 @@ void MainObject::LoadLocalMacros()
//
sql=QString().sprintf("select MATRIX,TYPE,PORT,INPUTS,OUTPUTS from MATRICES \
where STATION_NAME=\"%s\"",
(const char *)rdstation->name());
(const char *)rda->station()->name());
q=new RDSqlQuery(sql);
while(q->next()) {
if(!LoadSwitchDriver(q->value(0).toInt())) {
@ -180,7 +180,7 @@ void MainObject::LoadLocalMacros()
sql=QString().sprintf("select PORT_ID,PORT,BAUD_RATE,DATA_BITS,PARITY,\
TERMINATION from TTYS where (STATION_NAME=\"%s\")&&\
(ACTIVE=\"Y\")",
(const char *)rdstation->name());
(const char *)rda->station()->name());
q=new RDSqlQuery(sql);
while(q->next()) {
tty_port=q->value(0).toUInt();
@ -270,9 +270,9 @@ void MainObject::RunLocalMacros(RDMacro *rml)
}
if(fork()==0) {
cmd=QString().sprintf("mysqldump -c Rivendell -h %s -u %s -p%s > %s",
(const char *)ripcd_config->mysqlHostname(),
(const char *)ripcd_config->mysqlUsername(),
(const char *)ripcd_config->mysqlPassword(),
(const char *)rda->config()->mysqlHostname(),
(const char *)rda->config()->mysqlUsername(),
(const char *)rda->config()->mysqlPassword(),
(const char *)rml->arg(0).toString());
system((const char *)cmd);
exit(0);
@ -416,7 +416,7 @@ void MainObject::RunLocalMacros(RDMacro *rml)
}
return;
}
rdcae->connectJackPorts(rml->arg(0).toString(),rml->arg(1).toString());
rda->cae()->connectJackPorts(rml->arg(0).toString(),rml->arg(1).toString());
if(rml->echoRequested()) {
rml->acknowledge(true);
sendRml(rml);
@ -431,7 +431,7 @@ void MainObject::RunLocalMacros(RDMacro *rml)
}
return;
}
rdcae->disconnectJackPorts(rml->arg(0).toString(),rml->arg(1).toString());
rda->cae()->disconnectJackPorts(rml->arg(0).toString(),rml->arg(1).toString());
if(rml->echoRequested()) {
rml->acknowledge(true);
sendRml(rml);
@ -447,7 +447,7 @@ void MainObject::RunLocalMacros(RDMacro *rml)
return;
}
if(rml->argQuantity()==0) {
rduser=new RDUser(rdstation->defaultName());
rduser=new RDUser(rda->station()->defaultName());
}
else {
rduser=new RDUser(rml->arg(0).toString());
@ -494,19 +494,19 @@ void MainObject::RunLocalMacros(RDMacro *rml)
}
if(fork()==0) {
if(getuid()==0) {
if(setegid(ripcd_config->gid())<0) {
if(setegid(rda->config()->gid())<0) {
LogLine(RDConfig::LogWarning,QString().
sprintf("unable to set group id %d for RDPopup",
ripcd_config->gid()));
rda->config()->gid()));
if(rml->echoRequested()) {
rml->acknowledge(false);
sendRml(rml);
}
}
if(seteuid(ripcd_config->uid())<0) {
if(seteuid(rda->config()->uid())<0) {
LogLine(RDConfig::LogWarning,QString().
sprintf("unable to set user id %d for RDPopup",
ripcd_config->uid()));
rda->config()->uid()));
if(rml->echoRequested()) {
rml->acknowledge(false);
sendRml(rml);
@ -579,19 +579,19 @@ void MainObject::RunLocalMacros(RDMacro *rml)
cmd+=" "+rml->arg(i).toString();
}
if(getuid()==0) {
if(setgid(ripcd_config->gid())<0) {
if(setgid(rda->config()->gid())<0) {
LogLine(RDConfig::LogWarning,QString().
sprintf("unable to set group id %d for RN",
ripcd_config->gid()));
rda->config()->gid()));
if(rml->echoRequested()) {
rml->acknowledge(false);
sendRml(rml);
}
}
if(setuid(ripcd_config->uid())<0) {
if(setuid(rda->config()->uid())<0) {
LogLine(RDConfig::LogWarning,QString().
sprintf("unable to set user id %d for RN",
ripcd_config->uid()));
rda->config()->uid()));
if(rml->echoRequested()) {
rml->acknowledge(false);
sendRml(rml);
@ -781,7 +781,7 @@ void MainObject::RunLocalMacros(RDMacro *rml)
sql=QString().sprintf("select PORT_ID,PORT,BAUD_RATE,DATA_BITS,PARITY,\
TERMINATION from TTYS where (STATION_NAME=\"%s\")&& \
(ACTIVE=\"Y\")&&(PORT_ID=%d)",
(const char *)rdstation->name(),tty_port);
(const char *)rda->station()->name(),tty_port);
q=new RDSqlQuery(sql);
if(q->first()) {
if(!ripcd_tty_inuse[tty_port]) {

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for using TTY modem lines for GPIO
//
// (C) Copyright 2015-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2015-2018 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
@ -18,15 +18,17 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <fcntl.h>
#include <stdlib.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <globals.h>
#include <modemlines.h>
#include <rdapplication.h>
#include "globals.h"
#include "modemlines.h"
ModemLines::ModemLines(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -54,7 +56,7 @@ ModemLines::ModemLines(RDMatrix *matrix,QObject *parent)
//
// Open TTY
//
gpio_tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
gpio_tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
if((gpio_fd=open(gpio_tty->port(),O_RDONLY))<0) {
syslog(LOG_ERR,"unable to open tty \"%s\"",(const char *)gpio_tty->port());
return;

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the Quartz Type 1 Switcher Protocol
//
// (C) Copyright 2002-2004,2008,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2008,2016-2018 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
@ -22,9 +22,11 @@
#include <qsignalmapper.h>
#include <rdapplication.h>
#include <rddb.h>
#include <globals.h>
#include <quartz1.h>
#include "globals.h"
#include "quartz1.h"
Quartz1::Quartz1(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -71,7 +73,7 @@ Quartz1::Quartz1(RDMatrix *matrix,QObject *parent)
for(int i=0;i<2;i++) {
switch(sas_porttype[i]) {
case RDMatrix::TtyPort:
tty=new RDTty(rdstation->name(),sas_port[i]);
tty=new RDTty(rda->station()->name(),sas_port[i]);
sas_device[i]=new RDTTYDevice();
if(tty->active()) {
sas_device[i]->setName(tty->port());

View File

@ -38,24 +38,15 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <rd.h>
#include <rdapplication.h>
#include <rdconf.h>
#include <rdstation.h>
#include <rdcheck_daemons.h>
#include <rdcmd_switch.h>
#include <rddb.h>
#include <dbversion.h>
#include <rdnotification.h>
#include <globals.h>
#include <ripcd_socket.h>
#include <ripcd.h>
#include "globals.h"
#include "ripcd_socket.h"
#include "ripcd.h"
//
// Global Objects
//
RDConfig *ripcd_config;
RDCae *rdcae;
RDStation *rdstation;
bool global_exiting=false;
void SigHandler(int signo)
@ -84,26 +75,13 @@ void SigHandler(int signo)
MainObject::MainObject(QObject *parent)
:QObject(parent)
{
bool skip_db_check=false;
QString err_msg;
//
// Read Command Options
//
RDCmdSwitch *cmd=
new RDCmdSwitch(qApp->argc(),qApp->argv(),"ripcd",RIPCD_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
skip_db_check=true;
}
rda=new RDApplication("ripcd","ripcd",RIPCD_USAGE,this);
if(!rda->open(&err_msg)) {
fprintf(stderr,"ripcd: %s\n",(const char *)err_msg);
exit(1);
}
delete cmd;
//
// Load Local Configs
//
ripcd_config=new RDConfig(RD_CONF_FILE);
ripcd_config->load();
ripcd_config->setModuleName("ripcd");
//
// Make sure we're the only instance running
@ -145,39 +123,15 @@ MainObject::MainObject(QObject *parent)
connect(ripc_macro_timer[i],SIGNAL(timeout()),mapper,SLOT(map()));
}
//
// Open Database
//
unsigned schema=0;
QString err (tr("ripcd: "));
ripcd_db = RDInitDb (&schema,&err);
if(!ripcd_db) {
printf ("%s\n",err.ascii());
exit (1);
}
if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) {
fprintf(stderr,"database version mismatch, should be %u, is %u",
RD_VERSION_DATABASE,schema);
exit(256);
}
connect (RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)),
this,SLOT(log(RDConfig::LogPriority,const QString &)));
//
// Station
//
rdstation=new RDStation(ripcd_config->stationName());
rdstation->setUserName(rdstation->defaultName());
ripcd_host_addr=rdstation->address();
ripcd_host_addr=rda->station()->address();
//
// CAE Connection
//
rdcae=new RDCae(rdstation,ripcd_config,parent);
rdcae->connectHost();
rda->cae()->connectHost();
if(qApp->argc()==1) {
RDDetach(ripcd_config->logCoreDumpDirectory());
RDDetach(rda->config()->logCoreDumpDirectory());
}
else {
debug=true;
@ -185,7 +139,7 @@ MainObject::MainObject(QObject *parent)
::signal(SIGCHLD,SigHandler);
::signal(SIGTERM,SigHandler);
::signal(SIGINT,SigHandler);
if(!RDWritePid(RD_PID_DIR,"ripcd.pid",ripcd_config->uid())) {
if(!RDWritePid(RD_PID_DIR,"ripcd.pid",rda->config()->uid())) {
printf("ripcd: can't write pid file\n");
exit(1);
}
@ -214,6 +168,18 @@ MainObject::MainObject(QObject *parent)
//
LoadLocalMacros();
//
// Initialize Notifications
//
ripcd_notification_mcaster=new RDMulticaster(this);
ripcd_notification_mcaster->enableLoopback(false);
connect(ripcd_notification_mcaster,
SIGNAL(received(const QString &,const QHostAddress &)),
this,
SLOT(notificationReceivedData(const QString &,const QHostAddress &)));
ripcd_notification_mcaster->bind(RD_NOTIFICATION_PORT);
ripcd_notification_mcaster->subscribe(rda->system()->notificationAddress());
//
// Start RML Polling
//
@ -237,7 +203,7 @@ MainObject::MainObject(QObject *parent)
ripcd_maint_timer=new QTimer(this);
connect(ripcd_maint_timer,SIGNAL(timeout()),this,SLOT(checkMaintData()));
int interval=GetMaintInterval();
if(!ripcd_config->disableMaintChecks()) {
if(!rda->config()->disableMaintChecks()) {
ripcd_maint_timer->start(interval);
}
else {
@ -287,6 +253,21 @@ void MainObject::newConnection(int fd)
}
void MainObject::notificationReceivedData(const QString &msg,
const QHostAddress &addr)
{
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
LogLine(RDConfig::LogWarning,
"Invalid notification received from "+addr.toString());
delete notify;
return;
}
BroadcastCommand("ON "+msg+"!");
delete notify;
}
void MainObject::sendRml(RDMacro *rml)
{
char buf[RD_RML_MAX_LENGTH];
@ -327,20 +308,20 @@ void MainObject::databaseBackup()
QDateTime datetime=QDateTime::currentDateTime();
int life;
if((life=rdstation->backupLife())<=0) {
if((life=rda->station()->backupLife())<=0) {
return;
}
if(fork()==0) {
cmd=QString().sprintf("find %s -name *.sql -ctime +%d -exec rm \\{\\} \\;",
(const char *)rdstation->backupPath(),
rdstation->backupLife());
(const char *)rda->station()->backupPath(),
rda->station()->backupLife());
system((const char *)cmd);
cmd=QString().
sprintf("mysqldump -c Rivendell -h %s -u %s -p%s > %s/%s.sql",
(const char *)ripcd_config->mysqlHostname(),
(const char *)ripcd_config->mysqlUsername(),
(const char *)ripcd_config->mysqlPassword(),
(const char *)rdstation->backupPath(),
(const char *)rda->config()->mysqlHostname(),
(const char *)rda->config()->mysqlUsername(),
(const char *)rda->config()->mysqlPassword(),
(const char *)rda->station()->backupPath(),
(const char *)datetime.date().toString("yyyyMMdd"));
system((const char *)cmd);
exit(0);
@ -373,7 +354,7 @@ void MainObject::checkMaintData()
//
// Should we try to run system maintenance?
//
if(!rdstation->systemMaint()) {
if(!rda->station()->systemMaint()) {
return;
}
@ -427,7 +408,7 @@ void MainObject::exitTimerData()
void MainObject::SetUser(QString username)
{
rdstation->setUserName(username);
rda->station()->setUserName(username);
BroadcastCommand(QString().sprintf("RU %s!",(const char *)username));
}
@ -500,7 +481,7 @@ void MainObject::DispatchCommand(int ch)
return;
}
if(!strcmp(conn->args[0],"PW")) { // Password Authenticate
if(!strcmp(conn->args[1],ripcd_config->password())) {
if(!strcmp(conn->args[1],rda->config()->password())) {
conn->auth=true;
EchoCommand(ch,"PW +!");
return;
@ -523,7 +504,7 @@ void MainObject::DispatchCommand(int ch)
if(!strcmp(conn->args[0],"RU")) { // Request User
EchoCommand(ch,(const char *)QString().
sprintf("RU %s!",(const char *)rdstation->userName()));
sprintf("RU %s!",(const char *)rda->station()->userName()));
return;
}
@ -556,7 +537,7 @@ void MainObject::DispatchCommand(int ch)
*/
if(!macro.address().isNull()) {
if(macro.address()==rdstation->address()&&
if(macro.address()==rda->station()->address()&&
((macro.port()==RD_RML_ECHO_PORT)||
(macro.port()==RD_RML_NOECHO_PORT))) { // Local Loopback
macro.generateString(buffer,RD_RML_MAX_LENGTH);
@ -590,7 +571,7 @@ void MainObject::DispatchCommand(int ch)
addr.setAddress(conn->args[1]);
macro.setAddress(addr);
macro.setRole(RDMacro::Reply);
if(macro.address()==rdstation->address()) { // Local Loopback
if(macro.address()==rda->station()->address()) { // Local Loopback
macro.generateString(buffer,RD_RML_MAX_LENGTH);
sprintf(cmd,"ME %s 0 %s",(const char *)macro.address().toString(),
buffer);
@ -641,6 +622,24 @@ void MainObject::DispatchCommand(int ch)
SendGpoCart(ch,matrix);
}
if(!strcmp(conn->args[0],"ON")) { // Send Notification
QString msg;
for(int i=1;i<conn->argnum;i++) {
msg+=QString(conn->args[i])+" ";
}
msg=msg.left(msg.length()-1);
RDNotification *notify=new RDNotification();
if(!notify->read(msg)) {
LogLine(RDConfig::LogWarning,"invalid notification processed");
delete notify;
return;
}
BroadcastCommand("ON "+msg+"!",ch);
ripcd_notification_mcaster->
send(msg,rda->system()->notificationAddress(),RD_NOTIFICATION_PORT);
delete notify;
}
if(!strcmp(conn->args[0],"TA")) { // Send Onair Flag State
EchoCommand(ch,QString().sprintf("TA %d!",ripc_onair_flag));
}
@ -662,11 +661,13 @@ void MainObject::EchoCommand(int ch,const char *command)
}
void MainObject::BroadcastCommand(const char *command)
void MainObject::BroadcastCommand(const char *command,int except_ch)
{
for(unsigned i=0;i<ripcd_conns.size();i++) {
if(ripcd_conns[i]!=NULL) {
EchoCommand(i,command);
if((int)i!=except_ch) {
if(ripcd_conns[i]!=NULL) {
EchoCommand(i,command);
}
}
}
}
@ -774,7 +775,7 @@ void MainObject::LoadGpiTable()
QString sql=QString().sprintf("select MATRIX,NUMBER,OFF_MACRO_CART,\
MACRO_CART from GPIS \
where STATION_NAME=\"%s\"",
(const char *)ripcd_config->stationName());
(const char *)rda->config()->stationName());
RDSqlQuery *q=new RDSqlQuery(sql);
while(q->next()) {
ripcd_gpi_macro[q->value(0).toInt()][q->value(1).toInt()-1][0]=
@ -786,7 +787,7 @@ void MainObject::LoadGpiTable()
sql=QString().sprintf("select MATRIX,NUMBER,OFF_MACRO_CART,MACRO_CART \
from GPOS where STATION_NAME=\"%s\"",
(const char *)ripcd_config->stationName());
(const char *)rda->config()->stationName());
q=new RDSqlQuery(sql);
while(q->next()) {
ripcd_gpo_macro[q->value(0).toInt()][q->value(1).toInt()-1][0]=
@ -878,18 +879,18 @@ void LogLine(RDConfig::LogPriority prio,const QString &line)
{
FILE *logfile;
ripcd_config->log("ripcd",prio,line);
rda->config()->log("ripcd",prio,line);
if((!ripcd_config) || ripcd_config->ripcdLogname().isEmpty()) {
if((!rda->config()) || rda->config()->ripcdLogname().isEmpty()) {
return;
}
QDateTime current=QDateTime::currentDateTime();
logfile=fopen(ripcd_config->ripcdLogname(),"a");
logfile=fopen(rda->config()->ripcdLogname(),"a");
if(logfile==NULL) {
return;
}
chmod(ripcd_config->ripcdLogname(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
chmod(rda->config()->ripcdLogname(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
fprintf(logfile,"%02d/%02d/%4d - %02d:%02d:%02d.%03d : %s\n",
current.date().month(),
current.date().day(),

View File

@ -38,6 +38,7 @@
#include <rdstation.h>
#include <rdmatrix.h>
#include <rdmacro.h>
#include <rdmulticaster.h>
#include <rdtty.h>
#include <ripcd_connection.h>
@ -63,6 +64,7 @@ class MainObject : public QObject
void newConnection(int fd);
private slots:
void notificationReceivedData(const QString &msg,const QHostAddress &addr);
void log(RDConfig::LogPriority prio,const QString &msg);
void sendRml(RDMacro *rml);
void readRml();
@ -87,7 +89,7 @@ class MainObject : public QObject
void DispatchCommand(int);
void KillSocket(int);
void EchoCommand(int,const char *);
void BroadcastCommand(const char *);
void BroadcastCommand(const char *,int except_ch=-1);
void EchoArgs(int,const char);
void ReadRmlSocket(QSocketDevice *dev,RDMacro::Role role,bool echo);
QString StripPoint(QString);
@ -132,6 +134,7 @@ class MainObject : public QObject
QTimer *ripc_macro_timer[RD_MAX_MACRO_TIMERS];
unsigned ripc_macro_cart[RD_MAX_MACRO_TIMERS];
QTimer *ripcd_maint_timer;
RDMulticaster *ripcd_notification_mcaster;
};

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the Ross NK switchers via the SCP/A
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -20,9 +20,10 @@
#include <stdlib.h>
#include <globals.h>
#include <rossnkscp.h>
#include <rdapplication.h>
#include "globals.h"
#include "rossnkscp.h"
RossNkScp::RossNkScp(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -37,7 +38,7 @@ RossNkScp::RossNkScp(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
ross_device=new RDTTYDevice();
if(tty->active()) {
ross_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the SAS USI Protocol (2 digit)
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -19,9 +19,12 @@
//
#include <stdlib.h>
#include <rdapplication.h>
#include <rddb.h>
#include <globals.h>
#include <sas16000.h>
#include "globals.h"
#include "sas16000.h"
Sas16000::Sas16000(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -41,7 +44,7 @@ Sas16000::Sas16000(RDMatrix *matrix,QObject *parent)
//
// Initialize the connection
//
tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
sas_device=new RDTTYDevice();
if(tty->active()) {
sas_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the SAS32000
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -20,8 +20,10 @@
#include <stdlib.h>
#include <globals.h>
#include <sas32000.h>
#include <rdapplication.h>
#include "globals.h"
#include "sas32000.h"
Sas32000::Sas32000(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -35,7 +37,7 @@ Sas32000::Sas32000(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
sas_device=new RDTTYDevice();
if(tty->active()) {
sas_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the SAS64000
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -20,8 +20,10 @@
#include <stdlib.h>
#include <globals.h>
#include <sas64000.h>
#include <rdapplication.h>
#include "globals.h"
#include "sas64000.h"
Sas64000::Sas64000(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -35,7 +37,7 @@ Sas64000::Sas64000(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
sas_device=new RDTTYDevice();
if(tty->active()) {
sas_device->setName(tty->port());

View File

@ -3,7 +3,7 @@
// A Rivendell switcher driver for the SAS64000 connected via
// a GPI-1600
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -21,9 +21,10 @@
#include <stdlib.h>
#include <globals.h>
#include <sas64000gpi.h>
#include <rdapplication.h>
#include "globals.h"
#include "sas64000gpi.h"
Sas64000Gpi::Sas64000Gpi(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -40,7 +41,7 @@ Sas64000Gpi::Sas64000Gpi(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
sas_device=new RDTTYDevice();
if(tty->active()) {
sas_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the SAS USI Protocol
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -19,9 +19,12 @@
//
#include <stdlib.h>
#include <rdapplication.h>
#include <rddb.h>
#include <globals.h>
#include <sasusi.h>
#include "globals.h"
#include "sasusi.h"
SasUsi::SasUsi(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -53,7 +56,7 @@ SasUsi::SasUsi(RDMatrix *matrix,QObject *parent)
sprintf("select ENGINE_NUM,DEVICE_NUM,RELAY_NUM \
from VGUEST_RESOURCES where (STATION_NAME=\"%s\")&&\
(MATRIX_NUM=%d) order by NUMBER",
(const char *)ripcd_config->stationName(),
(const char *)rda->config()->stationName(),
matrix->matrix());
q=new RDSqlQuery(sql);
while(q->next()) {
@ -74,7 +77,7 @@ SasUsi::SasUsi(RDMatrix *matrix,QObject *parent)
//
switch(sas_porttype) {
case RDMatrix::TtyPort:
tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
sas_device=new RDTTYDevice();
if(tty->active()) {
sas_device->setName(tty->port());
@ -486,7 +489,7 @@ void SasUsi::DispatchCommand()
sql=QString().sprintf("select NUMBER from INPUTS where \
(STATION_NAME=\"%s\")&& \
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
sas_matrix,input);
q=new RDSqlQuery(sql);
if(q->first()) {
@ -494,14 +497,14 @@ void SasUsi::DispatchCommand()
(STATION_NAME=\"%s\")&&\
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)label,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
sas_matrix,input);
}
else {
sql=QString().sprintf("insert into INPUTS set NAME=\"%s\",\
STATION_NAME=\"%s\",MATRIX=%d,NUMBER=%d",
(const char *)label,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
sas_matrix,input);
}
delete q;
@ -521,7 +524,7 @@ void SasUsi::DispatchCommand()
sql=QString().sprintf("select NUMBER from OUTPUTS where \
(STATION_NAME=\"%s\")&&\
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
sas_matrix,output);
q=new RDSqlQuery(sql);
if(q->first()) {
@ -529,14 +532,14 @@ void SasUsi::DispatchCommand()
(STATION_NAME=\"%s\")&&\
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)label,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
sas_matrix,output);
}
else {
sql=QString().sprintf("insert into OUTPUTS set NAME=\"%s\",\
STATION_NAME=\"%s\",MATRIX=%d,NUMBER=%d",
(const char *)label,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
sas_matrix,output);
}
delete q;
@ -619,7 +622,7 @@ void SasUsi::ExecuteMacroCart(unsigned cartnum)
RDMacro rml;
rml.setRole(RDMacro::Cmd);
rml.setCommand(RDMacro::EX);
rml.setAddress(rdstation->address());
rml.setAddress(rda->station()->address());
rml.setEchoRequested(false);
rml.setArgQuantity(1);
rml.setArg(0,cartnum);

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the StarGuide III Satellite Receiver
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2018 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
@ -20,10 +20,10 @@
#include <stdlib.h>
#include <qsqldatabase.h>
#include <rddb.h>
#include <globals.h>
#include <starguide3.h>
#include <rdapplication.h>
#include "globals.h"
#include "starguide3.h"
StarGuide3::StarGuide3(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -43,7 +43,7 @@ StarGuide3::StarGuide3(RDMatrix *matrix,QObject *parent)
sql=QString().sprintf("select NUMBER,ENGINE_NUM,DEVICE_NUM,CHANNEL_MODE\
from INPUTS where STATION_NAME=\"%s\" && MATRIX=%d \
order by NUMBER",
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
matrix->matrix());
q=new RDSqlQuery(sql);
q->first();
@ -61,7 +61,7 @@ StarGuide3::StarGuide3(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
sg_device=new RDTTYDevice();
if(tty->active()) {
sg_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for systems using Software Authority Protocol
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -22,10 +22,11 @@
#include <qstringlist.h>
#include <rdapplication.h>
#include <rdescape_string.h>
#include <rddb.h>
#include <globals.h>
#include <swauthority.h>
#include "globals.h"
#include "swauthority.h"
SoftwareAuthority::SoftwareAuthority(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -297,7 +298,7 @@ void SoftwareAuthority::DispatchCommand()
swa_istate=0;
sql=QString("update MATRICES set ")+
QString().sprintf("INPUTS=%d ",swa_inputs)+
"where (STATION_NAME=\""+RDEscapeString(rdstation->name())+"\")&&"+
"where (STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\")&&"+
QString().sprintf("(MATRIX=%d)",swa_matrix);
q=new RDSqlQuery(sql);
delete q;
@ -312,7 +313,7 @@ void SoftwareAuthority::DispatchCommand()
sql=QString().sprintf("select NUMBER from INPUTS where \
(STATION_NAME=\"%s\")&& \
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
swa_matrix,f0[0].toInt());
q=new RDSqlQuery(sql);
if(q->first()) {
@ -320,14 +321,14 @@ void SoftwareAuthority::DispatchCommand()
(STATION_NAME=\"%s\")&&\
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)name,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
swa_matrix,f0[0].toInt());
}
else {
sql=QString().sprintf("insert into INPUTS set NAME=\"%s\",\
STATION_NAME=\"%s\",MATRIX=%d,NUMBER=%d",
(const char *)name,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
swa_matrix,f0[0].toInt());
}
delete q;
@ -343,7 +344,7 @@ void SoftwareAuthority::DispatchCommand()
swa_istate=0;
sql=QString("update MATRICES set ")+
QString().sprintf("OUTPUTS=%d ",swa_outputs)+
"where (STATION_NAME=\""+RDEscapeString(rdstation->name())+"\")&&"+
"where (STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\")&&"+
QString().sprintf("(MATRIX=%d)",swa_matrix);
q=new RDSqlQuery(sql);
delete q;
@ -366,7 +367,7 @@ void SoftwareAuthority::DispatchCommand()
sql=QString().sprintf("select NUMBER from OUTPUTS where \
(STATION_NAME=\"%s\")&&\
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
swa_matrix,f0[0].toInt());
q=new RDSqlQuery(sql);
if(q->first()) {
@ -374,14 +375,14 @@ void SoftwareAuthority::DispatchCommand()
(STATION_NAME=\"%s\")&&\
(MATRIX=%d)&&(NUMBER=%d)",
(const char *)name,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
swa_matrix,f0[0].toInt());
}
else {
sql=QString().sprintf("insert into OUTPUTS set NAME=\"%s\",\
STATION_NAME=\"%s\",MATRIX=%d,NUMBER=%d",
(const char *)name,
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
swa_matrix,f0[0].toInt());
}
delete q;
@ -393,7 +394,7 @@ void SoftwareAuthority::DispatchCommand()
//
sql=QString("update MATRICES set ")+
QString().sprintf("GPIS=%d,GPOS=%d where ",swa_gpis,swa_gpos)+
"(STATION_NAME=\""+RDEscapeString(rdstation->name())+"\")&&"+
"(STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\")&&"+
QString().sprintf("(MATRIX=%d)",swa_matrix);
q=new RDSqlQuery(sql);
delete q;
@ -446,7 +447,7 @@ void SoftwareAuthority::ExecuteMacroCart(unsigned cartnum)
RDMacro rml;
rml.setRole(RDMacro::Cmd);
rml.setCommand(RDMacro::EX);
rml.setAddress(rdstation->address());
rml.setAddress(rda->station()->address());
rml.setEchoRequested(false);
rml.setArgQuantity(1);
rml.setArg(0,cartnum);

View File

@ -20,6 +20,7 @@
#include <syslog.h>
#include <rdapplication.h>
#include <rddb.h>
#include <rdescape_string.h>
@ -67,7 +68,7 @@ void Switcher::executeMacroCart(unsigned cartnum)
RDMacro rml;
rml.setRole(RDMacro::Cmd);
rml.setCommand(RDMacro::EX);
rml.setAddress(rdstation->address());
rml.setAddress(rda->station()->address());
rml.setEchoRequested(false);
rml.setArgQuantity(1);
rml.setArg(0,cartnum);

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the UNITY4000
//
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2003,2016-2018 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
@ -20,10 +20,11 @@
#include <stdlib.h>
#include <rdapplication.h>
#include <rddb.h>
#include <globals.h>
#include <unity4000.h>
#include "globals.h"
#include "unity4000.h"
Unity4000::Unity4000(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -43,7 +44,7 @@ Unity4000::Unity4000(RDMatrix *matrix,QObject *parent)
sql=QString().sprintf("select NUMBER,FEED_NAME,CHANNEL_MODE from INPUTS \
where STATION_NAME=\"%s\" && MATRIX=%d \
order by NUMBER",
(const char *)rdstation->name(),
(const char *)rda->station()->name(),
matrix->matrix());
q=new RDSqlQuery(sql);
q->first();
@ -60,7 +61,7 @@ Unity4000::Unity4000(RDMatrix *matrix,QObject *parent)
//
// Initialize the TTY Port
//
RDTty *tty=new RDTty(rdstation->name(),matrix->port(RDMatrix::Primary));
RDTty *tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary));
unity_device=new RDTTYDevice();
if(tty->active()) {
unity_device->setName(tty->port());

View File

@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the Logitek vGuest Protocol
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2018 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
@ -22,10 +22,10 @@
#include <qsignalmapper.h>
#include <rddb.h>
#include <globals.h>
#include <vguest.h>
#include <rdapplication.h>
#include "globals.h"
#include "vguest.h"
VGuest::VGuest(RDMatrix *matrix,QObject *parent)
: Switcher(matrix,parent)
@ -208,7 +208,7 @@ VGuest::VGuest(RDMatrix *matrix,QObject *parent)
//
for(int i=0;i<2;i++) {
if(vguest_porttype[i]==RDMatrix::TtyPort) {
tty=new RDTty(rdstation->name(),matrix->port((RDMatrix::Role)i));
tty=new RDTty(rda->station()->name(),matrix->port((RDMatrix::Role)i));
vguest_device[i]=new RDTTYDevice();
if(tty->active()) {
vguest_device[i]->setName(tty->port());
@ -806,7 +806,7 @@ void VGuest::ExecuteMacroCart(unsigned cartnum)
RDMacro rml;
rml.setRole(RDMacro::Cmd);
rml.setCommand(RDMacro::EX);
rml.setAddress(rdstation->address());
rml.setAddress(rda->station()->address());
rml.setEchoRequested(false);
rml.setArgQuantity(1);
rml.setArg(0,cartnum);

View File

@ -34,6 +34,7 @@ noinst_PROGRAMS = audio_convert_test\
audio_peaks_test\
datedecode_test\
log_unlink_test\
mcast_recv_test\
rdxml_parse_test\
reserve_carts_test\
sas_switch_torture\
@ -64,6 +65,10 @@ dist_log_unlink_test_SOURCES = log_unlink_test.cpp log_unlink_test.h
nodist_log_unlink_test_SOURCES = moc_log_unlink_test.cpp
log_unlink_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
dist_mcast_recv_test_SOURCES = mcast_recv_test.cpp mcast_recv_test.h
nodist_mcast_recv_test_SOURCES = moc_mcast_recv_test.cpp
mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
dist_rdxml_parse_test_SOURCES = rdxml_parse_test.cpp rdxml_parse_test.h
rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@

104
tests/mcast_recv_test.cpp Normal file
View File

@ -0,0 +1,104 @@
// mcast_recv_test.cpp
//
// Test the Rivendell multicast receiver routines
//
// (C) Copyright 2018 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 <stdint.h>
#include <stdlib.h>
#include <qapplication.h>
#include <qhostaddress.h>
#include <qstringlist.h>
#include <rdcmd_switch.h>
#include "mcast_recv_test.h"
MainObject::MainObject(QObject *parent)
: QObject(parent)
{
QHostAddress from_addr;
unsigned from_port=0;
bool ok=false;
RDCmdSwitch *cmd=
new RDCmdSwitch(qApp->argc(),qApp->argv(),"mcast_recv_test",
MCAST_RECV_TEST_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--from") {
QStringList f0=f0.split(":",cmd->value(i));
if(f0.size()!=2) {
fprintf(stderr,"mcast_recv_test: invalid argument to \"--from\"\n");
exit(1);
}
if(!from_addr.setAddress(f0[0])) {
fprintf(stderr,"mcast_recv_test: invalid address in \"--from\"\n");
exit(1);
}
from_port=f0[1].toUInt(&ok);
if(!ok) {
fprintf(stderr,"mcast_recv_test: invalid port in \"--from\"\n");
exit(1);
}
if((from_port==0)||(from_port>=65536)) {
fprintf(stderr,"mcast_recv_test: invalid port in \"--from\"\n");
exit(1);
}
cmd->setProcessed(i,true);
}
if(!cmd->processed(i)) {
fprintf(stderr,"mcast_recv_test: unknown option \"%s\"\n",
(const char *)cmd->value(i));
exit(256);
}
}
if(from_addr.isNull()) {
fprintf(stderr,"mcast_recv_test: you must specify a multicast address in \"--from\"\n");
exit(1);
}
if(from_port==0) {
fprintf(stderr,"mcast_recv_test: you must specify a UDP port in \"--from\"\n");
exit(1);
}
mcast_multicaster=new RDMulticaster(this);
connect(mcast_multicaster,
SIGNAL(received(const QString &,const QHostAddress &)),
this,SLOT(receivedData(const QString &,const QHostAddress &)));
if(!mcast_multicaster->bind(from_port)) {
fprintf(stderr,"mcast_recv_test: unable to bind port\n");
exit(1);
}
mcast_multicaster->subscribe(from_addr);
printf("listening for %s at %u\n",(const char *)from_addr.toString(),
0xFFFF&from_port);
}
void MainObject::receivedData(const QString &msg,const QHostAddress &src_addr)
{
printf("%15s: %s\n",(const char *)src_addr.toString(),
(const char *)msg);
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv,false);
new MainObject();
return a.exec();
}

44
tests/mcast_recv_test.h Normal file
View File

@ -0,0 +1,44 @@
// mcast_recv_test.h
//
// Test the Rivendell multicast receiver routines
//
// (C) Copyright 2018 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 MCAST_RECV_TEST_H
#define MCAST_RECV_TEST_H
#include <qobject.h>
#include <rdmulticaster.h>
#define MCAST_RECV_TEST_USAGE "[options]\n\nTest the Rivendell multicast receiver routines\n\nOptions are:\n--from=<mcast-addr>:<port>\n Subscribe to <mcast-addr> and listen on <port>.\n\n"
class MainObject : public QObject
{
Q_OBJECT;
public:
MainObject(QObject *parent=0);
private slots:
void receivedData(const QString &msg,const QHostAddress &src_addr);
private:
RDMulticaster *mcast_multicaster;
};
#endif // MCAST_RECV_TEST_H

View File

@ -259,6 +259,10 @@ void MainObject::Revert(int schema) const
case 275:
Revert275();
break;
case 276:
Revert276();
break;
}
}
@ -825,6 +829,19 @@ void MainObject::Revert275() const
}
void MainObject::Revert276() const
{
QString sql;
RDSqlQuery *q;
sql=QString("alter table SYSTEM drop column NOTIFICATION_ADDRESS");
q=new RDSqlQuery(sql,false);
delete q;
SetVersion(275);
}
int MainObject::GetVersion() const
{
QString sql;
@ -871,6 +888,7 @@ int MainObject::MapSchema(const QString &ver)
version_map["2.17"]=268;
version_map["2.18"]=272;
version_map["2.19"]=275;
version_map["2.20"]=276;
//
// Normalize String

View File

@ -71,6 +71,7 @@ class MainObject : public QObject
void Revert273() const;
void Revert274() const;
void Revert275() const;
void Revert276() const;
int GetVersion() const;
void SetVersion(int schema) const;
int MapSchema(const QString &ver);