从 ScanResult 构造 WifiConfiguration 或:解释 ScanResult 的“功能”字符串

问题描述 投票:0回答:2

你们中的 Android 专家是否知道有任何开源代码可以从给定的

WifiConfiguration
创建
ScanResult
?这会有帮助的。事实上,我捕获的
WifiConfiguration.java
Android 源代码的第 483 (/624) 行(2012 年 4 月中旬)是一个注释掉的构造函数,旨在做到这一点,有一个很大的 TODO 想知道它是否值得实现(参见下面的引用) 。我示意是,我可以听一下吗?

我看到的主要挑战(实际上是这个问题的首要挑战)是如何解释 ScanResult.configuration 字符串。

  1. 我可以期待一个简单的列表,比如
    [WPA2-PSK-CCMP]
    [WPS]
    等吗?
  2. 这些字符串是否在文档或代码库中的某个位置枚举?
  3. 是否有设备/制造商/AP 特定的字符串 I 应该知道什么?

来自

WifiConfiguration.java
(可能有编辑):

/** 
 * 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
}   
*/

https://code.google.com/p/android/issues/detail?id=60523

android android-wifi wifi
2个回答
4
投票

我发现这个项目https://github.com/mkch/android-wifi-connecter并且以下文件特别非常有用:

Wifi.java

ConfigurationSecuritiesV8.java


0
投票

Android AOSP 中的此文件也很有帮助: WifiUtils

© www.soinside.com 2019 - 2024. All rights reserved.