Skip to content

Commit

Permalink
Python exposes dds-topic-reader-thread as topic-reader
Browse files Browse the repository at this point in the history
  • Loading branch information
OhadMeir committed Feb 5, 2025
1 parent eb889f6 commit af2125e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions third-party/realdds/py/pyrealdds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <realdds/dds-guid.h>
#include <realdds/dds-time.h>
#include <realdds/dds-topic.h>
#include <realdds/dds-topic-reader.h>
#include <realdds/dds-topic-reader-thread.h>
#include <realdds/dds-topic-writer.h>
#include <realdds/dds-publisher.h>
#include <realdds/dds-subscriber.h>
Expand Down Expand Up @@ -461,7 +461,8 @@ PYBIND11_MODULE(NAME, m) {
} );

using realdds::dds_topic_reader;
py::class_< dds_topic_reader, std::shared_ptr< dds_topic_reader > >( m, "topic_reader" )
using realdds::dds_topic_reader_thread;
py::class_< dds_topic_reader_thread, std::shared_ptr< dds_topic_reader_thread > >( m, "topic_reader" )
.def( py::init< std::shared_ptr< dds_topic > const & >() )
.def( FN_FWD( dds_topic_reader, on_data_available, (dds_topic_reader *), (), callback( self ); ) )
.def( FN_FWD( dds_topic_reader,
Expand All @@ -475,7 +476,7 @@ PYBIND11_MODULE(NAME, m) {
(eprosima::fastdds::dds::SampleLostStatus const & status),
callback( self, status.total_count, status.total_count_change ); ) )
.def( "topic", &dds_topic_reader::topic )
.def( "run", &dds_topic_reader::run )
.def( "run", &dds_topic_reader_thread::run )
.def( "wait_for_writers", &dds_topic_reader::wait_for_writers )
.def( "stop", &dds_topic_reader::stop,
// GIL release needed: stop will wait and cause a hang if we're inside a callback
Expand Down
4 changes: 4 additions & 0 deletions unit-tests/dds/test-control-reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#test:retries 2

from rspy import log, test
import time
import pyrealdds as dds
dds.debug( log.is_debug_on() )

Expand Down Expand Up @@ -140,5 +141,8 @@ def control( device, json, n=1 ):
test.check_equal( reply_count[device2.guid()], dev2_replies + 1 )

device = None
remote.run( 'server = None' )
time.sleep(0.050) # Give server and device time to close gracefully

test.print_results()

0 comments on commit af2125e

Please sign in to comment.