Commit Graph

73 Commits

Author SHA1 Message Date
Stanislav Angelovič
c8fb8caeb9 docs: add v2 migration notes to the tutorial 2024-02-16 18:59:19 +01:00
Stanislav Angelovič
fbb4a23e62 refactor: rename connection creation methods (#406)
This PR makes things around connection factories a little more consistent and more intuitive:

    * createConnection() has been removed. One shall call more expressive createSystemConnection() instead to get a connection to the system bus.
    * createDefaultBusConnection() has been renamed to createBusConnection(), so as not to be confused with libsystemd's default_bus, which is a different thing (a reusable thread-local bus).

Proxies still by default call createBusConnection() to get a connection when the connection is not provided explicitly by the caller, but now createBusConnection() does a different thing, so now the proxies connect to either session bus or system bus depending on the context (as opposed to always to system bus like before).
2024-02-16 18:57:51 +01:00
Stanislav Angelovič
e50ce7c37f chore: rename COMPONENTs in CMake (#402) 2024-02-10 20:30:22 +01:00
Stanislav Angelovič
10f701df74 refactor: rename and re-organize CMake options (#401)
This improves usability of sdbus-c++ in downstream CMake projects. CMake options now have `SDBUSCPP_` prefix so potential conflicts with downstream options/variables are minimized. Also, all configurable options and variables are placed in a single place in the root CMake file.
2024-02-10 20:20:42 +01:00
Stanislav Angelovič
94b8058dc5 refactor: use optional for passing potential call errors (#396)
This switches from a raw pointer to std::optional type to pass prospective call errors to the client (using std::optional was not possible years back when sdbus-c++ was based on C++14). This makes the API a little clearer, safer, idiomatically more expressive, and removes potential confusion associated with raw pointers (like ownership, lifetime questions, etc.).
2024-01-10 15:43:37 +01:00
Stanislav Angelovic
fe773958d1 refactor: rename request_slot tag to return_slot 2023-12-30 21:11:02 +01:00
Stanislav Angelovič
bdd0bc2c27 refactor: improve Proxy signal subscription (#389)
This makes D-Bus proxy signal registration more flexible, more dynamic, and less error-prone since no `finishRegistration()` call is needed. A proxy can register to a signal at any time during its lifetime, and can unregister freely by simply destroying the associated slot.
2023-12-30 21:11:02 +01:00
Stanislav Angelovič
e3040c0998 refactor: improve Object vtable registration (#388)
This improves the D-Bus object API registration/unregistration by making it more flexible, more dynamic, closer to sd-bus API design but still on high abstraction level, and -- most importantly -- less error-prone since no `finishRegistration()` call is needed anymore.
2023-12-30 21:11:02 +01:00
Stanislav Angelovič
071e38c9de refactor: let callbacks take message objects by value (#367)
Signatures of callbacks async_reply_handler, signal_handler, message_handler and property_set_callback were modified to take input message objects by value, as opposed to non-const ref.

The callee assumes ownership of the message. This API is more idiomatic, more expressive, cleaner and safer. Move semantics is used to pass messages to the callback handlers. In some cases, this also improves performance.
2023-12-30 21:11:02 +01:00
Stanislav Angelovič
e95024192c feat: introduce sd-event integration 2023-12-30 21:11:02 +01:00
Stanislav Angelovic
0f99724449 refactor: simplify async D-Bus connection handling 2023-12-30 21:10:51 +01:00
Stanislav Angelovič
e2b3e98374 refactor: improve handling of exceptions from callback handlers (#375)
* Catch and process all exceptions (not just sdbus::Error) from callback handlers
* Unify handling of exceptions from all types of callbacks -- always set sd_bus_error and return a negative result number in case of exception

Although libsystemd logs (with DEBUG severity) all errors from such callback handlers (except method callback handler), it seems to be out of our control. One of handy sdbus-c++ features could be the ability for clients to install a log callback, which sdbus-c++ would call in case of exceptions flying from callback handlers. In case something doesn't work for clients (especially novices), they can first look into these logs.

This may be handy in common situations like ignored signals on client side because of the inadvertent mismatch between real signal signature and signal handler signature. Like here: #373. (Although in this specific case of signals, there is a solution with an additional const sdbus::Error* argument that would reveal such an error.)
2023-11-03 18:03:01 +01:00
Stanislav Angelovič
9490b3351f feat: add support for async registration of matches (#374) 2023-11-03 17:57:52 +01:00
Stanislav Angelovič
b7b454ba38 doc: add section on bus connection factories 2023-10-16 19:28:27 +02:00
Stanislav Angelovič
f420b216aa docs: update documentation 2023-10-16 15:30:23 +02:00
Stanislav Angelovič
aac7e590ea docs: add recommendation on destroying direct D-Bus connections 2023-10-10 19:15:21 +02:00
Maksim Fedyarov
cfb71bd6cf feat: add support for direct connections (#350)
* feat: add support for direct connections

* refactor: simplify a bit, change comments, extend tests

* fix: compiler warning about unused variable

* docs: add section on direct connections to the tutorial

---------

Co-authored-by: Maksim Fedyarov <m.fedyarov@omp.ru>
Co-authored-by: Stanislav Angelovič <stanislav.angelovic@protonmail.com>
2023-09-25 20:12:34 +02:00
Stanislav Angelovič
290078d6af feat: add support for async property get/set on client-side (#354)
* feat: add async property get/set convenience support classes

* feat: add no-reply and async overloads to Properties_proxy

* feat: add convenience functions for GetAll functionality

* test: add tests for new functionality

* add codegen IDL support and documentation
2023-09-14 10:54:57 +02:00
Stanislav Angelovič
3717e63c64 feat: support std::future-based async methods in codegen tool (#353) 2023-08-19 20:57:32 +02:00
Stanislav Angelovič
6620a447d1 docs: add tutorial on extending sdbus-c++ types (#346) 2023-08-09 12:13:47 +02:00
Marcel Hellwig
dcd9d46b9c style: remove trailing whitespace (#345)
* style: restore correct 644 file permission

* style: remove trailing whitespace
2023-08-04 13:26:45 +02:00
Stanislav Angelovič
fb61420bf0 feat: support serialization of array, span and unordered_map (#342)
* feat: support serialization of array, span and unordered_map

* fix some spelling mistakes

* docs: update table of valid c++ types

---------

Co-authored-by: Marcel Hellwig <github@cookiesoft.de>
2023-08-03 13:55:37 +02:00
Stanislav Angelovič
737f04abc7 feat: add support for std::future-based async calls 2023-02-07 12:31:31 +01:00
Stanislav Angelovic
55c306ce05 docs: strip absolute paths from doxygen documentation 2023-01-04 21:51:28 +01:00
Stanislav Angelovic
aeae79003a refactor: support move semantics in generated adaptor and proxy classes 2022-09-20 17:05:59 +02:00
Stanislav Angelovic
74d849d933 feat: add support for proxy with no event loop thread 2022-09-05 17:25:37 +02:00
b-s-e
f336811fc7 docs: add section on D-Bus types to C++ types mapping (#285)
* Added D-Bus type C++ type table

* docs: do corrections and rewordings in the proposed chapter

Co-authored-by: Stanislav Angelovič <stanislav.angelovic@protonmail.com>
2022-09-05 13:51:05 +02:00
b-s-e
e33a890ce7 docs: fix send_destination property (#284) 2022-08-26 16:49:51 +02:00
Stanislav Angelovic
5ec6027d5f feat: add support for match rules 2022-06-27 12:14:57 +02:00
Stanislav Angelovic
2a4c241303 docs: add more info on D-Bus security policy file 2022-06-22 18:12:13 +02:00
Sergey Bobrenok
b5aee6d019 docs: add information about Buildroot package (#252) 2022-06-07 08:45:34 +02:00
Lukasz Marcul
442670ec18 codegen: Support chrono literal timeout by ProxyGenerator
Allow to use human readable chrono literals to specify method call
timeout. The change is backward compatbile - if no unit is provided,
the fallback is "us".

Example:
<annotation name="org.freedesktop.DBus.Method.Timeout" value="500ms"/>
2021-12-14 16:47:01 +01:00
Marcel Hellwig
b01db13ff7 fix method name in example 2021-12-01 16:18:58 +01:00
Stanislav Angelovič
dc0f487751 Reword a few tutorial statements slightly 2021-11-22 14:27:28 +01:00
Urs Ritzmann
a5ecbbfcec add examples for the ObjectManager API 2021-10-18 11:58:07 +02:00
Rolf Lussi
9cb8b89a01 add cpack to build debian packages, split the packages by components 2021-09-23 20:18:14 +02:00
Stanislav Angelovic
c422de641a Support Error parameter in signal handlers 2021-09-17 19:25:39 +02:00
Stanislav Angelovič
a72e17b932 doc: add gperf dependency for libsystemd 2021-09-17 18:28:41 +02:00
Stanislav Angelovic
6433b38ed1 Add specific sections for tips and notes in the tutorial 2021-07-22 16:01:42 +02:00
Stanislav Angelovic
e16ffb1288 Provide access to D-Bus message in high-level API 2021-06-22 11:31:08 +02:00
Sergey Bobrenok
d74365c535 docs: Add information about conan recipe 2021-06-15 15:27:29 +02:00
craig-spannring
d46cbba23c Add README and sdbus-c++ tutorial as additional pages in doxydocs (#153)
Co-authored-by: Craig Spannring <craig.spannring@milnxpd001.mti.local>
Co-authored-by: Stanislav Angelovič <angelovic.s@gmail.com>
2021-04-29 16:46:36 +02:00
Stanislav Angelovič
5f271abc0c Add note on system bus security policy file to the tutorial 2021-04-29 15:52:06 +02:00
Stanislav Angelovič
bbffcbf49e fix: minor documentation and test improvements (#166)
* fix: minor documentation and test improvements

* doc: add link to tests in standard interfaces tutorial secion

* Update README.md

Co-authored-by: Urs Ritzmann <urs.ritzmann@kistler.com>

* Update docs/using-sdbus-c++.md

Co-authored-by: Urs Ritzmann <urs.ritzmann@kistler.com>

* Use cmake instead of make in build instructions

Co-authored-by: Stanislav Angelovic <stanislav.angelovic@siemens.com>
Co-authored-by: Urs Ritzmann <urs.ritzmann@kistler.com>
2021-04-28 12:05:14 +02:00
Michal Hučko
dc6d55a282 Provide CMake config and PkgConfig files for tools (#172) 2021-04-28 11:15:47 +02:00
Stanislav Angelovič
a9f2043daa Fix examples in the tutorial
Remove sdbus:: namespace in injected-class-name of the template base class in c-tor initialization list
2021-03-10 09:49:25 +01:00
Stanislav Angelovič
96b2dfff69 Update using-sdbus-c++.md
Fix name of class in destructor
2021-03-09 17:04:43 +01:00
Stanislav Angelovič
21820f7529 Update using-sdbus-c++.md 2020-02-02 23:03:24 +01:00
sangelovic
3a4f343fb9 Provide better names to event loop-related IConnection methods 2020-02-02 22:22:26 +01:00
Stanislav Angelovič
db71707be4 Update tutorial for for full use of C++17 2020-02-01 23:03:44 +01:00