2017-08-12 Fred Gleason <fredg@paravelsystems.com>

* Implemented a driver for WheatNet SLIO devices.
This commit is contained in:
Fred Gleason
2017-08-12 16:50:49 -04:00
parent 98e9c89dec
commit 6a174ae612
8 changed files with 489 additions and 7 deletions

81
ripcd/wheatnet_slio.h Normal file
View File

@@ -0,0 +1,81 @@
// wheatnet_slio.h
//
// A Rivendell switcher driver for Wheatnet SLIO devices
//
// (C) Copyright 2017 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 WHEATNET_SLIO_H
#define WHEATNET_SLIO_H
#include <vector>
#include <qsignalmapper.h>
#include <qsocket.h>
#include <qtimer.h>
#include <rd.h>
#include <rdmatrix.h>
#include <rdmacro.h>
#include <switcher.h>
#define WHEATNET_SLIO_POLL_INTERVAL 100
#define WHEATNET_SLIO_WATCHDOG_INTERVAL 1000
class WheatnetSlio : public Switcher
{
Q_OBJECT
public:
WheatnetSlio(RDMatrix *matrix,QObject *parent=0);
~WheatnetSlio();
RDMatrix::Type type();
unsigned gpiQuantity();
unsigned gpoQuantity();
bool primaryTtyActive();
bool secondaryTtyActive();
void processCommand(RDMacro *cmd);
private slots:
void connectedData();
void readyReadData();
void errorData(int err);
void pollInputs();
void resetStateData(int line);
void watchdogData();
private:
void CheckLineEntry(int line);
void ProcessSys(const QString &cmd);
void ProcessSlio(int chan,QString &cmd);
void ProcessCommand(const QString &cmd);
void SendCommand(const QString &cmd);
QSocket *slio_socket;
QTimer *slio_poll_timer;
QTimer *slio_watchdog_timer;
bool slio_watchdog_active;
QHostAddress slio_ip_address;
uint16_t slio_ip_port;
int slio_gpios;
QString slio_accum;
std::vector<bool> slio_gpi_states;
QSignalMapper *slio_reset_mapper;
std::vector<QTimer *> slio_reset_timers;
std::vector<bool> slio_reset_states;
};
#endif // WHEATNET_SLIO_H