I'm new to python and dbus, but is there a data binding (= a way to send and receive) python classes via dbus-python?
My class looks like this:
class Item:
def __init__(self, one, two, three, four, five, *more):
self.one= one
self.two= two
self.three= three
self.four= four
self.five= five
self.more= more
Where more is a list and one to five are strings. I have a list of these items:
list_items = []
list_items.append(Item('Test','Test','Test','Test',more))
The dbus part looks like this:
@dbus.service.method('com.me.test', in_signature='', out_signature='a(sssssav)')
def get_all_items():
return list_items
Is there an error in my signature or do I have to use a different data structure (tuples?) which can be marshalled?
You could alway use pickle
or marshal
and send your data as eg a byte-string. Else you could alternativly create your own DBus-Object by subclassing from dbus.service.Object
. I would go with the former...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.