mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Issue #15 Added CDataLinkDBus, an implementation for sharing state between processes via DBus
This commit is contained in:
66
src/blackmisc/sharedstate/dbus/dupleximpl.h
Normal file
66
src/blackmisc/sharedstate/dbus/dupleximpl.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 2020
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_SHAREDSTATE_DBUS_DUPLEXIMPL_H
|
||||
#define BLACKMISC_SHAREDSTATE_DBUS_DUPLEXIMPL_H
|
||||
|
||||
#include "blackmisc/sharedstate/dbus/duplex.h"
|
||||
#include <functional>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
class CIdentifier;
|
||||
class CDBusServer;
|
||||
|
||||
namespace SharedState
|
||||
{
|
||||
namespace DBus
|
||||
{
|
||||
class CHub;
|
||||
|
||||
/*!
|
||||
* Server side implementation of IDuplex. Receives messages from clients and forwards them to other clients via the CHub.
|
||||
* \ingroup SharedState
|
||||
*/
|
||||
class BLACKMISC_EXPORT CDuplex : public IDuplex
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKMISC_DUPLEX_INTERFACE)
|
||||
|
||||
public:
|
||||
//! Constructor.
|
||||
CDuplex(CHub *hub, const CIdentifier &client, CDBusServer *server, QObject *parent = nullptr);
|
||||
|
||||
//! Destructor.
|
||||
virtual ~CDuplex() override;
|
||||
|
||||
public slots:
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
virtual void postEvent(const QString &channel, const BlackMisc::CVariant ¶m) override;
|
||||
virtual void setSubscription(const QString &channel, const BlackMisc::CVariantList &filters) override;
|
||||
virtual void requestPeerSubscriptions() override;
|
||||
virtual void submitRequest(const QString &channel, const BlackMisc::CVariant ¶m, quint32 token) override;
|
||||
virtual void advertise(const QString &channel) override;
|
||||
virtual void withdraw(const QString &channel) override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
void requestPeerSubscriptions(const QString &channel);
|
||||
|
||||
CHub *m_hub = nullptr;
|
||||
QMap<QString, CVariantList> m_subscriptions;
|
||||
QSet<QString> m_handlingChannels;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user