Re: Changing Auto-Connect feature



On Wed, May 26, 2010 at 07:47, Dan Williams <dcbw redhat com> wrote:
You want real_get_best_auto_connection() in nm-device-wifi.c.  You're
passed a list of connections that get sorted through.  The list is
already sorted by timestamp.  What you want to do is to run through the
*entire* list (and not stop at the first compatible AP that's found by
nm_ap_check_compatible() near the bottom) and instead keep a pointer to
the "best" connection as you define it.

This is a bit complicated because remember that connections are simply
packages of settings necessary to connect to a specific network, they do
not describe actual wifi APs.  So the basic procedure would be something
like:

NMConnection *best_yet = NULL;
guint32 best_ap_strength = 0;

for each connection in 'connections':
   <do normal device checking up to AP list iteration>

   for each ap in the device's AP list:
       if (nm_ap_check_compatible (ap, connection)) {
           if (nm_ap_get_strength (ap) > best_ap_strength) {
               best_yet = connection;
               best_ap_strength = nm_ap_get_strength (ap);
           }
       }

   return best_yet;

Dan

who am i to comment on this, yet allow me to say it:
outstanding work, clean and pretty ;)

thanks Dan for all of this


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]