-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle DBus structure on the receiver side #76
Comments
I don't believe I added anything like what you're describing for automatic
structure unmarshalling. It sounds like you've worked out the basics though
so if you'd like to send in a patch adding built-in support, I'd be happy
to review and accept it.
Tom
…On Sat, Aug 26, 2017 at 7:35 AM, RomanMeR ***@***.***> wrote:
In the Tx DBus Tutorial <http://pythonhosted.org/txdbus/> it's described
how one could send a structure using dbusOrder class variable. I would like
to have convenient way of unmarshalling such structure on the receiving
side. As of now I presumably invented the wheel with the from_marshalled
method:
class SensorDescription(object):
dbusOrder = ['name', 'parameter', 'type']
def __init__(self, sensor = None):
if sensor != None:
self.name = sensor.name
self.parameter = sensor.parameter
self.type = sensor.type
@classmethod
def from_marshalled(cls, marshalled_item):
assert isinstance(marshalled_item, list)
assert len(marshalled_item) == len(SensorDescription.dbusOrder)
result = cls()
for i in range(0, len(SensorDescription.dbusOrder)):
setattr(result, SensorDescription.dbusOrder[i], marshalled_item[i])
return result
Does txdbus have some way of automatic structure unmarshalling? Maybe I
could register my structure on the client side for unmarshalling and txdbus
would do for me the same as the code in the from_marshalled class method
above?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#76>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABrLfMiIVWrZRRjWBqdCfNOmN95unXhdks5scBD7gaJpZM4PDeEz>
.
|
Thank you Tom for the answer! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the Tx DBus Tutorial it's described how one could send a structure using dbusOrder class variable. I would like to have convenient way of unmarshalling such structure on the receiving side. As of now I presumably invented the wheel with the from_marshalled method:
Does txdbus have some way of automatic structure unmarshalling? Maybe I could register my structure on the client side for unmarshalling and txdbus would do for me the same as the code in the from_marshalled class method above?
The text was updated successfully, but these errors were encountered: