From: Christopher P. <cpi...@gm...> - 2010-08-17 21:51:17
|
Hi, I've written a number of apps using the low level dbus API but wanted to try dbus-c++ to do a small project. I want to talk to wpa_supplicant to tell it to scan for a certain SSID. You accomplish this in several steps: First, you ask wpa_supplicant for an object path to an interface. Using the command line tools: dbus-send --system --print-reply --type=method_call \ --dest=fi.epitest.hostap.WPASupplicant \ /fi/epitest/hostap/WPASupplicant \ fi.epitest.hostap.WPASupplicant.getInterface \ string:"wlan0" It will return something like: object path "/fi/epitest/hostap/WPASupplicant/Interfaces/0 Now that you have that object path, you can call the method that tells it to begin scanning: dbus-send --system --print-reply --type=method_call \ --dest=fi.epitest.hostap.WPASupplicant \ /fi/epitest/hostap/WPASupplicant/Interfaces/0 \ # Note: using object ID returned by above fi.epitest.hostap.WPASupplicant.Interface.scan It returns 1 to indicate success. Then you wait a while, and request the results with something like: dbus-send --system --print-reply --type=method_call \ --dest=fi.epitest.hostap.WPASupplicant \ /fi/epitest/hostap/WPASupplicant/Interfaces/0 \ fi.epitest.hostap.WPASupplicant.Interface.scan This returns an object consisting of a dictionary and a bunch of data. You can see described with an example: http://old.nabble.com/0.7-not-working-with-linux-2.6.24-td15422455.html So here's my question. I made an XML file to try to describe all of this in a way that dbusxx-xml2cpp would understand, and I got stuck almost immediately because the nature of the Interface object is dynamic. In other words, I can't say: <node name="/fi/epitest/hostap/WPASupplicant/Interfaces/0"> ... </node> because it might not be interface 0 on another system, it might be interface 1, 2, or 100. What's the right way to proceed here? Do I need to not use the proxy object model / code generator all (in which case, is there any point to me using dbus-c++ for this project?) --Chris |
From: Andreas V. <li...@br...> - 2010-09-28 20:10:13
|
Am Tue, 17 Aug 2010 17:51:09 -0400 schrieb Christopher Piggott: Hello Chris, some time ago I've done something similar with a bluetooth adapter. I uploaded my source to this place. Maybe it helps you to understand how to do it. It took me some time to find it out: http://tux-style.com/tmp/bluephone_drop.tar.gz The idea is to get the object path and then use it later. A little tricky is to get correct one if more that one exist. In my case of mobiles I would detect the correct one from the mobile name. I hope this helps you a little. Sorry, but I never used WLAN with DBus-C++. regards Andreas > Hi, > > I've written a number of apps using the low level dbus API but wanted > to try dbus-c++ to do a small project. > > I want to talk to wpa_supplicant to tell it to scan for a certain > SSID. You accomplish this in several steps: > > First, you ask wpa_supplicant for an object path to an interface. > Using the command line tools: > dbus-send --system --print-reply --type=method_call \ > --dest=fi.epitest.hostap.WPASupplicant \ > /fi/epitest/hostap/WPASupplicant \ > fi.epitest.hostap.WPASupplicant.getInterface \ > string:"wlan0" > > It will return something like: > object path "/fi/epitest/hostap/WPASupplicant/Interfaces/0 > > > Now that you have that object path, you can call the method that tells > it to begin scanning: > > dbus-send --system --print-reply --type=method_call \ > --dest=fi.epitest.hostap.WPASupplicant \ > /fi/epitest/hostap/WPASupplicant/Interfaces/0 \ # Note: > using object ID returned by above > fi.epitest.hostap.WPASupplicant.Interface.scan > > It returns 1 to indicate success. > > > Then you wait a while, and request the results with something like: > > dbus-send --system --print-reply --type=method_call \ > --dest=fi.epitest.hostap.WPASupplicant \ > /fi/epitest/hostap/WPASupplicant/Interfaces/0 \ > fi.epitest.hostap.WPASupplicant.Interface.scan > > > > This returns an object consisting of a dictionary and a bunch of data. > You can see described with an example: > http://old.nabble.com/0.7-not-working-with-linux-2.6.24-td15422455.html > > > So here's my question. I made an XML file to try to describe all of > this in a way that dbusxx-xml2cpp would understand, and I got stuck > almost immediately because the nature of the Interface object is > dynamic. In other words, I can't say: > <node name="/fi/epitest/hostap/WPASupplicant/Interfaces/0"> ... > </node> > > because it might not be interface 0 on another system, it might be > interface 1, 2, or 100. > > What's the right way to proceed here? Do I need to not use the proxy > object model / code generator all (in which case, is there any point > to me using dbus-c++ for this project?) > > --Chris > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > dbus-cplusplus-devel mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel > |