Shouqun / node-dbus

dbus module for node
MIT License
150 stars 70 forks source link

method out signing seem to fail #196

Open FredericGuilbault opened 6 years ago

FredericGuilbault commented 6 years ago

The following code:

var service = DBus.registerService('session', 'org.gnome.foo');
var obj = service.createObject('/org/gnome/foo');
var iface1 = obj.createInterface('org.gnome.foo');

iface1.addMethod('AddBook', {
    in: [DBus.Define(String), DBus.Define(Number)],
    out: [DBus.Define(String), DBus.Define(Number)]
}, function(name, quality, callback) {
        callback('bar',234);

});
iface1.update();

Does not show the good out: signature on d-feet:

dbus

FredericGuilbault commented 6 years ago

If I add console.log(iface1.methods.AddBook); before iface1.update();

The terminal show correct types { handler: [Function], out: [ { type: 's' }, { type: 'd' } ] }

FredericGuilbault commented 6 years ago

I found a workaround this way:

var DBus = require('dbus');
var service = DBus.registerService('session','org.gnome.foo');
var obj = service.createObject('/org/gnome/foo');
var iface1 = obj.createInterface('org.gnome.foo');

iface1.addMethod('AddBook', {
    out:{type:'a(iiissisasii)'}
    }, function( callback) {
        callback(null, [[ 8, 1539615780, 0, '', 'foo', 13, 'bar', [], 1539561600, 58 ]]);
    });

iface1.update();

Im letting this issue opened cuz the method signature is still not reflecting the data sent.

diffgap