summaryrefslogtreecommitdiffstats
path: root/src/networksettings/connman/qnetworksettingsmanager_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/networksettings/connman/qnetworksettingsmanager_p.cpp')
-rw-r--r--src/networksettings/connman/qnetworksettingsmanager_p.cpp84
1 files changed, 0 insertions, 84 deletions
diff --git a/src/networksettings/connman/qnetworksettingsmanager_p.cpp b/src/networksettings/connman/qnetworksettingsmanager_p.cpp
index a56edca..fe62bbe 100644
--- a/src/networksettings/connman/qnetworksettingsmanager_p.cpp
+++ b/src/networksettings/connman/qnetworksettingsmanager_p.cpp
@@ -39,8 +39,6 @@
QT_BEGIN_NAMESPACE
const QString ConnManServiceName(QStringLiteral("net.connman"));
-const QString QdbdFileName(QStringLiteral("/etc/default/qdbd"));
-const char* SearchKeyword("USB_ETHERNET_PROTOCOL=");
QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent)
:QObject(parent)
@@ -324,86 +322,4 @@ void QNetworkSettingsManagerPrivate::serviceReady()
}
}
-QString QNetworkSettingsManagerPrivate::usbEthernetInternetProtocolAddress()
-{
- QString usbEthernetIp = QLatin1String("Not connected");
- QNetworkInterface interface = QNetworkInterface::interfaceFromName(QLatin1String("usb0"));
- if (interface.flags().testFlag(QNetworkInterface::IsUp)) {
- for (QNetworkAddressEntry &entry:interface.addressEntries()) {
- if (entry.ip().protocol() == QAbstractSocket::IPv4Protocol){
- usbEthernetIp = entry.ip().toString();
- break;
- }
- }
- }
- return usbEthernetIp;
-}
-
-QString QNetworkSettingsManagerPrivate::usbVirtualEthernetLinkProtocol()
-{
- QByteArray line(QNetworkSettingsManagerPrivate::readUsbEthernetProtocolLine());
- QString protocol;
- if (line.size()) {
- int keywordStartIndex(line.indexOf("="));
- line = line.trimmed();
- protocol = QString::fromLatin1( line.mid(keywordStartIndex + 1, (line.length() - 1)).toUpper() );
- }
- return protocol;
-}
-
-bool QNetworkSettingsManagerPrivate::hasUsbEthernetProtocolConfiguration()
-{
- return !(QNetworkSettingsManagerPrivate::readUsbEthernetProtocolLine().isEmpty());
-}
-
-void QNetworkSettingsManagerPrivate::setUsbVirtualEthernetLinkProtocol(const QString &protocol)
-{
- if (QLatin1String("RNDIS") == protocol || QLatin1String("CDCECM") == protocol) {
- QByteArray fileContent(QNetworkSettingsManagerPrivate::readQdbdFileContent());
- writeUsbEthernetProtocolToFileContent(fileContent, protocol);
- } else{
- qWarning("Unsupported USB Ethernet protocol");
- }
-}
-
-QByteArray QNetworkSettingsManagerPrivate::readQdbdFileContent()
-{
- QFile qdbdFile(QdbdFileName);
- QByteArray fileContent;
- if (qdbdFile.open(QIODevice::ReadOnly | QIODevice::Text))
- fileContent = qdbdFile.readAll();
-
- return fileContent;
-}
-
-QByteArray QNetworkSettingsManagerPrivate::readUsbEthernetProtocolLine()
-{
- QByteArray fileContent(QNetworkSettingsManagerPrivate::readQdbdFileContent());
- int keywordStartIndex(fileContent.indexOf(SearchKeyword, 0));
- int keywordLineEndIndex(fileContent.indexOf("\n", keywordStartIndex));
- QByteArray keywordLine = fileContent.mid(keywordStartIndex, keywordLineEndIndex);
- return keywordLine;
-}
-
-void QNetworkSettingsManagerPrivate::writeUsbEthernetProtocolToFileContent(QByteArray &fileContent, const QString &protocol)
-{
- int keywordStartIndex(fileContent.indexOf(SearchKeyword));
- QByteArray previousLines = fileContent.mid(0, keywordStartIndex);
- int keywordLineEndIndex(fileContent.indexOf("\n", keywordStartIndex));
- QByteArray keywordLine = fileContent.mid(keywordStartIndex, keywordLineEndIndex);
- QByteArray followingLines = fileContent.mid((keywordLineEndIndex), (fileContent.length() - 1));
- QByteArray updatedLines = previousLines.append(SearchKeyword);
- updatedLines.append(protocol.toLatin1().toLower());
- updatedLines.append(followingLines);
- QFile qdbdFile(QdbdFileName);
- if (qdbdFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
- int result = qdbdFile.write(updatedLines);
- if (-1 == result)
- qDebug("USB Ethernet protocol write to file failed");
-
- } else {
- qDebug("USB Ethernet protocol file open failed");
- }
-}
-
QT_END_NAMESPACE