Hello, please im adding a connection using the following code:

 

 

bool NetworkManager::addWiredDHCPConnection(INTERFACEINFO device) {

    qDBusRegisterMetaType<Connection>();

 

    QDBusInterface dbus_interface("org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManagerSettings",

 
"org.freedesktop.NetworkManagerSettings", QDBusConnection::systemBus());

 

    // Create a new connection object

    Connection connection;

 

    // Build up the 'connection' Setting

    connection["connection"]["uuid"] =
QUuid::createUuid().toString().remove('{').remove('}');

    connection["connection"]["id"] = "Auto " + device.Name;

    connection["connection"]["type"] = "802-3-ethernet";

    connection["connection"]["autoconnect"] = "true";

 

    // Build up the '802-3-ethernet' Setting

    connection["802-3-ethernet"];

 

 

    QString bak=device.INFO_wired.HwAddress;

    QByteArray
mac_device=QByteArray::fromHex(bak.replace(":","").trimmed().toAscii());

 

    connection["802-3-ethernet"]["mac-address"]=QVariant(mac_device);

 

    // Build up the 'ipv4' Setting

    connection["ipv4"]["method"] = "auto";

 

    // Call AddConnection

    QDBusMessage result = dbus_interface.call("AddConnection",
QVariant::fromValue(connection));

    if (result.type() == QDBusMessage::ErrorMessage) {

        qDebug() << QString("Error adding connection: %1
%2").arg(result.errorName()).arg(result.errorMessage());

        return false;

    } else {

        qDebug() << QString("Added Connection");

        return true;

    }

 

    return false;

}

 

 

Now the strange thing is that the connection is added properly:



But it does not dial.

Does anybody know any reason for this behavior?

 

Thank you very much!

 

 

<<image001.png>>

_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to