sequence of associating to a new WAP using PHP and DBus

don don at waldohealth.com
Tue Jul 6 13:59:20 EDT 2010


I found an old python example from 2/17/2009 hostap archives, but it does
not seem to select. 

I have three networks defined in my conf file, and wpa_cli shows them
properly loading and associating. I'm faking the three network strings as
follows:
<code>
        $name = trim($_POST[name], "'");
        $p0 = "/fi/epitest/hostap/WPASupplicant/Interfaces/0/Networks/0";
        $p1 = "/fi/epitest/hostap/WPASupplicant/Interfaces/0/Networks/1";
        $p2 = "/fi/epitest/hostap/WPASupplicant/Interfaces/0/Networks/2";
        if ($name == "WaldoDemo") {
            $psel = $p0;
        } else if ($name == "Shepherd") {
            $psel = $p1;
        } else {
            $psel = $p2;
        } 
        $d = new Dbus(Dbus::BUS_SYSTEM, true);
        $supplicant = $d->createProxy( "fi.epitest.hostap.WPASupplicant", 
                                       "/fi/epitest/hostap/WPASupplicant",

                                       "fi.epitest.hostap.WPASupplicant"
);
        $path = $supplicant->getInterface("wlan0");
        $if = $d->createProxy( "fi.epitest.hostap.WPASupplicant",
                               $path->getData(),
                               "fi.epitest.hostap.WPASupplicant.Interface"
);
        $rnet = $d->createProxy( "fi.epitest.hostap.WPASupplicant",
                               "$psel",
                               "fi.epitest.hostap.WPASupplicant.Network"
);
        $if->selectNetwork($rnet);
</code>
... but this still does not work. It triggers a re-associate, but it does
not select my choice.

The python example did an addNetwork() and took its return as the path
that was inserted into the $rnet proxy, but if I just fake the strings that
should work too, should it not? What am I missing?
-- 
Don Wilde
Waldo Health, Inc.
http://www.waldohealth.com
o: +11 512-219-0302
c: +11 512-749-6447


More information about the HostAP mailing list