sidorares / dbus-native

D-bus protocol client and server for node.js written in native javascript
Other
259 stars 93 forks source link

NetworkManager - AddConnection not working #260

Open petergerten opened 5 years ago

petergerten commented 5 years ago

Hi,

I try to translate the python example https://github.com/lcp/NetworkManager/blob/master/examples/python/add-connection.py to dbus-native.

but always get[ 'connection: setting not found' ]

My code looks like this:

systemBus.invoke(
    {
        path: '/org/freedesktop/NetworkManager/Settings',
        destination: 'org.freedesktop.NetworkManager',
        interface: 'org.freedesktop.NetworkManager.Settings',
        member: 'AddConnection',
        signature: 'a{sa{sv}}',
        body: [
        {
            '802-3-ethernet': {
            'duplex': 'full'
        },
        'connection': {
            'type': '802-3-ethernet',
            'uuid': 'cccccccccccccccccccccccc',
            'id': 'MyConnectionExample'
        },
        'ipv4': {
            'method': 'ignore'
        },
        'ipv6': {
            'method': 'ignore'
        }
        }
    ]
    ,       
    type: dbus.messageType.methodCall
    },
    function(err, res) {
        console.log(err, res);
    }
);

I suspect I might set something wrong in the body. Any suggestions?

madhusudanhj commented 11 months ago

I think the body is what's wrong. Sample.

[["connection",[["autoconnect-priority",["i",-999]],["id",["s","Wired connection 1"]],["interface-name",["s","ens160"]],["timestamp",["t",1699619344]],["type",["s","802-3-ethernet"]],["uuid",["s","4871f1e7-4149-39d6-abf9-19148f984b02"]]]],["802-3-ethernet",[["auto-negotiate",["b",false]]]],["ipv4",[["method",["s","auto"]]]],["ipv6",[["method",["s","disabled"]]]]]