Using dbus.service.signal decorator

Bogdan Lotko <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <[email protected]>
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*

[email protected]
Phone: +43 1 2852458
Mobile: +43 676 6615012

_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
signature.asc (application/pgp-signature, 835 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iQIcBAEBAgAGBQJZQYW1AAoJEO4HuQJ0qOU/Y/kP/3ztPZwk4Q58S3bzN1qKQt2Y
qZUPQGBeQAH6v2ACpJfypbIloNECWuLGNko8UoUJp4ko7GBNXS3fJCLo/Jol3Fg6
eZBrMVAa0FNkMsxxUfRxdYV4KEYg0mdn5z6catDK+dsJo8DTmBWI9VHQ+Feq5+Zu
n+WN49y7rzxKJWn4QOzhKmPn/L1Fg7d3rhC2IwDx9hyd4Kl8FYIg+M9Yr7Cgwv8r
uYvBKxA9lajjlrpRa9BQd5OASyG9Fk9qZFGR+6RNCLxycLmqNiXwq8j+vUc44SnN
KNCzlIL3pMA5Bad7JQmY2zKzOgpt7UuaU3QobaaXxTltML5zgvy+gFC2L7tUfs0n
hH6nW1EqaVicl9aIXdK6P1LQUER1lwm9JjqXFIuqb1rp4OiBpzsqv7isdb7T2JBw
0PP2+ezKQCBZhePoa2dl2ul4glKemz1CFsBY8cgNdf8h2V7BwCHHLE/m2IkZGE/E
bk1vSzoja2kz1NKuZmsAsSeYPPmCFXV++aP3idgSPD3z1O+siaiN5m2hZxfv5dl5
EQ+Aw5kqY/+zJhYotHyzj/QZ0sWsXnyXt9QoSJj6uwj9P9Jin7lTIrV3fRbc6xp5
xTYruEmjGsVBSKRmNRU7cnw3j1US+9CjKrodml6hbgi4jlkHIem+z/YU+/9fj7Bq
tG1luZxvAOx+xuv87Irx
=3/Jj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.