Exemplo n.º 1
0
QMap<int, NetworkInfo> DBusHandler::networksList() const
{
    QMap<int, NetworkInfo> list;
    Status p_status = status();
    //look for wired connection
    if (call(m_daemon, "GetAlwaysShowWiredInterface").toBool() || call(m_wired, "CheckPluggedIn").toBool()) {
        //a cable is plugged in
        NetworkInfo wirednetwork = wiredProperties();
        if (p_status.State == WicdState::WIRED) {
            wirednetwork.insert("connected", true);
        } else {
            wirednetwork.insert("connected", false);
        }
        list.insert(-1, wirednetwork);
    }
    //wireless
    int nbNetworks = call(m_wireless, "GetNumberOfNetworks").toInt();
    for (int id = 0; id < nbNetworks; ++id) {
        list.insert(id, wirelessProperties(id));
    }
    if (p_status.State == WicdState::WIRELESS) {
        list[call(m_wireless, "GetCurrentNetworkID").toInt()].insert("connected", true);
    }
    return list;
}
Exemplo n.º 2
0
NetworkInfo DBusHandler::wiredProperties() const
{
    NetworkInfo properties;
    properties.insert("networkId", -1);
    properties.insert("essid", i18n("Wired network"));
    properties.insert("currentprofile", m_currentProfile);
    return properties;
}
Exemplo n.º 3
0
NetworkInfo DBusHandler::wirelessProperties(const int &networkId) const
{
    NetworkInfo properties;
    properties.insert("networkId", networkId);
    properties.insert("essid", call(m_wireless, "GetWirelessProperty", networkId, "essid"));
    properties.insert("usedbm", call(m_daemon, "GetSignalDisplayType"));
    properties.insert("strength", call(m_wireless, "GetWirelessProperty", networkId, "strength"));
    properties.insert("quality", call(m_wireless, "GetWirelessProperty", networkId, "quality"));
    properties.insert("encryption", call(m_wireless, "GetWirelessProperty", networkId, "encryption"));
    properties.insert("connected", false);
    if (properties.value("encryption").toBool())
        properties.insert("encryptionType", call(m_wireless, "GetWirelessProperty", networkId, "encryption_method"));
    properties.insert("bssid", call(m_wireless, "GetWirelessProperty", networkId, "bssid"));
    properties.insert("mode", call(m_wireless, "GetWirelessProperty", networkId, "mode"));
    properties.insert("channel", call(m_wireless, "GetWirelessProperty", networkId, "channel"));
    return properties;
}