8-bit clean bytearray in Python connector

2 posts / 0 new
Last post
Offline
Last seen: 1 year 2 months ago
Joined: 08/28/2023
Posts: 1
8-bit clean bytearray in Python connector

Python3 str type is unicode UTF-8 by default. The bytes or bytearray types are more appropriate to communicate with a peer expecting C strings. In the Connector Python binding, there is a lot of round-tripping between C strings and UTF-8 Python str. This has the possibility of corrupting data or throwing errors when the content is not meant to be UTF-8. On top of that, those operations are slow. There are lower-level and "native" functions within Connector, but I can't find much information about their semantics and best practices.

1. Is there public documentation of these lower-level interfaces?

2. What would be the best way to transmit 8-bit clean bytearrays from Python?

Keywords:
Howard's picture
Offline
Last seen: 1 day 1 hour ago
Joined: 11/29/2012
Posts: 608

The Python Connector was a stop-gap measure while we were developing a full Python API for DDS.  It is now available as an experimental product through RTI's rticommunity github.

Please see the documentation here:

https://community.rti.com/static/documentation/connext-dds/7.1.0/doc/api/connext_dds/api_python/building.html

and the repository here:

https://github.com/rticommunity/connextdds-py

With the Python binding, all supported basic data types are well defined and mapped between all supported languages.  So, 8 bit bytes should be mapped as Octets in IDL and then the bindings to different languages will ensure interoperability.