Skip to content
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

Allow passing binary data #2

Open
daurnimator opened this issue Sep 2, 2014 · 2 comments
Open

Allow passing binary data #2

daurnimator opened this issue Sep 2, 2014 · 2 comments

Comments

@daurnimator
Copy link
Owner

DBus strings must be valid utf-8

Provide a way to deal with binary data.

@daurnimator
Copy link
Owner Author

Binary data can be done with an array of bytes.

It seems reasonable to add an option to append_basic that creates this form.

@ziyao233
Copy link

ziyao233 commented Feb 2, 2025

I'm playing with bluez whose DBus API represents sent/received binary data as byte arrays. A native solution is that pack the data with string.pack() and then pass the string (actually binary data) to ldbus. So I'm willing to take a look with this issue.

The idea to add an option to append_basic() doesn't look good to me:

  • Currently our bindings match well with the DBus C API documentation, one could figure out how the bindings work easily with it. Such a parameter will break the simplicity.
  • The name, append_basic(), doesn't match the new functionality. Anyway, byte array isn't a basic type at all.

I suggest to bind C API dbus_message_iter_append_fixed_array() and dbus_message_iter_get_fixed_array(). We could treat bytearray specially in the binding and convert it to/from Lua strings representing binary data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants