Argument Type Subclasses
Lawrence D'Oliveiro
ldo at geek-central.gen.nz
Wed Aug 30 23:35:12 UTC 2017
D-Bus defines separate types for arguments of type “object path”,
“signature” and “Unix FD”, so I thought it made sense to do the same in
my Python binding <https://github.com/ldo/dbussy>. These are subclasses
of string and integer, and the base classes are still acceptable for
those arguments, but the retrieved values are always of the appropriate
subclass:
import dbussy
msg = dbussy.Message.new_method_call \
(
destination = "com.example",
path = "/com/example",
iface = "com.example",
method = "something"
).append_objects("vh", ("s", "stderr"), 2)
print("path = %s" % repr(msg.path))
print("args = %s" % repr(msg.all_objects))
produces output
path = ObjectPath('/com/example')
args = [(Signature('s'), 'stderr'), UnixFD(4)]
More information about the dbus
mailing list