2020-02-17 Fred Gleason <fredg@paravelsystems.com>

* Removed Q3Socket dependency from the Software Authority switcher
	driver.
This commit is contained in:
Fred Gleason 2020-02-17 09:34:18 -05:00
parent f45bd74bb4
commit 31661dab8a
3 changed files with 33 additions and 28 deletions

View File

@ -19623,3 +19623,6 @@
driver. driver.
* Removed Q3Socket dependency from the WheatNet LIO switcher * Removed Q3Socket dependency from the WheatNet LIO switcher
driver. driver.
2020-02-17 Fred Gleason <fredg@paravelsystems.com>
* Removed Q3Socket dependency from the Software Authority switcher
driver.

View File

@ -2,7 +2,7 @@
// //
// A Rivendell switcher driver for systems using Software Authority Protocol // A Rivendell switcher driver for systems using Software Authority Protocol
// //
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -61,13 +61,14 @@ SoftwareAuthority::SoftwareAuthority(RDMatrix *matrix,QObject *parent)
// //
// Initialize the connection // Initialize the connection
// //
swa_socket=new Q3Socket(this); swa_socket=new QTcpSocket(this);
connect(swa_socket,SIGNAL(connected()),this,SLOT(connectedData())); connect(swa_socket,SIGNAL(connected()),this,SLOT(connectedData()));
connect(swa_socket,SIGNAL(connectionClosed()), connect(swa_socket,SIGNAL(connectionClosed()),
this,SLOT(connectionClosedData())); this,SLOT(connectionClosedData()));
connect(swa_socket,SIGNAL(readyRead()), connect(swa_socket,SIGNAL(readyRead()),
this,SLOT(readyReadData())); this,SLOT(readyReadData()));
connect(swa_socket,SIGNAL(error(int)),this,SLOT(errorData(int))); connect(swa_socket,SIGNAL(error(QAbstractSocket::SocketError)),
this,SLOT(errorData(QAbstractSocket::SocketError)));
ipConnect(); ipConnect();
} }
@ -203,10 +204,10 @@ void SoftwareAuthority::readyReadData()
} }
void SoftwareAuthority::errorData(int err) void SoftwareAuthority::errorData(QAbstractSocket::SocketError err)
{ {
switch((Q3Socket::Error)err) { switch(err) {
case Q3Socket::ErrConnectionRefused: case QAbstractSocket::ConnectionRefusedError:
rda->syslog(LOG_WARNING, rda->syslog(LOG_WARNING,
"connection to SoftwareAuthority device at %s:%d refused, attempting reconnect", "connection to SoftwareAuthority device at %s:%d refused, attempting reconnect",
(const char *)swa_ipaddress.toString().toUtf8(), (const char *)swa_ipaddress.toString().toUtf8(),
@ -214,16 +215,17 @@ void SoftwareAuthority::errorData(int err)
swa_reconnect_timer->start(SWAUTHORITY_RECONNECT_INTERVAL,true); swa_reconnect_timer->start(SWAUTHORITY_RECONNECT_INTERVAL,true);
break; break;
case Q3Socket::ErrHostNotFound: case QAbstractSocket::HostNotFoundError:
rda->syslog(LOG_WARNING, rda->syslog(LOG_WARNING,
"error on connection to SoftwareAuthority device at %s:%d: Host Not Found", "error on connection to SoftwareAuthority device at %s:%d: Host Not Found",
(const char *)swa_ipaddress.toString().toUtf8(), (const char *)swa_ipaddress.toString().toUtf8(),
swa_ipport); swa_ipport);
break; break;
case Q3Socket::ErrSocketRead: default:
rda->syslog(LOG_WARNING, rda->syslog(LOG_WARNING,
"error on connection to SoftwareAuthority device at %s:%d: Socket Read Error", "error %d on connection to SoftwareAuthority device at %s:%d",
err,
(const char *)swa_ipaddress.toString().toUtf8(), (const char *)swa_ipaddress.toString().toUtf8(),
swa_ipport); swa_ipport);
break; break;

View File

@ -2,7 +2,7 @@
// //
// A Rivendell switcher driver for systems using Software Authority Protocol // A Rivendell switcher driver for systems using Software Authority Protocol
// //
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -24,8 +24,8 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <q3socket.h>
#include <qhostaddress.h> #include <qhostaddress.h>
#include <qtcpsocket.h>
#include <qtimer.h> #include <qtimer.h>
#include <rd.h> #include <rd.h>
@ -54,7 +54,7 @@ class SoftwareAuthority : public Switcher
void connectedData(); void connectedData();
void connectionClosedData(); void connectionClosedData();
void readyReadData(); void readyReadData();
void errorData(int err); void errorData(QAbstractSocket::SocketError err);
private: private:
void SendCommand(const char *str); void SendCommand(const char *str);
@ -62,7 +62,7 @@ class SoftwareAuthority : public Switcher
void ExecuteMacroCart(unsigned cartnum); void ExecuteMacroCart(unsigned cartnum);
QString PrettifyCommand(const char *cmd) const; QString PrettifyCommand(const char *cmd) const;
QString BundleString(int offset,bool state); QString BundleString(int offset,bool state);
Q3Socket *swa_socket; QTcpSocket *swa_socket;
char swa_buffer[SWAUTHORITY_MAX_LENGTH]; char swa_buffer[SWAUTHORITY_MAX_LENGTH];
unsigned swa_ptr; unsigned swa_ptr;
QHostAddress swa_ipaddress; QHostAddress swa_ipaddress;