sdbus-c++ 1.2.0
High-level C++ D-Bus library based on systemd D-Bus implementation
IProxy.h File Reference
#include <sdbus-c++/ConvenienceApiClasses.h>
#include <string>
#include <memory>
#include <functional>
#include <chrono>
#include <sdbus-c++/ConvenienceApiClasses.inl>

Go to the source code of this file.

Classes

class  sdbus::IProxy
 
class  sdbus::PendingAsyncCall
 

Functions

std::unique_ptr< sdbus::IProxysdbus::createProxy (sdbus::IConnection &connection, std::string destination, std::string objectPath)
 Creates a proxy object for a specific remote D-Bus object. More...
 
std::unique_ptr< sdbus::IProxysdbus::createProxy (std::unique_ptr< sdbus::IConnection > &&connection, std::string destination, std::string objectPath)
 Creates a proxy object for a specific remote D-Bus object. More...
 
std::unique_ptr< sdbus::IProxysdbus::createProxy (std::string destination, std::string objectPath)
 Creates a proxy object for a specific remote D-Bus object. More...
 

Detailed Description

(C) 2016 - 2021 KISTLER INSTRUMENTE AG, Winterthur, Switzerland (C) 2016 - 2022 Stanislav Angelovic stani.nosp@m.slav.nosp@m..ange.nosp@m.lovi.nosp@m.c@pro.nosp@m.tonm.nosp@m.ail.c.nosp@m.om

Created on: Nov 8, 2016 Project: sdbus-c++ Description: High-level D-Bus IPC C++ library based on sd-bus

This file is part of sdbus-c++.

sdbus-c++ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.

sdbus-c++ 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with sdbus-c++. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ createProxy() [1/3]

std::unique_ptr< sdbus::IProxy > sdbus::createProxy ( sdbus::IConnection connection,
std::string  destination,
std::string  objectPath 
)

Creates a proxy object for a specific remote D-Bus object.

Parameters
[in]connectionD-Bus connection to be used by the proxy object
[in]destinationBus name that provides the remote D-Bus object
[in]objectPathPath of the remote D-Bus object
Returns
Pointer to the proxy object instance

The provided connection will be used by the proxy to issue calls against the object, and signals, if any, will be subscribed to on this connection. The caller still remains the owner of the connection (the proxy just keeps a reference to it), and should make sure that an I/O event loop is running on that connection, so the proxy may receive incoming signals and asynchronous method replies.

Code example:

auto proxy = sdbus::createProxy(connection, "com.kistler.foo", "/com/kistler/foo");
std::unique_ptr< sdbus::IProxy > createProxy(sdbus::IConnection &connection, std::string destination, std::string objectPath)
Creates a proxy object for a specific remote D-Bus object.

◆ createProxy() [2/3]

std::unique_ptr< sdbus::IProxy > sdbus::createProxy ( std::string  destination,
std::string  objectPath 
)

Creates a proxy object for a specific remote D-Bus object.

Parameters
[in]destinationBus name that provides the remote D-Bus object
[in]objectPathPath of the remote D-Bus object
Returns
Pointer to the object proxy instance

No D-Bus connection is provided here, so the object proxy will create and manage his own connection, and will automatically start a procesing loop upon that connection in a separate internal thread. Handlers for incoming signals and asynchronous method replies will be executed in the context of that thread.

Code example:

auto proxy = sdbus::createProxy("com.kistler.foo", "/com/kistler/foo");

◆ createProxy() [3/3]

std::unique_ptr< sdbus::IProxy > sdbus::createProxy ( std::unique_ptr< sdbus::IConnection > &&  connection,
std::string  destination,
std::string  objectPath 
)

Creates a proxy object for a specific remote D-Bus object.

Parameters
[in]connectionD-Bus connection to be used by the proxy object
[in]destinationBus name that provides the remote D-Bus object
[in]objectPathPath of the remote D-Bus object
Returns
Pointer to the object proxy instance

The provided connection will be used by the proxy to issue calls against the object, and signals, if any, will be subscribed to on this connection. The Object proxy becomes an exclusive owner of this connection, and will automatically start a procesing loop upon that connection in a separate internal thread. Handlers for incoming signals and asynchronous method replies will be executed in the context of that thread.

Code example:

auto proxy = sdbus::createProxy(std::move(connection), "com.kistler.foo", "/com/kistler/foo");