Hi all,
I'm new to Python and DDS and I'm trying to deserialize a byte object using the DynamicData.TopicTypeSupport.from_cdr_buffer API, however it's throwing a TypeError when used as such:
import rti.connextdds as dds
from rti.connextdds import DynamicData
from rti.connextdds import CharSeq
QOS_URL = "file://CloudVehicleGeneric_GenericMessages.xml"
KVP_TYPE_NAME = "CloudVehicleGeneric::GenericMessage"
def test_cdr(kvp_type, buffer):
destinationSample = dds.DynamicData(kvp_type)
DynamicData.TopicTypeSupport.from_cdr_buffer(destinationSample, buffer)
print(destinationSample)
if __name__ == "__main__":
qos_provider = dds.QosProvider(QOS_URL)
my_type = qos_provider.type(qos_provider.type_libraries[0], KVP_TYPE_NAME)
with open("./input/1655228721228.dat", 'rb') as file:
test_cdr(my_type, file.read())
The TypeError is saying that the buffer needs to be of type CharSeq. Is there a conversion that needs to occur in order to use from_cdr_buffer correctly or is my approach incorrect altogether?
Try this: