An open API service indexing awesome lists of open source software.

https://github.com/jwinarske/sdbus-cpp-examples

C++ DBus examples using sdbus-cpp v2.x
https://github.com/jwinarske/sdbus-cpp-examples

avahi bluez cpp cpp20 dbus embedded-linux geoclue2 hostname1 linux locale1 login1 resolve1 systemd timedate1 udisks2 upower

Last synced: 6 months ago
JSON representation

C++ DBus examples using sdbus-cpp v2.x

Awesome Lists containing this project

README

          

# sdbus-cpp-examples

Examples using the sdbus-cpp library to communicate with the system bus.

This approach uses XML interface files to create proxy classes. All members, signals, and properties are available. No
introspection is used at runtime.

## Examples

The basics

* AVAHI - query for services and get state changes
* BlueZ - discover devices and dump all properties
* GeoClue2 - start a location session and print updates
* hostname1 - get the current hostname and get runtime updates
* locale1 - get the current locale and get runtime updates
* login1 - access the login1 interface and get runtime updates
* NetworkManager - access objects and properties
* resolve1 - resolve a hostname to an IP address
* timedate1 - get the current time and get runtime updates
* UPower - get the current battery status and get runtime updates
* UDisks2 - get all disk info and runtime updates

## Building

https://github.com/jwinarske/sdbus-cpp-examples.git
git submodule update --init --recursive
mkdir build && cd build
cmake .. -GNinja
ninja

## Updating proxy files

Build this project once for artifact `sdbus-c++-xml2cpp`.

./generate.sh

If you re-generate interfaces with a different version of sdbus-cpp, likely you will need to make source code changes.
This is the primary reason for using sdbus-cpp as a submodule.

## Connecting to the system bus of a remote target

Share unix socket of remote device

sudo ssh -nNT -L /root/dbus_on_local:/run/dbus/system_bus_socket root@raspberrypi5.lan

Install d-spy, run as root

sudo d-spy

Select Bus Names `v` `Connect to Other Bus` adding

unix:path=/root/dbus_on_local