I make extensive use of the DynamicData API for registering, reading and writing TopicData. I have relied on examples provided in this Forum and the Knowledge Base to handle sequences, nested structs, enums, etc. However, I have recently run into a problem with a topic whose definition includes typedefs. My code fails when encountering a member in DDS_DynamicData that was defined in the IDL file with a typedef. It appears that the _type._data fields are not valid for a typedef, but rather the information in _type._data._typeCode should be used. Attached is a simple IDL file. Can you please provide example C code that used tye DynamicData APIs to work with the topic type: SNAExample::DDSBasicData_msg ?
- register the topic type:
- reads a sample for the topic
Thanks.
Mark.
Attachment | Size |
---|---|
IDL file that uses typedef to define struct members | 584 bytes |
Hi Mark,
I have improved the example that I shared with you in the other thread to include also instructions to read the
SNAExample::DDSBasicData_msg
type. Here is the link to pastebin, you will find the code also attached to this post.Note that the topic in my case is called "Example SNAExamples_DDSBasicData_msg", but you can easily change the value of the
typeName
variable. I have tested that it reads/writes communicating with IDL-based publisher and subscriber applications.Please take a look at the example and let me know if it interoperates with your application.
Thanks,
Fernando.