eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
889 stars 363 forks source link

Listtopics with python #2055

Closed berkeydz closed 4 months ago

berkeydz commented 4 months ago

I'm new to CycloneDDS and I've successfully created publisher-subscriber programs using Python. Now I want to obtain the names of all the topics in the environment so that I can record them. I found the source code written in C, but I couldn't find a resource to implement the same program using Python. Any help would be greatly appreciated.

link for the C source code I have found: https://cyclonedds.io/docs/cyclonedds/latest/examples/listtopics.html

eboasson commented 4 months ago

It works the same way in Python, you create readers for the built-in topics, then read those. The cyclonedds CLI tool does it, you might want to take a look at https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/master/cyclonedds/tools/cli/discovery/main.py