Code Monkey home page Code Monkey logo

Comments (7)

sangelovic avatar sangelovic commented on July 18, 2024

The problem is that no event loop was run in your example for the connection. One must call enterEventLoop() or enterEventLoopAsync() method of the connection object. Perhaps that is not specified clearly in the sdbus-c++ tutorial...

from sdbus-cpp.

sangelovic avatar sangelovic commented on July 18, 2024

Or you can simply create sessionResponse like this: auto sessionResponse = sdbus::createProxy(sdbus::createSessionBusConnection(), destinationName, sessionResponsePath);, which, according to https://github.com/Kistler-Group/sdbus-cpp/blob/master/docs/using-sdbus-c%2B%2B.md#using-d-bus-connections-on-the-client-side means that the proxy will get an owner of the connection and will automatically run the event loop on it for your convenience (hence signals would work fine for you), and create createSession like this: auto createSession = sdbus::createProxy(sdbus::createSessionBusConnection(), destinationName, objectPath, sdbus::dont_run_event_loop_thread);, which has the proxy create another connection, but whose event loop would not be run because you just use it to call a method and then let go of it, as described again in https://github.com/Kistler-Group/sdbus-cpp/blob/master/docs/using-sdbus-c%2B%2B.md#using-d-bus-connections-on-the-server-side, so this saves time and resources.

from sdbus-cpp.

FuchtelJockel avatar FuchtelJockel commented on July 18, 2024

That was quick, thanks. I only looked at the client side of the tutorials. Now I see and it works.

from sdbus-cpp.

sangelovic avatar sangelovic commented on July 18, 2024

Out of curiosity, how does this example look in rust with the zbus library? Can you paste the code? I wonder if I can simplify anything here :-)

from sdbus-cpp.

FuchtelJockel avatar FuchtelJockel commented on July 18, 2024

Very similar but with more macro magic. main.txt

The official example is probably more helpful than my code: https://dbus2.github.io/zbus/client.html

from sdbus-cpp.

FuchtelJockel avatar FuchtelJockel commented on July 18, 2024

I like that zbus can deserialize 'a{sv}' into structs instead of maps. https://dbus2.github.io/zbus/faq.html
I think this feature fits cpp just as well.

from sdbus-cpp.

sangelovic avatar sangelovic commented on July 18, 2024

@FuchtelJockel I think that would be possible in sdbus-c++, too. The user would, however, need to additionally describe his struct (through some sort of sdbus-c++-provided macros, for example) so that sdbus-c++ would know understand the struct's members, their names, position etc.

I may add this to my TODO list.

from sdbus-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.