Search in sources :

Example 1 with WifiSecurity

use of org.eclipse.kura.net.wifi.WifiSecurity in project kura by eclipse.

the class WpaSupplicant method parseWpaConfig.

private static WpaSupplicant parseWpaConfig(String ifaceName) throws KuraException {
    Properties props = parseConfigFile();
    if (props == null) {
        s_logger.warn("WPA in client mode is not configured");
        return null;
    }
    String ssid = props.getProperty("ssid");
    if (ssid == null) {
        s_logger.warn("WPA in client mode is not configured");
        return null;
    }
    s_logger.debug("curent wpa_supplicant.conf: ssid={}", ssid);
    int[] channels = null;
    // wifi mode
    int mode = props.getProperty("mode") != null ? Integer.parseInt(props.getProperty("mode")) : MODE_INFRA;
    s_logger.debug("current wpa_supplicant.conf: mode={}", mode);
    WifiMode wifiMode = null;
    switch(mode) {
        case MODE_INFRA:
            wifiMode = WifiMode.INFRA;
            String scan_freq = props.getProperty("scan_freq");
            if (scan_freq != null && scan_freq.length() > 0) {
                s_logger.debug("current wpa_supplicant.conf: scan_freq={}", scan_freq);
                String[] saScanFreq = scan_freq.split(" ");
                channels = new int[saScanFreq.length];
                for (int i = 0; i < channels.length; i++) {
                    try {
                        channels[i] = frequencyMhz2Channel(Integer.parseInt(saScanFreq[i]));
                    } catch (NumberFormatException e) {
                        s_logger.warn("Invalid string in wpa_supplicant.conf for scan_freq: " + scan_freq);
                    }
                }
            } else {
                channels = new int[11];
                for (int i = 0; i < channels.length; i++) {
                    channels[i] = i + 1;
                }
            }
            break;
        case MODE_IBSS:
            channels = new int[1];
            wifiMode = WifiMode.ADHOC;
            String frequency = props.getProperty("frequency");
            s_logger.debug("current wpa_supplicant.conf: frequency={}", frequency);
            int freq = 2412;
            if (frequency != null) {
                try {
                    freq = Integer.parseInt(frequency);
                    channels[0] = frequencyMhz2Channel(freq);
                } catch (NumberFormatException e) {
                    freq = 2412;
                }
            }
            break;
        case MODE_AP:
            throw KuraException.internalError("wpa_supplicant failed to parse its configuration file: MODE_AP is invalid");
        default:
            throw KuraException.internalError("wpa_supplicant failed to parse its configuration file: invalid mode: " + mode);
    }
    String proto = props.getProperty("proto");
    if (proto != null) {
        s_logger.debug("current wpa_supplicant.conf: proto={}", proto);
    }
    WifiCiphers pairwiseCiphers = null;
    String pairwise = props.getProperty("pairwise");
    if (pairwise != null) {
        s_logger.debug("current wpa_supplicant.conf: pairwise={}", pairwise);
        if (pairwise.contains(WifiCiphers.toString(WifiCiphers.CCMP_TKIP))) {
            pairwiseCiphers = WifiCiphers.CCMP_TKIP;
        } else if (pairwise.contains(WifiCiphers.toString(WifiCiphers.TKIP))) {
            pairwiseCiphers = WifiCiphers.TKIP;
        } else if (pairwise.contains(WifiCiphers.toString(WifiCiphers.CCMP))) {
            pairwiseCiphers = WifiCiphers.CCMP;
        }
    }
    WifiCiphers groupCiphers = null;
    String group = props.getProperty("group");
    if (group != null) {
        s_logger.debug("current wpa_supplicant.conf: group={}", group);
        if (group.contains(WifiCiphers.toString(WifiCiphers.CCMP_TKIP))) {
            groupCiphers = WifiCiphers.CCMP_TKIP;
        } else if (group.contains(WifiCiphers.toString(WifiCiphers.TKIP))) {
            groupCiphers = WifiCiphers.TKIP;
        } else if (group.contains(WifiCiphers.toString(WifiCiphers.CCMP))) {
            groupCiphers = WifiCiphers.CCMP;
        }
    }
    // security
    WifiSecurity wifiSecurity = null;
    String password = null;
    String keyMgmt = props.getProperty("key_mgmt");
    s_logger.debug("current wpa_supplicant.conf: key_mgmt={}", keyMgmt);
    if (keyMgmt != null && keyMgmt.equalsIgnoreCase("WPA-PSK")) {
        password = props.getProperty("psk");
        if (proto != null) {
            if (proto.trim().equals("WPA")) {
                wifiSecurity = WifiSecurity.SECURITY_WPA;
            } else if (proto.trim().equals("RSN")) {
                wifiSecurity = WifiSecurity.SECURITY_WPA2;
            } else if (proto.trim().equals("WPA RSN")) {
                wifiSecurity = WifiSecurity.SECURITY_WPA_WPA2;
            }
        } else {
            wifiSecurity = WifiSecurity.SECURITY_WPA_WPA2;
        }
    } else {
        password = props.getProperty("wep_key0");
        if (password != null) {
            wifiSecurity = WifiSecurity.SECURITY_WEP;
        } else {
            wifiSecurity = WifiSecurity.SECURITY_NONE;
        }
        pairwiseCiphers = null;
        groupCiphers = null;
    }
    WifiBgscan bgscan = null;
    String sBgscan = props.getProperty("bgscan");
    if (sBgscan != null) {
        s_logger.debug("current wpa_supplicant.conf: bgscan={}", sBgscan);
        bgscan = new WifiBgscan(sBgscan);
    }
    return getWpaSupplicant(ifaceName, wifiMode, null, ssid, wifiSecurity, pairwiseCiphers, groupCiphers, channels, password, bgscan);
}
Also used : WifiCiphers(org.eclipse.kura.net.wifi.WifiCiphers) WifiMode(org.eclipse.kura.net.wifi.WifiMode) WifiSecurity(org.eclipse.kura.net.wifi.WifiSecurity) WifiBgscan(org.eclipse.kura.net.wifi.WifiBgscan) Properties(java.util.Properties)

