8 namespace swift::misc::shared_state::dbus
12 connect(
this, &IDuplex::replyReceived,
this, [
this](
const QString &,
const CVariant ¶m, quint32 token) {
13 const auto it = m_submittedRequests.find(token);
14 if (it == m_submittedRequests.end()) { return; }
16 m_submittedRequests.erase(it);
22 const auto token = getToken();
23 auto future = m_submittedRequests.insert(token, {})->future();
30 const auto token = getToken();
31 auto future = m_receivedRequests.insert(token, {})->future();
38 const auto it = m_receivedRequests.find(token);
39 if (it == m_receivedRequests.end()) {
return; }
41 m_receivedRequests.erase(it);
44 quint32 IDuplex::getToken() {
return m_token++; }
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
IDuplex(QObject *parent=nullptr)
Constructor.
void requestReceived(const QString &channel, const swift::misc::CVariant ¶m, quint32 token, QPrivateSignal)
Server has submitted a request to be handled by the client.
QFuture< CVariant > receiveRequest(const QString &channel, const swift::misc::CVariant ¶m)
Server submits a request to the client. Reply is returned via a future.
virtual void reply(const swift::misc::CVariant ¶m, quint32 token)
Client replies to a submitted request.
QFuture< CVariant > submitRequest(const QString &channel, const swift::misc::CVariant ¶m)
Client submits a request to the server. Reply is returned via a future.