Closed terminar closed 5 years ago
Merging #2 into master will increase coverage by
1.43%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #2 +/- ##
==========================================
+ Coverage 87.93% 89.36% +1.43%
==========================================
Files 5 5
Lines 232 235 +3
==========================================
+ Hits 204 210 +6
+ Misses 28 25 -3
Thanks for your interest in this library and your PR! I am going to leave a couple of comments in the review.
I'll check how I can extend the documentation, give an example and take a look at introspect
I've found another situation with call_sync(). Currently, it only returns only one argument but some dbus Methods may return several arguments. I have to check that and will give feedback here. Also, maybe I made a mistake,
return nil, err
is wrong, it should be
return out, err
because "out" can also be a boolean - false (which is also "not true").
OK, return out, err
is fixed. I can't confirm a problem with multiple return results yet, then this PR is finished from my side.
Merged 4ad61bd
Sorry for the late answer, I was out of office.
I'm not working on a NetworkManager library, I am just using the DBus Proxy with the NetworkManager via DBus in an application.
I think it's possible to provide some (small) examples how the NetworkManager can be used. Maybe an "example" folder in the lua-dbus_proxy project is an idea for such stuff?
But I did a small wrapper for the dbus_proxy using metatables to use it like this:
Getting the hostname via NetworkManager:
local dbus = require 'dbus'
local NetworkManager = dbus.org.freedesktop.NetworkManager
local settings =NetworkManager("$/Settings","$.Settings")
return settings.Hostname
Getting all units from Systems:
local dbus = require 'dbus'
local systemd = dbus.org.freedesktop.systemd1
local manager = systemd(nil,"$.Manager")
return manager:ListUnits()
So I have to rewrite the examples or you are not interested in the wrapper-code. It was more readable for me and it uses $ as wildcard for the current "path". For the path, it contains the needed slashes, for the interface, it contains the needed dots.
@terminar, that looks interesting! Why don't you open a new issue to talk about this?
As mentioned at https://github.com/pavouk/lgi/blob/master/docs/guide.md#21-calling-functions-and-methods: Functions reporting errors through GError ** as last argument use Lua standard error reporting - they typically return boolean value indicating either success or failure, and if failure occurs, following return values represent error message and error code.