Example 2 with WifiSecurity

use of org.eclipse.kura.net.wifi.WifiSecurity in project kura by eclipse.

the class WpaSupplicantScan method scan.

public void scan() throws KuraException {
    String line = null;
    ProcessStats processStats = null;
    BufferedReader br = null;
    String sScanCommand = formSupplicantScanCommand(this.m_iface);
    // scan for wireless networks
    try {
        processStats = LinuxProcessUtil.startWithStats(sScanCommand);
    } catch (Exception e) {
        throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
    }
    try {
        br = new BufferedReader(new InputStreamReader(processStats.getInputStream()));
        line = br.readLine();
        if (line == null || !line.equals("OK")) {
            throw new KuraException(KuraErrorCode.INTERNAL_ERROR, sScanCommand + " command failed");
        }
    } catch (Exception e) {
        throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
    } finally {
        try {
            br.close();
        } catch (Exception e) {
            throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
        }
    }
    // get scan results
    String sScanResultsCommand = formSupplicantScanResultsCommand(this.m_iface);
    try {
        processStats = LinuxProcessUtil.startWithStats(sScanResultsCommand);
    } catch (Exception e) {
        throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
    }
    try {
        br = new BufferedReader(new InputStreamReader(processStats.getInputStream()));
        String[] aScanInfo = null;
        while ((line = br.readLine()) != null) {
            aScanInfo = line.split("\\s+");
            if (aScanInfo.length > 0) {
                String macAddress = aScanInfo[0];
                int frequency = Integer.parseInt(aScanInfo[1]);
                int signalLevel = Integer.parseInt(aScanInfo[2]);
                int securityCode = 0;
                String sSecurity = aScanInfo[3].substring(aScanInfo[3].indexOf("[") + 1, aScanInfo[3].lastIndexOf(']'));
                StringTokenizer st = new StringTokenizer(sSecurity, "][");
                while (st.hasMoreTokens()) {
                    String token = st.nextToken();
                    if (token.startsWith("WEP")) {
                        securityCode |= 1;
                    } else if (token.startsWith("WPA2")) {
                        securityCode |= 4;
                    } else if (token.startsWith("WPA")) {
                        securityCode |= 2;
                    }
                }
                WifiSecurity wifiSecurity = null;
                switch(securityCode) {
                    case 1:
                        wifiSecurity = WifiSecurity.SECURITY_WEP;
                        break;
                    case 2:
                        wifiSecurity = WifiSecurity.SECURITY_WPA;
                        break;
                    case 4:
                        wifiSecurity = WifiSecurity.SECURITY_WPA2;
                        break;
                    case 6:
                        wifiSecurity = WifiSecurity.SECURITY_WPA_WPA2;
                        break;
                    default:
                        wifiSecurity = WifiSecurity.NONE;
                }
                String ssid = aScanInfo[4];
                WifiHotspotInfo wifiHotspotInfo = new WifiHotspotInfo(ssid, macAddress, signalLevel, frequencyMhz2Channel(frequency), frequency, wifiSecurity);
                this.m_listWifiHotspotInfo.add(wifiHotspotInfo);
            }
        }
    } catch (Exception e) {
        throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
    } finally {
        try {
            br.close();
        } catch (Exception e) {
            throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
        }
    }
}
Also used : ProcessStats(org.eclipse.kura.core.linux.util.ProcessStats) StringTokenizer(java.util.StringTokenizer) InputStreamReader(java.io.InputStreamReader) KuraException(org.eclipse.kura.KuraException) BufferedReader(java.io.BufferedReader) WifiSecurity(org.eclipse.kura.net.wifi.WifiSecurity) KuraException(org.eclipse.kura.KuraException) WifiHotspotInfo(org.eclipse.kura.net.wifi.WifiHotspotInfo)

Example 3 with WifiSecurity

use of org.eclipse.kura.net.wifi.WifiSecurity in project kura by eclipse.

the class NL80211 method getScanResults.

public synchronized Map<String, WifiHotspotInfo> getScanResults() {
    Map<String, WifiHotspotInfo> scanResults = null;
    String[] BSSIDs = NL80211getScanResults(this.m_ifaceName);
    if (BSSIDs != null && BSSIDs.length > 0) {
        scanResults = new HashMap<String, WifiHotspotInfo>();
        for (String bssid : BSSIDs) {
            String ssid = NL80211getSSID(bssid);
            int channel = NL80211getChannel(bssid);
            int frequency = NL80211getFrequency(bssid);
            int signal = NL80211getSignal(bssid);
            int security = NL80211getSecurity(bssid);
            WifiSecurity wifiSecurity = WifiSecurity.NONE;
            switch(security) {
                case 0:
                    wifiSecurity = WifiSecurity.NONE;
                    break;
                case 1:
                    wifiSecurity = WifiSecurity.SECURITY_WEP;
                    break;
                case 2:
                    wifiSecurity = WifiSecurity.SECURITY_WPA;
                    break;
                case 4:
                    wifiSecurity = WifiSecurity.SECURITY_WPA2;
                    break;
                case 6:
                    wifiSecurity = WifiSecurity.SECURITY_WPA_WPA2;
                    break;
            }
            WifiHotspotInfo wifiHotspotInfo = new WifiHotspotInfo(ssid, bssid, signal, channel, frequency, wifiSecurity);
            scanResults.put(bssid, wifiHotspotInfo);
        }
    }
    return scanResults;
}
Also used : WifiSecurity(org.eclipse.kura.net.wifi.WifiSecurity) WifiHotspotInfo(org.eclipse.kura.net.wifi.WifiHotspotInfo)

Example 4 with WifiSecurity

use of org.eclipse.kura.net.wifi.WifiSecurity in project kura by eclipse.

the class WpaSupplicantConfigReader method getWifiClientConfig.

private static WifiConfig getWifiClientConfig(String ifaceName, WifiMode wifiMode) throws KuraException {
    WifiConfig wifiConfig = new WifiConfig();
    String ssid = "";
    WifiSecurity wifiSecurity = WifiSecurity.NONE;
    String password = "";
    int[] channels = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
    WifiBgscan bgscan = new WifiBgscan("");
    WifiCiphers pairwiseCiphers = null;
    WifiCiphers groupCiphers = null;
    // Get properties from config file
    Properties props = parseConfigFile(ifaceName);
    if (props == null) {
        s_logger.warn("WPA in client mode is not configured");
    } else {
        ssid = props.getProperty("ssid");
        if (ssid == null) {
            s_logger.warn("WPA in client mode is not configured");
        } else {
            s_logger.debug("curent wpa_supplicant.conf: ssid={}", ssid);
            // wifi mode
            int currentMode = props.getProperty("mode") != null ? Integer.parseInt(props.getProperty("mode")) : WpaSupplicantUtil.MODE_INFRA;
            s_logger.debug("current wpa_supplicant.conf: mode={}", currentMode);
            switch(wifiMode) {
                case INFRA:
                    String scan_freq = props.getProperty("scan_freq");
                    if (scan_freq != null) {
                        s_logger.debug("current wpa_supplicant.conf: scan_freq={}", scan_freq);
                        String[] saScanFreq = scan_freq.split(" ");
                        channels = new int[saScanFreq.length];
                        for (int i = 0; i < channels.length; i++) {
                            try {
                                channels[i] = WpaSupplicantUtil.convFrequencyToChannel(Integer.parseInt(saScanFreq[i]));
                            } catch (NumberFormatException e) {
                            }
                        }
                    }
                    break;
                /*
                 * case ADHOC:
                 * channels = new int [1];
                 * String frequency = props.getProperty("frequency");
                 * s_logger.debug("current wpa_supplicant.conf: frequency=" + frequency);
                 * int freq = 2412;
                 * if (frequency != null) {
                 * try {
                 * freq = Integer.parseInt(frequency);
                 * } catch (NumberFormatException e) {
                 * }
                 * }
                 * channels[0] = WpaSupplicantUtil.convFrequencyToChannel(freq);
                 * wifiDriver = KuranetConfig.getProperty(adhocDriverKey.toString());
                 * if(wifiDriver == null) {
                 * wifiDriver = KuranetConfig.getProperty(infraDriverKey.toString());
                 * }
                 * break;
                 */
                case MASTER:
                    throw KuraException.internalError("failed to get wpa_supplicant configuration: MASTER mode is invalid");
                default:
                    throw KuraException.internalError("failed to get wpa_supplicant configuration: invalid mode: " + wifiMode);
            }
            String proto = props.getProperty("proto");
            if (proto != null) {
                s_logger.debug("current wpa_supplicant.conf: proto={}", proto);
            }
            String pairwise = props.getProperty("pairwise");
            if (pairwise != null) {
                s_logger.debug("current wpa_supplicant.conf: pairwise={}", pairwise);
                if (pairwise.contains(WifiCiphers.toString(WifiCiphers.CCMP_TKIP))) {
                    pairwiseCiphers = WifiCiphers.CCMP_TKIP;
                } else if (pairwise.contains(WifiCiphers.toString(WifiCiphers.TKIP))) {
                    pairwiseCiphers = WifiCiphers.TKIP;
                } else if (pairwise.contains(WifiCiphers.toString(WifiCiphers.CCMP))) {
                    pairwiseCiphers = WifiCiphers.CCMP;
                }
            }
            String group = props.getProperty("group");
            if (group != null) {
                s_logger.debug("current wpa_supplicant.conf: group={}", group);
                if (group.contains(WifiCiphers.toString(WifiCiphers.CCMP_TKIP))) {
                    groupCiphers = WifiCiphers.CCMP_TKIP;
                } else if (group.contains(WifiCiphers.toString(WifiCiphers.TKIP))) {
                    groupCiphers = WifiCiphers.TKIP;
                } else if (group.contains(WifiCiphers.toString(WifiCiphers.CCMP))) {
                    groupCiphers = WifiCiphers.CCMP;
                }
            }
            // security
            String keyMgmt = props.getProperty("key_mgmt");
            s_logger.debug("current wpa_supplicant.conf: key_mgmt={}", keyMgmt);
            if (keyMgmt != null && keyMgmt.equalsIgnoreCase("WPA-PSK")) {
                password = props.getProperty("psk");
                if (proto != null) {
                    if (proto.trim().equals("WPA")) {
                        wifiSecurity = WifiSecurity.SECURITY_WPA;
                    } else if (proto.trim().equals("RSN")) {
                        wifiSecurity = WifiSecurity.SECURITY_WPA2;
                    } else if (proto.trim().equals("WPA RSN")) {
                        wifiSecurity = WifiSecurity.SECURITY_WPA_WPA2;
                    }
                } else {
                    wifiSecurity = WifiSecurity.SECURITY_WPA2;
                }
            } else {
                password = props.getProperty("wep_key0");
                if (password != null) {
                    wifiSecurity = WifiSecurity.SECURITY_WEP;
                } else {
                    wifiSecurity = WifiSecurity.SECURITY_NONE;
                }
                pairwiseCiphers = null;
                groupCiphers = null;
            }
            if (password == null) {
                password = "";
            }
            String sBgscan = props.getProperty("bgscan");
            if (sBgscan != null) {
                s_logger.debug("current wpa_supplicant.conf: bgscan={}", sBgscan);
                bgscan = new WifiBgscan(sBgscan);
            }
        }
    }
    // Populate the config
    wifiConfig.setMode(wifiMode);
    wifiConfig.setSSID(ssid);
    wifiConfig.setSecurity(wifiSecurity);
    wifiConfig.setPasskey(password);
    wifiConfig.setHardwareMode("");
    wifiConfig.setPairwiseCiphers(pairwiseCiphers);
    wifiConfig.setGroupCiphers(groupCiphers);
    wifiConfig.setChannels(channels);
    wifiConfig.setBgscan(bgscan);
    // Get self-stored properties
    boolean pingAP = false;
    StringBuilder key = new StringBuilder().append("net.interface.").append(ifaceName).append(".config.wifi.infra.pingAccessPoint");
    String statusString = KuranetConfig.getProperty(key.toString());
    if (statusString != null && !statusString.isEmpty()) {
        pingAP = Boolean.parseBoolean(statusString);
    }
    wifiConfig.setPingAccessPoint(pingAP);
    boolean ignoreSSID = false;
    key = new StringBuilder().append("net.interface.").append(ifaceName).append(".config.wifi.infra.ignoreSSID");
    statusString = KuranetConfig.getProperty(key.toString());
    if (statusString != null && !statusString.isEmpty()) {
        ignoreSSID = Boolean.parseBoolean(statusString);
    }
    wifiConfig.setIgnoreSSID(ignoreSSID);
    StringBuilder infraDriverKey = new StringBuilder("net.interface.").append(ifaceName).append(".config.wifi.infra.driver");
    // StringBuilder adhocDriverKey = new
    // StringBuilder("net.interface.").append(ifaceName).append(".config.wifi.adhoc.driver");
    String wifiDriver = KuranetConfig.getProperty(infraDriverKey.toString());
    if (wifiDriver == null || wifiDriver.isEmpty()) {
        wifiDriver = "nl80211";
    }
    wifiConfig.setDriver(wifiDriver);
    return wifiConfig;
}
Also used : WifiCiphers(org.eclipse.kura.net.wifi.WifiCiphers) WifiConfig(org.eclipse.kura.net.wifi.WifiConfig) WifiSecurity(org.eclipse.kura.net.wifi.WifiSecurity) WifiBgscan(org.eclipse.kura.net.wifi.WifiBgscan) Properties(java.util.Properties)

Example 5 with WifiSecurity

use of org.eclipse.kura.net.wifi.WifiSecurity in project kura by eclipse.

the class GwtNetworkServiceImpl method findWifiHotspots.

@Override
public ArrayList<GwtWifiHotspotEntry> findWifiHotspots(GwtXSRFToken xsrfToken, String interfaceName) throws GwtKuraException {
    checkXSRFToken(xsrfToken);
    NetworkAdminService nas = ServiceLocator.getInstance().getService(NetworkAdminService.class);
    SystemService systemService = ServiceLocator.getInstance().getService(SystemService.class);
    List<GwtWifiHotspotEntry> gwtWifiHotspotsEntries = new ArrayList<GwtWifiHotspotEntry>();
    try {
        Map<String, WifiHotspotInfo> wifiHotspotInfoMap = nas.getWifiHotspots(interfaceName);
        if (wifiHotspotInfoMap != null && !wifiHotspotInfoMap.isEmpty()) {
            Collection<WifiHotspotInfo> wifiHotspotInfoCollection = wifiHotspotInfoMap.values();
            Iterator<WifiHotspotInfo> it = wifiHotspotInfoCollection.iterator();
            while (it.hasNext()) {
                WifiHotspotInfo wifiHotspotInfo = it.next();
                String ssid = GwtSafeHtmlUtils.htmlEscape(wifiHotspotInfo.getSsid());
                // }
                if (wifiHotspotInfo.getChannel() <= systemService.getKuraWifiTopChannel() && ssid != null) {
                    GwtWifiHotspotEntry gwtWifiHotspotEntry = new GwtWifiHotspotEntry();
                    gwtWifiHotspotEntry.setMacAddress(wifiHotspotInfo.getMacAddress());
                    gwtWifiHotspotEntry.setSSID(ssid);
                    gwtWifiHotspotEntry.setsignalStrength(wifiHotspotInfo.getSignalLevel());
                    gwtWifiHotspotEntry.setChannel(wifiHotspotInfo.getChannel());
                    gwtWifiHotspotEntry.setFrequency(wifiHotspotInfo.getFrequency());
                    if (wifiHotspotInfo.getSecurity() == WifiSecurity.NONE || wifiHotspotInfo.getSecurity() == WifiSecurity.SECURITY_NONE) {
                        gwtWifiHotspotEntry.setSecurity("None");
                    } else if (wifiHotspotInfo.getSecurity() == WifiSecurity.SECURITY_WEP) {
                        gwtWifiHotspotEntry.setSecurity("WEP");
                    } else if (wifiHotspotInfo.getSecurity() == WifiSecurity.SECURITY_WPA) {
                        gwtWifiHotspotEntry.setSecurity("WPA");
                    } else if (wifiHotspotInfo.getSecurity() == WifiSecurity.SECURITY_WPA2) {
                        gwtWifiHotspotEntry.setSecurity("WPA2");
                    } else if (wifiHotspotInfo.getSecurity() == WifiSecurity.SECURITY_WPA_WPA2) {
                        gwtWifiHotspotEntry.setSecurity("WPA/WPA2");
                    }
                    GwtWifiCiphers gwtPairCiphers = null;
                    GwtWifiCiphers gwtGroupCiphers = null;
                    EnumSet<WifiSecurity> pairCiphers = wifiHotspotInfo.getPairCiphers();
                    Iterator<WifiSecurity> itPairCiphers = pairCiphers.iterator();
                    while (itPairCiphers.hasNext()) {
                        WifiSecurity cipher = itPairCiphers.next();
                        if (gwtPairCiphers == null) {
                            if (cipher == WifiSecurity.PAIR_TKIP) {
                                gwtPairCiphers = GwtWifiCiphers.netWifiCiphers_TKIP;
                            } else if (cipher == WifiSecurity.PAIR_CCMP) {
                                gwtPairCiphers = GwtWifiCiphers.netWifiCiphers_CCMP;
                            }
                        } else if (gwtPairCiphers == GwtWifiCiphers.netWifiCiphers_TKIP) {
                            if (cipher == WifiSecurity.PAIR_CCMP) {
                                gwtPairCiphers = GwtWifiCiphers.netWifiCiphers_CCMP_TKIP;
                            }
                        } else if (gwtPairCiphers == GwtWifiCiphers.netWifiCiphers_CCMP) {
                            if (cipher == WifiSecurity.PAIR_TKIP) {
                                gwtPairCiphers = GwtWifiCiphers.netWifiCiphers_CCMP_TKIP;
                            }
                        }
                    }
                    EnumSet<WifiSecurity> groupCiphers = wifiHotspotInfo.getGroupCiphers();
                    Iterator<WifiSecurity> itGroupCiphers = groupCiphers.iterator();
                    while (itGroupCiphers.hasNext()) {
                        WifiSecurity cipher = itGroupCiphers.next();
                        if (gwtGroupCiphers == null) {
                            if (cipher == WifiSecurity.GROUP_TKIP) {
                                gwtGroupCiphers = GwtWifiCiphers.netWifiCiphers_TKIP;
                            } else if (cipher == WifiSecurity.GROUP_CCMP) {
                                gwtGroupCiphers = GwtWifiCiphers.netWifiCiphers_CCMP;
                            }
                        } else if (gwtGroupCiphers == GwtWifiCiphers.netWifiCiphers_TKIP) {
                            if (cipher == WifiSecurity.GROUP_CCMP) {
                                gwtGroupCiphers = GwtWifiCiphers.netWifiCiphers_CCMP_TKIP;
                            }
                        } else if (gwtGroupCiphers == GwtWifiCiphers.netWifiCiphers_CCMP) {
                            if (cipher == WifiSecurity.GROUP_TKIP) {
                                gwtGroupCiphers = GwtWifiCiphers.netWifiCiphers_CCMP_TKIP;
                            }
                        }
                    }
                    if (gwtPairCiphers != null) {
                        gwtWifiHotspotEntry.setPairwiseCiphers(gwtPairCiphers.name());
                    }
                    if (gwtGroupCiphers != null) {
                        gwtWifiHotspotEntry.setGroupCiphers(gwtGroupCiphers.name());
                    }
                    gwtWifiHotspotsEntries.add(gwtWifiHotspotEntry);
                }
            }
        }
    } catch (Throwable t) {
        s_logger.error("Failed", t);
        KuraExceptionHandler.handle(t);
    }
    return new ArrayList<GwtWifiHotspotEntry>(gwtWifiHotspotsEntries);
}
Also used : GwtWifiCiphers(org.eclipse.kura.web.shared.model.GwtWifiCiphers) ArrayList(java.util.ArrayList) SystemService(org.eclipse.kura.system.SystemService) GwtWifiSecurity(org.eclipse.kura.web.shared.model.GwtWifiSecurity) WifiSecurity(org.eclipse.kura.net.wifi.WifiSecurity) GwtWifiHotspotEntry(org.eclipse.kura.web.shared.model.GwtWifiHotspotEntry) NetworkAdminService(org.eclipse.kura.net.NetworkAdminService) WifiHotspotInfo(org.eclipse.kura.net.wifi.WifiHotspotInfo)

Aggregations

WifiSecurity (org.eclipse.kura.net.wifi.WifiSecurity)11 KuraException (org.eclipse.kura.KuraException)5 Properties (java.util.Properties)4 WifiHotspotInfo (org.eclipse.kura.net.wifi.WifiHotspotInfo)4 StringTokenizer (java.util.StringTokenizer)3 WifiAccessPoint (org.eclipse.kura.net.wifi.WifiAccessPoint)3 WifiBgscan (org.eclipse.kura.net.wifi.WifiBgscan)3 WifiCiphers (org.eclipse.kura.net.wifi.WifiCiphers)3 WifiConfig (org.eclipse.kura.net.wifi.WifiConfig)3 WifiMode (org.eclipse.kura.net.wifi.WifiMode)3 WifiRadioMode (org.eclipse.kura.net.wifi.WifiRadioMode)3 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 InputStreamReader (java.io.InputStreamReader)2 ArrayList (java.util.ArrayList)2 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1