Closed ostollmann closed 2 years ago
I believe you're passing the toplevel object as a Variant when it should be a simple object. Try this:
const s = {
connection: new Variant('a{sv}', {
id: new Variant('s', 'plc-ethernet'),
type: new Variant('s', 'ethernet'),
'interface-name': new Variant('s', 'iface'),
}),
ipv4: new Variant('a{sv}', {
'address-data': new Variant('aa{sv}', [
{
address: '192.168.0.140',
prefix: '255.255.255.0',
},
]),
gateway: new Variant('s', '192.168.0.1'),
method: new Variant('s', 'manual'),
}),
ipv6: new Variant('a{sv}', {
method: new Variant('s', 'disabled'),
}),
}
Thank you @acrisci! I finally got it to work as follows:
{
connection: {
id: new Variant('s', name),
type: new Variant('s', 'ethernet'),
'interface-name': new Variant('s', iface),
},
ipv4: {
'address-data': new Variant('aa{sv}', [
{
address: new Variant('s', ipAddr),
prefix: new Variant('u', ipPrefix),
},
]),
gateway: new Variant('s', gateway),
method: new Variant('s', 'manual'),
},
ipv6: {
method: new Variant('s', 'disabled'),
},
}
I am trying to call NetworkManager's AddAndActivateConnection2 method which takes an
a{sa{sv}}
argument. I create it as follows:Unfortunately, I get the following error (I also tried making the top-level Variant
a{sv}
but I also get an error):Any idea what may be going wrong? Note that I am not using the Interface class, or so, just plain calling the method on the interface: