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

## Detailed Description

(C) 2016 - 2021 KISTLER INSTRUMENTE AG, Winterthur, Switzerland (C) 2016 - 2024 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

## createLightWeightProxy() [1/2]

std::unique_ptr< sdbus::IProxy > sdbus::createLightWeightProxy | ( | ServiceName | destination,
|  | ObjectPath | objectPath )

nodiscard

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

Does the same thing as createProxy(ServiceName, ObjectPath, dont_run_event_loop_thread_t);

## createLightWeightProxy() [2/2]

std::unique_ptr< sdbus::IProxy > sdbus::createLightWeightProxy | ( | std::unique_ptr< sdbus::IConnection > && | connection,
|  | ServiceName | destination,
|  | ObjectPath | objectPath )

nodiscard

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

Does the same thing as createProxy(std::unique_ptr<sdbus::IConnection>&&, ServiceName, ObjectPath, dont_run_event_loop_thread_t);

## createProxy() [1/5]

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

nodiscard

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");
sdbus::createProxy
std::unique_ptr< sdbus::IProxy > createProxy(sdbus::IConnection &connection, ServiceName destination, ObjectPath objectPath)
Creates a proxy object for a specific remote D-Bus object.

## createProxy() [2/5]

std::unique_ptr< sdbus::IProxy > sdbus::createProxy | ( | ServiceName | destination,
|  | ObjectPath | objectPath )

nodiscard

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 | ( | ServiceName | destination,
|  | ObjectPath | objectPath,
|  | dont_run_event_loop_thread_t | )

nodiscard

Creates a light-weight 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,
|  | ServiceName | destination,
|  | ObjectPath | objectPath )

nodiscard

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,
|  | ServiceName | destination,
|  | ObjectPath | objectPath,
|  | dont_run_event_loop_thread_t | )

nodiscard

Creates a light-weight 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);