ipc - Got a DBus::Path with libdbus-c++ - what next? -


i have short test program using work out how use d-bus libdbus-c++ library. trying connect wpa_supplicant d-bus api (documented here) in order read list of wifi aps , strengths.

following this guide, have generated proxy header dbusxx-xml2cpp wpa_supplicant_dbus_service.xml --proxy=proxy.h , implemented wpas class stub handlers signals:

class wpas : public fi::w1::wpa_supplicant1_proxy,                     public dbus::introspectableproxy,                     public dbus::objectproxy { public:      wpas(dbus::connection &connection, const char *path, const char *name):      dbus::objectproxy(connection, path, name)      {      }      void interfaceadded(const ::dbus::path& path, const std::map< std::string, ::dbus::variant >& properties) {}     void interfaceremoved(const ::dbus::path& path) {}     void propertieschanged(const std::map< std::string, ::dbus::variant >& properties) {} }; 

the rest of code looks this:

#include <dbus-c++/dbus.h> #include "proxy.h"  dbus::busdispatcher dispatcher;  int main(int argc, char** argv) {     dbus::default_dispatcher = &dispatcher;     dbus::connection bus = dbus::connection::systembus();      dbus::path path;      wpas wpad(bus, "/fi/w1/wpa_supplicant1", "fi.w1.wpa_supplicant1");      path = wpad.getinterface("wlan2");      return 0; } 

however, don't know next. aim call scan() method of fi.w1.wpa_supplicant1.interface.

it follow similar pattern how call fi::w1::wpa_supplicant1.getinterface; i.e. create class (e.g. wpasi) inherits fi::w1::wpa_supplicant1::interface_proxy, dbus::introspectableproxy , dbus::objectproxy.

assuming both objects (wpad , interface) on same service, create instance of new class follows:

wpasi wpasi( bus, path, "fi.w1.wpa_supplicant1" ); 

then call wpasi.scan() usual.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -