Search in sources :

Example 1 with GwtWifiWirelessMode

use of org.eclipse.kura.web.shared.model.GwtWifiWirelessMode in project kura by eclipse.

the class WirelessConfigTab method getUpdatedNetInterface.

public void getUpdatedNetInterface(GwtNetInterfaceConfig updatedNetIf) {
    GwtWifiNetInterfaceConfig updatedWifiNetIf = (GwtWifiNetInterfaceConfig) updatedNetIf;
    if (m_formPanel != null) {
        GwtWifiConfig updatedWifiConfig = getGwtWifiConfig();
        updatedWifiNetIf.setWirelessMode(updatedWifiConfig.getWirelessMode());
        // Update the wifi config
        updatedWifiNetIf.setWifiConfig(updatedWifiConfig);
    } else {
        if (m_selectNetIfConfig != null) {
            Log.debug("Wireless config tab not yet rendered, using original values");
            updatedWifiNetIf.setAccessPointWifiConfig(m_selectNetIfConfig.getAccessPointWifiConfigProps());
            /* updatedWifiNetIf.setAdhocWifiConfig(m_selectNetIfConfig.getAdhocWifiConfigProps()); */
            updatedWifiNetIf.setStationWifiConfig(m_selectNetIfConfig.getStationWifiConfigProps());
            // Select the correct mode
            for (GwtWifiWirelessMode mode : GwtWifiWirelessMode.values()) {
                if (mode.name().equals(m_selectNetIfConfig.getWirelessMode())) {
                    updatedWifiNetIf.setWirelessMode(mode.name());
                    break;
                }
            }
        }
    }
}
Also used : GwtWifiConfig(org.eclipse.kura.web.shared.model.GwtWifiConfig) GwtWifiWirelessMode(org.eclipse.kura.web.shared.model.GwtWifiWirelessMode) GwtWifiNetInterfaceConfig(org.eclipse.kura.web.shared.model.GwtWifiNetInterfaceConfig)

Example 2 with GwtWifiWirelessMode

use of org.eclipse.kura.web.shared.model.GwtWifiWirelessMode in project kura by eclipse.

the class TabWirelessUi method getUpdatedNetInterface.

@Override
public void getUpdatedNetInterface(GwtNetInterfaceConfig updatedNetIf) {
    GwtWifiNetInterfaceConfig updatedWifiNetIf = (GwtWifiNetInterfaceConfig) updatedNetIf;
    if (this.session != null) {
        GwtWifiConfig updatedWifiConfig = getGwtWifiConfig();
        updatedWifiNetIf.setWirelessMode(updatedWifiConfig.getWirelessMode());
        // update the wifi config
        updatedWifiNetIf.setWifiConfig(updatedWifiConfig);
    } else {
        if (this.selectedNetIfConfig != null) {
            updatedWifiNetIf.setAccessPointWifiConfig(this.selectedNetIfConfig.getAccessPointWifiConfigProps());
            updatedWifiNetIf.setStationWifiConfig(this.selectedNetIfConfig.getStationWifiConfigProps());
            // select the correct mode
            for (GwtWifiWirelessMode mode : GwtWifiWirelessMode.values()) {
                if (mode.name().equals(this.selectedNetIfConfig.getWirelessMode())) {
                    updatedWifiNetIf.setWirelessMode(mode.name());
                }
            }
        }
    }
}
Also used : GwtWifiConfig(org.eclipse.kura.web.shared.model.GwtWifiConfig) GwtWifiWirelessMode(org.eclipse.kura.web.shared.model.GwtWifiWirelessMode) GwtWifiNetInterfaceConfig(org.eclipse.kura.web.shared.model.GwtWifiNetInterfaceConfig)

Example 3 with GwtWifiWirelessMode

use of org.eclipse.kura.web.shared.model.GwtWifiWirelessMode in project kura by eclipse.

the class TabWirelessUi method getGwtWifiConfig.

private GwtWifiConfig getGwtWifiConfig() {
    GwtWifiConfig gwtWifiConfig = new GwtWifiConfig();
    // mode
    GwtWifiWirelessMode wifiMode;
    if (this.wireless.getSelectedItemText().equals(MessageUtils.get(WIFI_MODE_STATION))) {
        wifiMode = GwtWifiWirelessMode.netWifiWirelessModeStation;
    } else {
        wifiMode = GwtWifiWirelessMode.netWifiWirelessModeAccessPoint;
    }
    gwtWifiConfig.setWirelessMode(wifiMode.name());
    // ssid
    gwtWifiConfig.setWirelessSsid(GwtSafeHtmlUtils.htmlUnescape(this.ssid.getText().trim()));
    // driver
    String driver = "";
    if (GwtWifiWirelessMode.netWifiWirelessModeAccessPoint.equals(wifiMode)) {
        driver = this.selectedNetIfConfig.getAccessPointWifiConfig().getDriver();
    } else if (GwtWifiWirelessMode.netWifiWirelessModeAdHoc.equals(wifiMode)) {
        driver = this.selectedNetIfConfig.getAdhocWifiConfig().getDriver();
    } else if (GwtWifiWirelessMode.netWifiWirelessModeStation.equals(wifiMode)) {
        driver = this.selectedNetIfConfig.getStationWifiConfig().getDriver();
    }
    // use previous value
    gwtWifiConfig.setDriver(driver);
    // radio mode
    String radioValue = this.radio.getSelectedItemText();
    for (GwtWifiRadioMode mode : GwtWifiRadioMode.values()) {
        if (MessageUtils.get(mode.name()).equals(radioValue)) {
            gwtWifiConfig.setRadioMode(mode.name());
        }
    }
    // channels
    Set<GwtWifiChannelModel> lSelectedChannels = this.selectionModel.getSelectedSet();
    ArrayList<Integer> alChannels = new ArrayList<Integer>();
    for (GwtWifiChannelModel item : lSelectedChannels) {
        alChannels.add(new Integer(item.getChannel()));
    }
    if (alChannels.isEmpty()) {
        alChannels.add(1);
    }
    gwtWifiConfig.setChannels(alChannels);
    // security
    String secValue = this.security.getSelectedItemText();
    for (GwtWifiSecurity sec : GwtWifiSecurity.values()) {
        if (MessageUtils.get(sec.name()).equals(secValue)) {
            gwtWifiConfig.setSecurity(sec.name());
        }
    }
    // Pairwise Ciphers
    String pairWiseCiphersValue = this.pairwise.getSelectedItemText();
    for (GwtWifiCiphers ciphers : GwtWifiCiphers.values()) {
        if (MessageUtils.get(ciphers.name()).equals(pairWiseCiphersValue)) {
            gwtWifiConfig.setPairwiseCiphers(ciphers.name());
        }
    }
    // Group Ciphers value
    String groupCiphersValue = this.group.getSelectedItemText();
    for (GwtWifiCiphers ciphers : GwtWifiCiphers.values()) {
        if (MessageUtils.get(ciphers.name()).equals(groupCiphersValue)) {
            gwtWifiConfig.setGroupCiphers(ciphers.name());
        }
    }
    // bgscan
    String bgscanModuleValue = this.bgscan.getSelectedItemText();
    for (GwtWifiBgscanModule module : GwtWifiBgscanModule.values()) {
        if (MessageUtils.get(module.name()).equals(bgscanModuleValue)) {
            gwtWifiConfig.setBgscanModule(module.name());
        }
    }
    // gwtWifiConfig.setBgscanRssiThreshold(rssi.getValue().intValue());
    gwtWifiConfig.setBgscanShortInterval(Integer.parseInt(this.shortI.getText()));
    gwtWifiConfig.setBgscanLongInterval(Integer.parseInt(this.longI.getText()));
    // password
    if (this.groupPassword.getValidationState().equals(ValidationState.NONE)) {
        gwtWifiConfig.setPassword(this.password.getText());
    }
    // ping access point
    gwtWifiConfig.setPingAccessPoint(this.radio1.getValue());
    // ignore SSID
    gwtWifiConfig.setIgnoreSSID(this.radio3.getValue());
    return gwtWifiConfig;
}
Also used : GwtWifiChannelModel(org.eclipse.kura.web.shared.model.GwtWifiChannelModel) GwtWifiCiphers(org.eclipse.kura.web.shared.model.GwtWifiCiphers) GwtWifiConfig(org.eclipse.kura.web.shared.model.GwtWifiConfig) GwtWifiWirelessMode(org.eclipse.kura.web.shared.model.GwtWifiWirelessMode) ArrayList(java.util.ArrayList) GwtWifiSecurity(org.eclipse.kura.web.shared.model.GwtWifiSecurity) GwtWifiRadioMode(org.eclipse.kura.web.shared.model.GwtWifiRadioMode) GwtWifiBgscanModule(org.eclipse.kura.web.shared.model.GwtWifiBgscanModule)

Example 4 with GwtWifiWirelessMode

use of org.eclipse.kura.web.shared.model.GwtWifiWirelessMode in project kura by eclipse.

the class DhcpNatConfigTab method refreshForm.

private void refreshForm() {
    if (m_formPanel != null) {
        if (!m_tcpIpConfigTab.isLanEnabled()) {
            for (Field<?> field : m_formPanel.getFields()) {
                field.setEnabled(false);
            }
        } else {
            GwtWifiWirelessMode wirelessMode = m_wirelessConfigTab.getWirelessMode();
            if (m_selectNetIfConfig.getHwTypeEnum() == GwtNetIfType.WIFI && (wirelessMode == GwtWifiWirelessMode.netWifiWirelessModeStation || wirelessMode == GwtWifiWirelessMode.netWifiWirelessModeDisabled)) {
                for (Field<?> field : m_formPanel.getFields()) {
                    field.setEnabled(false);
                }
            } else {
                for (Field<?> field : m_formPanel.getFields()) {
                    field.setEnabled(true);
                    field.validate();
                }
                String modeValue = m_modeCombo.getValue().getValue();
                if (modeValue == MessageUtils.get(GwtNetRouterMode.netRouterNat.name()) || modeValue == MessageUtils.get(GwtNetRouterMode.netRouterOff.name())) {
                    for (Field<?> field : m_formPanel.getFields()) {
                        if (field != m_modeCombo) {
                            field.setEnabled(false);
                        }
                    }
                } else {
                    for (Field<?> field : m_formPanel.getFields()) {
                        if (field != m_modeCombo) {
                            field.setEnabled(true);
                        }
                    }
                }
            }
        }
    }
}
Also used : GwtWifiWirelessMode(org.eclipse.kura.web.shared.model.GwtWifiWirelessMode)

Example 5 with GwtWifiWirelessMode

use of org.eclipse.kura.web.shared.model.GwtWifiWirelessMode in project kura by eclipse.

the class WirelessConfigTab method getGwtWifiConfig.

private GwtWifiConfig getGwtWifiConfig() {
    GwtWifiConfig gwtWifiConfig = new GwtWifiConfig();
    // mode
    GwtWifiWirelessMode wifiMode = m_modeCombo.getValue().getMode();
    gwtWifiConfig.setWirelessMode(wifiMode.name());
    // ssid
    gwtWifiConfig.setWirelessSsid(GwtSafeHtmlUtils.htmlUnescape(m_ssidField.getValue()));
    // driver
    String driver = "";
    if (GwtWifiWirelessMode.netWifiWirelessModeAccessPoint.equals(wifiMode)) {
        driver = m_selectNetIfConfig.getAccessPointWifiConfig().getDriver();
    } else if (GwtWifiWirelessMode.netWifiWirelessModeAdHoc.equals(wifiMode)) {
        driver = m_selectNetIfConfig.getAdhocWifiConfig().getDriver();
    } else if (GwtWifiWirelessMode.netWifiWirelessModeStation.equals(wifiMode)) {
        driver = m_selectNetIfConfig.getStationWifiConfig().getDriver();
    }
    // use previous value
    gwtWifiConfig.setDriver(driver);
    // radio mode
    String radioValue = m_radioModeCombo.getValue().getValue();
    for (GwtWifiRadioMode mode : GwtWifiRadioMode.values()) {
        if (MessageUtils.get(mode.name()).equals(radioValue)) {
            gwtWifiConfig.setRadioMode(mode.name());
        }
    }
    // channels
    List<GwtWifiChannelModel> lSelectedChannels = m_checkboxChannelSelectionModel.getSelectedItems();
    ArrayList<Integer> alChannels = new ArrayList<Integer>();
    for (GwtWifiChannelModel item : lSelectedChannels) {
        alChannels.add(new Integer(item.getChannel()));
    }
    gwtWifiConfig.setChannels(alChannels);
    // security
    String secValue = m_securityCombo.getValue().getValue();
    for (GwtWifiSecurity sec : GwtWifiSecurity.values()) {
        if (MessageUtils.get(sec.name()).equals(secValue)) {
            gwtWifiConfig.setSecurity(sec.name());
        }
    }
    String pairwiseCiphersValue = m_pairwiseCiphersCombo.getValue().getValue();
    for (GwtWifiCiphers ciphers : GwtWifiCiphers.values()) {
        if (MessageUtils.get(ciphers.name()).equals(pairwiseCiphersValue)) {
            gwtWifiConfig.setPairwiseCiphers(ciphers.name());
        }
    }
    String groupCiphersValue = m_groupCiphersCombo.getValue().getValue();
    for (GwtWifiCiphers ciphers : GwtWifiCiphers.values()) {
        if (MessageUtils.get(ciphers.name()).equals(groupCiphersValue)) {
            gwtWifiConfig.setGroupCiphers(ciphers.name());
        }
    }
    // bgscan
    String bgscanModuleValue = m_bgscanModuleCombo.getValue().getValue();
    for (GwtWifiBgscanModule module : GwtWifiBgscanModule.values()) {
        if (MessageUtils.get(module.name()).equals(bgscanModuleValue)) {
            gwtWifiConfig.setBgscanModule(module.name());
        }
    }
    gwtWifiConfig.setBgscanRssiThreshold(m_bgscanRssiThresholdSlider.getValue());
    gwtWifiConfig.setBgscanShortInterval(m_bgscanShortIntervalField.getValue().intValue());
    gwtWifiConfig.setBgscanLongInterval(m_bgscanLongIntervalField.getValue().intValue());
    // password
    gwtWifiConfig.setPassword(m_passwordField.getValue());
    // ping access point
    gwtWifiConfig.setPingAccessPoint(m_pingAccessPointRadioTrue.getValue().booleanValue());
    // ignore SSID
    gwtWifiConfig.setIgnoreSSID(m_ignoreSsidRadioTrue.getValue().booleanValue());
    return gwtWifiConfig;
}
Also used : GwtWifiChannelModel(org.eclipse.kura.web.shared.model.GwtWifiChannelModel) GwtWifiCiphers(org.eclipse.kura.web.shared.model.GwtWifiCiphers) GwtWifiConfig(org.eclipse.kura.web.shared.model.GwtWifiConfig) GwtWifiWirelessMode(org.eclipse.kura.web.shared.model.GwtWifiWirelessMode) ArrayList(java.util.ArrayList) GwtWifiSecurity(org.eclipse.kura.web.shared.model.GwtWifiSecurity) GwtWifiRadioMode(org.eclipse.kura.web.shared.model.GwtWifiRadioMode) GwtWifiBgscanModule(org.eclipse.kura.web.shared.model.GwtWifiBgscanModule)

Aggregations

GwtWifiWirelessMode (org.eclipse.kura.web.shared.model.GwtWifiWirelessMode)5 GwtWifiConfig (org.eclipse.kura.web.shared.model.GwtWifiConfig)4 ArrayList (java.util.ArrayList)2 GwtWifiBgscanModule (org.eclipse.kura.web.shared.model.GwtWifiBgscanModule)2 GwtWifiChannelModel (org.eclipse.kura.web.shared.model.GwtWifiChannelModel)2 GwtWifiCiphers (org.eclipse.kura.web.shared.model.GwtWifiCiphers)2 GwtWifiNetInterfaceConfig (org.eclipse.kura.web.shared.model.GwtWifiNetInterfaceConfig)2 GwtWifiRadioMode (org.eclipse.kura.web.shared.model.GwtWifiRadioMode)2 GwtWifiSecurity (org.eclipse.kura.web.shared.model.GwtWifiSecurity)2