mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-25 16:58:04 +02:00
2020-08-05 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDDataPacer' class. * Modified the GVC7000 switcher driver to insert 50 mS pauses between protocol commands. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
e80533c0ec
commit
50a80d0a61
@ -19920,3 +19920,7 @@
|
|||||||
* Incremented the package version to 3.4.0int1.
|
* Incremented the package version to 3.4.0int1.
|
||||||
2020-07-21 Fred Gleason <fredg@paravelsystems.com>
|
2020-07-21 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Incremented the package version to 3.4.1.
|
* Incremented the package version to 3.4.1.
|
||||||
|
2020-08-05 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added an 'RDDataPacer' class.
|
||||||
|
* Modified the GVC7000 switcher driver to insert 50 mS pauses
|
||||||
|
between protocol commands.
|
||||||
|
@ -106,6 +106,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
|||||||
rddatepicker.cpp rddatepicker.h\
|
rddatepicker.cpp rddatepicker.h\
|
||||||
rddb.h rddb.cpp\
|
rddb.h rddb.cpp\
|
||||||
rddbheartbeat.cpp rddbheartbeat.h\
|
rddbheartbeat.cpp rddbheartbeat.h\
|
||||||
|
rddatapacer.cpp rddatapacer.h\
|
||||||
rddatetime.cpp rddatetime.h\
|
rddatetime.cpp rddatetime.h\
|
||||||
rddebug.cpp rddebug.h\
|
rddebug.cpp rddebug.h\
|
||||||
rddeck.cpp rddeck.h\
|
rddeck.cpp rddeck.h\
|
||||||
@ -270,6 +271,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
|||||||
moc_rdcueedit.cpp\
|
moc_rdcueedit.cpp\
|
||||||
moc_rdcueeditdialog.cpp\
|
moc_rdcueeditdialog.cpp\
|
||||||
moc_rdcut_dialog.cpp\
|
moc_rdcut_dialog.cpp\
|
||||||
|
moc_rddatapacer.cpp\
|
||||||
moc_rddatedialog.cpp\
|
moc_rddatedialog.cpp\
|
||||||
moc_rddatepicker.cpp\
|
moc_rddatepicker.cpp\
|
||||||
moc_rddbheartbeat.cpp\
|
moc_rddbheartbeat.cpp\
|
||||||
|
@ -71,6 +71,7 @@ SOURCES += rdcueeditdialog.cpp
|
|||||||
SOURCES += rdcut.cpp
|
SOURCES += rdcut.cpp
|
||||||
SOURCES += rdcut_path.cpp
|
SOURCES += rdcut_path.cpp
|
||||||
SOURCES += rdcut_dialog.cpp
|
SOURCES += rdcut_dialog.cpp
|
||||||
|
SOURCES += rddatapacer.cpp
|
||||||
SOURCES += rddatedialog.cpp
|
SOURCES += rddatedialog.cpp
|
||||||
SOURCES += rddatedecode.cpp
|
SOURCES += rddatedecode.cpp
|
||||||
SOURCES += rddatepicker.cpp
|
SOURCES += rddatepicker.cpp
|
||||||
@ -194,6 +195,7 @@ HEADERS += rdcartdrag.h
|
|||||||
HEADERS += rdcatch_connect.h
|
HEADERS += rdcatch_connect.h
|
||||||
HEADERS += rdcddblookup.h
|
HEADERS += rdcddblookup.h
|
||||||
HEADERS += rdcdplayer.h
|
HEADERS += rdcdplayer.h
|
||||||
|
HEADERS += rddatapacer.h
|
||||||
HEADERS += rddiscrecord.h
|
HEADERS += rddiscrecord.h
|
||||||
HEADERS += rddisclookup.h
|
HEADERS += rddisclookup.h
|
||||||
HEADERS += rdcheck_version.h
|
HEADERS += rdcheck_version.h
|
||||||
|
80
lib/rddatapacer.cpp
Normal file
80
lib/rddatapacer.cpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// rddatapacer.cpp
|
||||||
|
//
|
||||||
|
// Pace a stream of data messages.
|
||||||
|
//
|
||||||
|
// (C) Copyright 2020 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 "rddatapacer.h"
|
||||||
|
|
||||||
|
RDDataPacer::RDDataPacer(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
d_pace_interval=RDDATAPACER_DEFAULT_PACE_INTERVAL;
|
||||||
|
|
||||||
|
d_timer=new QTimer(this);
|
||||||
|
d_timer->setSingleShot(true);
|
||||||
|
connect(d_timer,SIGNAL(timeout()),this,SLOT(timeoutData()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RDDataPacer::~RDDataPacer()
|
||||||
|
{
|
||||||
|
delete d_timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RDDataPacer::paceInterval() const
|
||||||
|
{
|
||||||
|
return d_pace_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDDataPacer::setPaceInterval(int msecs)
|
||||||
|
{
|
||||||
|
d_pace_interval=msecs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDDataPacer::send(const QByteArray &data)
|
||||||
|
{
|
||||||
|
if(d_timer->isActive()) {
|
||||||
|
//
|
||||||
|
// Queue it up
|
||||||
|
//
|
||||||
|
d_data_queue.enqueue(data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
// Wake up
|
||||||
|
//
|
||||||
|
emit dataSent(data);
|
||||||
|
d_timer->start(d_pace_interval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDDataPacer::timeoutData()
|
||||||
|
{
|
||||||
|
if(d_data_queue.isEmpty()) {
|
||||||
|
//
|
||||||
|
// Nothing to do, go to sleep
|
||||||
|
//
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit dataSent(d_data_queue.dequeue());
|
||||||
|
d_timer->start(d_pace_interval);
|
||||||
|
}
|
56
lib/rddatapacer.h
Normal file
56
lib/rddatapacer.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// rddatapacer.h
|
||||||
|
//
|
||||||
|
// Pace a stream of data messages.
|
||||||
|
//
|
||||||
|
// (C) Copyright 2020 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 RDDATAPACER_H
|
||||||
|
#define RDDATAPACER_H
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQueue>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#define RDDATAPACER_DEFAULT_PACE_INTERVAL 100
|
||||||
|
|
||||||
|
class RDDataPacer : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
public:
|
||||||
|
RDDataPacer(QObject *parent=0);
|
||||||
|
~RDDataPacer();
|
||||||
|
int paceInterval() const;
|
||||||
|
void setPaceInterval(int msecs);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dataSent(const QByteArray &data);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void send(const QByteArray &data);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void timeoutData();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QQueue<QByteArray> d_data_queue;
|
||||||
|
QTimer *d_timer;
|
||||||
|
int d_pace_interval;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // RDDATAPACER_H
|
@ -54,6 +54,14 @@ Gvc7000::Gvc7000(RDMatrix *matrix,QObject *parent)
|
|||||||
gvc_reconnect_timer->setSingleShot(true);
|
gvc_reconnect_timer->setSingleShot(true);
|
||||||
connect(gvc_reconnect_timer,SIGNAL(timeout()),this,SLOT(ipConnect()));
|
connect(gvc_reconnect_timer,SIGNAL(timeout()),this,SLOT(ipConnect()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Data Pacer
|
||||||
|
//
|
||||||
|
gvc_pacer=new RDDataPacer(this);
|
||||||
|
gvc_pacer->setPaceInterval(10);
|
||||||
|
connect(gvc_pacer,SIGNAL(dataSent(const QByteArray &)),
|
||||||
|
this,SLOT(sendCommandData(const QByteArray &)));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the connection
|
// Initialize the connection
|
||||||
//
|
//
|
||||||
@ -106,7 +114,7 @@ void Gvc7000::processCommand(RDMacro *cmd)
|
|||||||
emit rmlEcho(cmd);
|
emit rmlEcho(cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendCommand(ToSeries7000Native(QString().sprintf("TI,%04X,%04X",cmd->arg(2).toInt()-1,cmd->arg(1).toInt()-1)));
|
gvc_pacer->send(ToSeries7000Native(QString().sprintf("TI,%04X,%04X",cmd->arg(2).toInt()-1,cmd->arg(1).toInt()-1)).toAscii());
|
||||||
cmd->acknowledge(true);
|
cmd->acknowledge(true);
|
||||||
emit rmlEcho(cmd);
|
emit rmlEcho(cmd);
|
||||||
break;
|
break;
|
||||||
@ -127,7 +135,7 @@ void Gvc7000::ipConnect()
|
|||||||
|
|
||||||
void Gvc7000::keepaliveData()
|
void Gvc7000::keepaliveData()
|
||||||
{
|
{
|
||||||
SendCommand(ToSeries7000Native("QJ"));
|
gvc_pacer->send(ToSeries7000Native("QJ").toAscii());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,12 +185,19 @@ void Gvc7000::errorData(QAbstractSocket::SocketError err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Gvc7000::sendCommandData(const QByteArray &data)
|
||||||
|
{
|
||||||
|
syslog(LOG_DEBUG,"gvc7000 sending \"%s\"",data.constData());
|
||||||
|
gvc_socket->write(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void Gvc7000::SendCommand(const QString &str)
|
void Gvc7000::SendCommand(const QString &str)
|
||||||
{
|
{
|
||||||
syslog(LOG_DEBUG,"gvc7000 sending \"%s\"",(const char *)str.toAscii());
|
syslog(LOG_DEBUG,"gvc7000 sending \"%s\"",(const char *)str.toAscii());
|
||||||
gvc_socket->write(str.toAscii());
|
gvc_socket->write(str.toAscii());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
QString Gvc7000::ToSeries7000Native(const QString &str) const
|
QString Gvc7000::ToSeries7000Native(const QString &str) const
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
|
||||||
#include <rd.h>
|
#include <rd.h>
|
||||||
|
#include <rddatapacer.h>
|
||||||
#include <rdmatrix.h>
|
#include <rdmatrix.h>
|
||||||
#include <rdmacro.h>
|
#include <rdmacro.h>
|
||||||
|
|
||||||
@ -52,11 +53,12 @@ class Gvc7000 : public Switcher
|
|||||||
void connectedData();
|
void connectedData();
|
||||||
void disconnectedData();
|
void disconnectedData();
|
||||||
void errorData(QAbstractSocket::SocketError err);
|
void errorData(QAbstractSocket::SocketError err);
|
||||||
|
void sendCommandData(const QByteArray &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SendCommand(const QString &str);
|
|
||||||
QString ToSeries7000Native(const QString &str) const;
|
QString ToSeries7000Native(const QString &str) const;
|
||||||
QTcpSocket *gvc_socket;
|
QTcpSocket *gvc_socket;
|
||||||
|
RDDataPacer *gvc_pacer;
|
||||||
QHostAddress gvc_ipaddress;
|
QHostAddress gvc_ipaddress;
|
||||||
int gvc_matrix;
|
int gvc_matrix;
|
||||||
int gvc_ipport;
|
int gvc_ipport;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user