Created
July 19, 2014 11:54
-
-
Save JumpLink/3da5d8df42316fbb0617 to your computer and use it in GitHub Desktop.
org.freedesktop.NetworkManager.Settings.Connection Update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DBus = require('dbus'); | |
var dbus = new DBus(); | |
var util = require('util'); | |
var inspect = function(object) { | |
console.log("\n"+util.inspect(object, showHidden=false, depth=2, colorize=true)+"\n"); | |
} | |
var bus = dbus.getBus('system'); | |
var serviceName = 'org.freedesktop.NetworkManager'; | |
var objectPath = '/org/freedesktop/NetworkManager/Settings/0'; // replace the number 0 this with your settings you want to test, you can use d-feet to pick up the right | |
var interfaceName = 'org.freedesktop.NetworkManager.Settings.Connection'; | |
bus.getInterface(serviceName, objectPath, interfaceName, function(err, iface) { | |
var getSettings = function (callback) { | |
iface.GetSettings['error'] = function (error) { | |
inspect(error); | |
callback(error, null); | |
}; | |
iface.GetSettings['finish'] = function (settings) { | |
inspect(settings); | |
callback(null, settings); | |
}; | |
iface.GetSettings(); | |
} | |
var update = function (settings, callback) { | |
iface.Update['error'] = function (error) { | |
inspect(error); | |
callback(error); | |
}; | |
iface.Update['finish'] = function () { | |
inspect("updated"); | |
callback(null); | |
}; | |
iface.Update(settings); | |
} | |
getSettings(function (error, settings) { | |
update(settings, function (error) { | |
// error === "[Error: org.freedesktop.NetworkManager.Settings.Connection.MissingProperty]" | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment