mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
2019-01-10 Fred Gleason <fredg@paravelsystems.com>
* Refactored dropbox instance management to use multicast notifications.
This commit is contained in:
@@ -59,6 +59,7 @@ dist_ripcd_SOURCES = acu1p.cpp acu1p.h\
|
||||
local_audio.cpp local_audio.h\
|
||||
local_gpio.cpp local_gpio.h\
|
||||
local_macros.cpp\
|
||||
local_notifications.cpp\
|
||||
loaddrivers.cpp\
|
||||
modbus.cpp modbus.h\
|
||||
modemlines.cpp modemlines.h\
|
||||
|
38
ripcd/local_notifications.cpp
Normal file
38
ripcd/local_notifications.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// local_notifications.cpp
|
||||
//
|
||||
// Process local notifications for ripcd(8)
|
||||
//
|
||||
// (C) Copyright 2002-2019 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 <signal.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include "ripcd.h"
|
||||
|
||||
void MainObject::RunLocalNotifications(RDNotification *notify)
|
||||
{
|
||||
if((notify->type()==RDNotification::DropboxType)&&
|
||||
(notify->id().toString()==rda->config()->stationName())) {
|
||||
pid_t pid=RDGetPid(QString(RD_PID_DIR)+"/rdservice.pid");
|
||||
if(pid>0) {
|
||||
kill(pid,SIGUSR1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -229,13 +229,18 @@ void MainObject::notificationReceivedData(const QString &msg,
|
||||
const QHostAddress &addr)
|
||||
{
|
||||
RDNotification *notify=new RDNotification();
|
||||
|
||||
syslog(LOG_NOTICE,"recv: %s\n",(const char *)msg.toUtf8());
|
||||
|
||||
if(!notify->read(msg)) {
|
||||
LogLine(RDConfig::LogWarning,
|
||||
"Invalid notification received from "+addr.toString());
|
||||
delete notify;
|
||||
return;
|
||||
}
|
||||
RunLocalNotifications(notify);
|
||||
BroadcastCommand("ON "+msg+"!");
|
||||
|
||||
delete notify;
|
||||
}
|
||||
|
||||
@@ -512,6 +517,7 @@ bool MainObject::DispatchCommand(RipcdConnection *conn)
|
||||
delete notify;
|
||||
return true;
|
||||
}
|
||||
RunLocalNotifications(notify);
|
||||
BroadcastCommand("ON "+msg+"!",conn->id());
|
||||
ripcd_notification_mcaster->
|
||||
send(msg,rda->system()->notificationAddress(),RD_NOTIFICATION_PORT);
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <qtimer.h>
|
||||
#include <qudpsocket.h>
|
||||
|
||||
#include <rdnotification.h>
|
||||
#include <rdsocket.h>
|
||||
#include <rdttydevice.h>
|
||||
#include <rdcodetrap.h>
|
||||
@@ -90,6 +91,7 @@ class MainObject : public QObject
|
||||
void ReadRmlSocket(QUdpSocket *sock,RDMacro::Role role,bool echo);
|
||||
QString StripPoint(QString);
|
||||
void LoadLocalMacros();
|
||||
void RunLocalNotifications(RDNotification *notify);
|
||||
void RunLocalMacros(RDMacro *rml);
|
||||
void LoadGpiTable();
|
||||
void SendGpi(int ch,int matrix);
|
||||
|
Reference in New Issue
Block a user