This introduces strong types for `std::string`-based D-Bus types. This facilitates safer, less error-prone and more expressive API.
What previously was `auto proxy = createProxy("org.sdbuscpp.concatenator", "/org/sdbuscpp/concatenator");` is now written like `auto proxy = createProxy(ServiceName{"org.sdbuscpp.concatenator"}, ObjectPath{"/org/sdbuscpp/concatenator"});`.
These types are:
* `ObjectPath` type for the object path (the type has been around already but now is also used consistently in sdbus-c++ API for object path strings),
* `InterfaceName` type for D-Bus interface names,
* `BusName` (and its aliases `ServiceName` and `ConnectionName`) type for bus/service/connection names,
* `MemberName` (and its aliases `MethodName`, `SignalName` and `PropertyName`) type for D-Bus method, signal and property names,
* `Signature` type for the D-Bus signature (the type has been around already but now is also used consistently in sdbus-c++ API for signature strings),
* `Error::Name` type for D-Bus error names.
* Add methods to initiate custom session bus connection
The new function helper `createSessionBusConnectionWithAddress` allows to create connection to session bus with custom address.
Signed-off-by: Alexander Livenets <a.livenets@gmail.com>
* feat: add support for session bus connection at custom address
Co-authored-by: Stanislav Angelovic <stanislav.angelovic@siemens.com>
This internally calls sd_bus_open(), which automatically selects the
system or session bus connection based on the presence and
content of a DBUS_STARTER_BUS_TYPE environment variable and
whether the calling process has root privileges.
This option is very helpful when creating services and clients that will use the system bus in production, but connect to a session
for testing.
Additional changes:
* Removed assertions null-checking make_unique() return values.
make_unique() calls new, and new is expected to throw or abort
on failure, making the assertions unhelpful.
* Corrected a typo in the ClosesAndUnrefsBusWhenDestructed
unit test for the system bus (tested the wrong function).