Using dbus.service.signal decorator
Bogdan Lotko
boguslaw.lotko at chello.at
Wed Jun 14 18:51:20 UTC 2017
Hello,
Attempting to send a signal using the dbus.service.signal decorator (Python 2.6) I've encountered following problem:
@dbus.service.signal('myInterface', 'v(sav(iii))' )
def mySignal(self, message):
pass
...
e = Emitter(bus)
e.mySignal( ('myString', [(1, 1, 1)]) )
Raises the "signal signature is longer than the number of arguments provided" error.
The signal to be sent on wire is:
variant struct {
string "myString"
array [
variant struct {
int32 1
int32 1
int32 1
}
]
}
I think it is exactly what 'v(sav(iii))'defines (one variant).
also ('myString', [(1, 1, 1)]) defines one struct argument
I don't understand the reason of the error in this solution.
Using another approach:
@dbus.service.signal('myInterface', 'v' )
def mySignal(self, message):
pass
...
e = Emitter(bus)
...
arr = dbus.Array( [], signature='(iii)' )
s1 = dbus.Struct( (1,1,1), signature='(iii)', variant_level=1 )
arr.append(s1)
e.mySignal( ('myString', arr) )
works as requested.
Thank you for your help,
with best regards,
--
*Bogdan Lotko*
b.lotko at chello.at
Phone: +43 1 2852458
Mobile: +43 676 6615012
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20170614/80fec4d0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20170614/80fec4d0/attachment.sig>
More information about the dbus
mailing list