sdbus-c++: include/sdbus-c++/IProxy.h File Reference

sdbus-c++ 1.4.0 High-level C++ D-Bus library based on systemd D-Bus implementation

Loading...
Searching...
No Matches
Classes | Functions
IProxy.h File Reference
`#include <sdbus-c++/ConvenienceApiClasses.h>`
`#include <sdbus-c++/TypeTraits.h>`
`#include <string>`
`#include <memory>`
`#include <functional>`
`#include <chrono>`
`#include <future>`
`#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::IProxy > | sdbus::createProxy (sdbus::IConnection &connection, std::string destination, std::string objectPath)
| Creates a proxy object for a specific remote D-Bus object.
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.
std::unique_ptr< sdbus::IProxy > | sdbus::createProxy (std::unique_ptr< sdbus::IConnection > &&connection, std::string destination, std::string objectPath, dont_run_event_loop_thread_t)
| Creates a proxy object for a specific remote D-Bus object.
std::unique_ptr< sdbus::IProxy > | sdbus::createProxy (std::string destination, std::string objectPath)
| Creates a proxy object for a specific remote D-Bus object.
std::unique_ptr< sdbus::IProxy > | sdbus::createProxy (std::string destination, std::string objectPath, dont_run_event_loop_thread_t)
| Creates a proxy object for a specific remote D-Bus object.

## 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/5]

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] | connection | D-Bus connection to be used by the proxy object
  [in] | destination | Bus name that provides the remote D-Bus object
  [in] | objectPath | Path 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.

The destination parameter may be an empty string (useful e.g. in case of direct D-Bus connections to a custom server bus).

Code example:

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

## ◆ createProxy() [2/5]

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] | destination | Bus name that provides the remote D-Bus object
  [in] | objectPath | Path 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 an event 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/5]

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

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

Parameters

  [in] | destination | Bus name that provides the remote D-Bus object
  [in] | objectPath | Path 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, but it will not start an event loop thread. This is cheap construction and is suitable for short-lived proxies created just to execute simple synchronous D-Bus calls and then destroyed. Such blocking request-reply calls will work without an event loop (but signals, async calls, etc. won't).

Code example:

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

## ◆ createProxy() [4/5]

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] | connection | D-Bus connection to be used by the proxy object
  [in] | destination | Bus name that provides the remote D-Bus object
  [in] | objectPath | Path 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.

The destination parameter may be an empty string (useful e.g. in case of direct D-Bus connections to a custom server bus).

Code example:

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

## ◆ createProxy() [5/5]

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

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

Parameters

  [in] | connection | D-Bus connection to be used by the proxy object
  [in] | destination | Bus name that provides the remote D-Bus object
  [in] | objectPath | Path 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. The Object proxy becomes an exclusive owner of this connection, but will not start an event loop thread on this connection. This is cheap construction and is suitable for short-lived proxies created just to execute simple synchronous D-Bus calls and then destroyed. Such blocking request-reply calls will work without an event loop (but signals, async calls, etc. won't).

The destination parameter may be an empty string (useful e.g. in case of direct D-Bus connections to a custom server bus).

Code example:

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