Hi,
I feel a bit stupid but I can’t get this to work.
Using gdbus I can do this:
gdbus call --session --dest=org.freedesktop.systemd1 --object-path /org/freedesktop/systemd1 --method org.freedesktop.systemd1.Manager.ListUnitsFiltered "[ 'listening' ]"
which prints an array of dbus objects.
Trying the equivalent in QML I always get:
[W] :52 - DBus call failed: org.freedesktop.DBus.Error.InvalidArgs message: Invalid arguments 'av' to call org.freedesktop.systemd1.Manager.ListUnitsFiltered(), expecting 'as'.
[W] :52 - DBus call failed: org.freedesktop.DBus.Error.InvalidArgs message: Invalid arguments 's' to call org.freedesktop.systemd1.Manager.ListUnitsFiltered(), expecting 'as'.
This is what I try in qml:
import QtQuick 2.0
import Sailfish.Silica 1.0
import Nemo.DBus 2.0
// systemd manager
DBusInterface {
id: systemd
bus: DBus.SessionBus
service: "org.freedesktop.systemd1"
path: "/org/freedesktop/systemd1"
iface: "org.freedesktop.systemd1.Manager"
function unitList() {
// call('ListUnitsFiltered', [ "listening" ], // <--- complains about 's'
call('ListUnitsFiltered', [ ["listening",] ], // <--- complains about 'av'
function (result) { console.debug('DBus call result: ' + result) },
function (error, message) { console.warn('DBus call failed: ', error, 'message: ', message) }
)
}
}
Component.onCompleted: checkSocketState()
function checkSocketState() {
console.log(systemd.unitList());
}