|
|
|
@ -15,12 +15,12 @@ QString ConnectionSettingsEngine::targetConnUuidStr = QString();
|
|
|
|
|
* meteredConnection: ConnectionSettingsEngine::Metered
|
|
|
|
|
* device: QString
|
|
|
|
|
* clonedMacAddress: QString
|
|
|
|
|
* !mtu: int
|
|
|
|
|
* mtu: int
|
|
|
|
|
*
|
|
|
|
|
* For Ethernet devices only:
|
|
|
|
|
* !linkNegotiation: QString
|
|
|
|
|
* !linkSpeed: ConnectionSettingsEngine::LinkSpeed
|
|
|
|
|
* !duplexMode: QString
|
|
|
|
|
* autoLinkNegotiation: ConnectionSettingsEngine::LinkNegotiation
|
|
|
|
|
* linkSpeed: ConnectionSettingsEngine::LinkSpeed
|
|
|
|
|
* duplexMode: ConnectionSettingsEngine::DuplexMode
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
ConnectionSettingsEngine::ConnectionSettingsEngine()
|
|
|
|
@ -84,6 +84,57 @@ QVariantMap ConnectionSettingsEngine::readConnectionSettings(QString connUuidStr
|
|
|
|
|
if (!connWiredSetting.isNull()) {
|
|
|
|
|
result.insert("clonedMacAddress", NetworkManager::macAddressAsString(connWiredSetting->clonedMacAddress()));
|
|
|
|
|
result.insert("mtu", connWiredSetting->mtu());
|
|
|
|
|
|
|
|
|
|
if (connWiredSetting->autoNegotiate()) {
|
|
|
|
|
result.insert("autoLinkNegotiation", ConnectionSettingsEngine::NegotiationAutomatic);
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::SpeedUnknown);
|
|
|
|
|
result.insert("duplexMode", ConnectionSettingsEngine::DuplexUnknown);
|
|
|
|
|
} else if (connWiredSetting->speed() != 0 && connWiredSetting->duplexType() != NetworkManager::WiredSetting::UnknownDuplexType) {
|
|
|
|
|
result.insert("autoLinkNegotiation", ConnectionSettingsEngine::NegotiationManual);
|
|
|
|
|
switch (connWiredSetting->speed()) {
|
|
|
|
|
case 10:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed10Mbps);
|
|
|
|
|
break;
|
|
|
|
|
case 100:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed100Mbps);
|
|
|
|
|
break;
|
|
|
|
|
case 1000:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed1Gbps);
|
|
|
|
|
break;
|
|
|
|
|
case 2500:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed2_5Gbps);
|
|
|
|
|
break;
|
|
|
|
|
case 5000:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed5Gbps);
|
|
|
|
|
break;
|
|
|
|
|
case 10000:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed10Gbps);
|
|
|
|
|
break;
|
|
|
|
|
case 40000:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed40Gbps);
|
|
|
|
|
break;
|
|
|
|
|
case 100000:
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::Speed100Gbps);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (connWiredSetting->duplexType()) {
|
|
|
|
|
case NetworkManager::WiredSetting::UnknownDuplexType:
|
|
|
|
|
result.insert("duplexType", ConnectionSettingsEngine::DuplexUnknown);
|
|
|
|
|
break;
|
|
|
|
|
case NetworkManager::WiredSetting::Half:
|
|
|
|
|
result.insert("duplexType", ConnectionSettingsEngine::DuplexHalf);
|
|
|
|
|
break;
|
|
|
|
|
case NetworkManager::WiredSetting::Full:
|
|
|
|
|
result.insert("duplexType", ConnectionSettingsEngine::DuplexFull);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.insert("duplexMode", connWiredSetting->duplexType());
|
|
|
|
|
} else {
|
|
|
|
|
result.insert("autoLinkNegotiation", ConnectionSettingsEngine::NegotiationIgnore);
|
|
|
|
|
result.insert("linkSpeed", ConnectionSettingsEngine::SpeedUnknown);
|
|
|
|
|
result.insert("duplexMode", ConnectionSettingsEngine::DuplexUnknown);
|
|
|
|
|
}
|
|
|
|
|
} else if (!connWirelessSetting.isNull()) {
|
|
|
|
|
result.insert("clonedMacAddress", NetworkManager::macAddressAsString(connWirelessSetting->clonedMacAddress()));
|
|
|
|
|
result.insert("mtu", connWirelessSetting->mtu());
|
|
|
|
@ -155,6 +206,57 @@ void ConnectionSettingsEngine::modifyConnectionSettings(QString connUuidStr, QVa
|
|
|
|
|
if (settings["mtu"].isValid()) {
|
|
|
|
|
connWiredSetting->setMtu(settings["mtu"].toUInt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (settings["autoLinkNegotiation"].isValid()) {
|
|
|
|
|
if (settings["autoLinkNegotiation"].toInt() == ConnectionSettingsEngine::NegotiationAutomatic) {
|
|
|
|
|
connWiredSetting->setAutoNegotiate(true);
|
|
|
|
|
connWiredSetting->setSpeed(0);
|
|
|
|
|
connWiredSetting->setDuplexType(NetworkManager::WiredSetting::UnknownDuplexType);
|
|
|
|
|
} else if (settings["autoLinkNegotiation"].toInt() == ConnectionSettingsEngine::NegotiationManual) {
|
|
|
|
|
connWiredSetting->setAutoNegotiate(false);
|
|
|
|
|
switch (settings["linkSpeed"].toInt()) {
|
|
|
|
|
case ConnectionSettingsEngine::Speed10Mbps:
|
|
|
|
|
connWiredSetting->setSpeed(10);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed100Mbps:
|
|
|
|
|
connWiredSetting->setSpeed(100);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed1Gbps:
|
|
|
|
|
connWiredSetting->setSpeed(1000);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed2_5Gbps:
|
|
|
|
|
connWiredSetting->setSpeed(2500);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed5Gbps:
|
|
|
|
|
connWiredSetting->setSpeed(5000);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed10Gbps:
|
|
|
|
|
connWiredSetting->setSpeed(10000);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed40Gbps:
|
|
|
|
|
connWiredSetting->setSpeed(40000);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::Speed100Gbps:
|
|
|
|
|
connWiredSetting->setSpeed(100000);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (settings["duplexMode"].toInt()) {
|
|
|
|
|
case ConnectionSettingsEngine::DuplexUnknown:
|
|
|
|
|
connWiredSetting->setDuplexType(NetworkManager::WiredSetting::UnknownDuplexType);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::DuplexHalf:
|
|
|
|
|
connWiredSetting->setDuplexType(NetworkManager::WiredSetting::Half);
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionSettingsEngine::DuplexFull:
|
|
|
|
|
connWiredSetting->setDuplexType(NetworkManager::WiredSetting::Full);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
connWiredSetting->setAutoNegotiate(false);
|
|
|
|
|
connWiredSetting->setSpeed(0);
|
|
|
|
|
connWiredSetting->setDuplexType(NetworkManager::WiredSetting::UnknownDuplexType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (!connWirelessSetting.isNull()) {
|
|
|
|
|
if (!wipeClonedMacAddress) {
|
|
|
|
|
connWirelessSetting->setClonedMacAddress(macBin);
|
|
|
|
|