title: Constructing a WifiConfiguration from a ScanResult or: Interpreting ScanResult's 'capabilities' String
body: <p>Do any of you Android gurus out there know of any open source code to create a <a href="http://developer.android.com/reference/android/net/wifi/WifiConfiguration.html" rel="nofollow"><code>WifiConfiguration</code></a> from a given <a href="http://developer.android.com/reference/android/net/wifi/ScanResult.html#capabilities" rel="nofollow"><code>ScanResult</code></a>? It would be helpful. Indeed, line 483 (/624) of my capture (mid April 2012) of the Android source of <code>WifiConfiguration.java</code> is a commented-out constructor intended to do exactly this, with a big TODO wondering whether it's worth implementing (see quote below). I motion yes, can I hear a second?</p>
  
  <p>The main challenge I see (which is actually the brunt of this question) is how to interpret the ScanResult.configuration String.</p>
  
  <ol>
  <li>can I expect just a simple list of things like <code>[WPA2-PSK-CCMP]</code>, <code>[WPS]</code>, etc?</li>
  <li>are these strings enumerated somewhere in the docs or code base?</li>
  <li>are there device/manufacturer/AP-specific strings I
  should know about?</li>
  </ol>
  
  <hr>
  
  <p>From <code>WifiConfiguration.java</code> (with possible editorializing):</p>
  
  <pre><code>/** 
   * Construct a WifiConfiguration from a scanned network
   * @param scannedAP the scan result used to construct the config entry
   * TODO: figure out whether this is a useful way to construct a new entry.
   *   
  public WifiConfiguration(ScanResult scannedAP) {
      networkId = -1; 
      SSID = scannedAP.SSID;
      BSSID = scannedAP.BSSID;
      // aaaah screw it I'm tired/lazy
  }   
  */
  </code></pre>
  
  <p><a href="https://code.google.com/p/android/issues/detail?id=60523" rel="nofollow">https://code.google.com/p/android/issues/detail?id=60523</a></p>