Description
DDS subscriber wrapper. Listens for information on a topic.
#include <SynDDSSubscriber.h>
Public Member Functions | |
SynDDSSubscriber (eprosima::fastdds::dds::Subscriber *subscriber, eprosima::fastdds::dds::DataReader *reader, SynDDSDataReaderListener *listener, std::shared_ptr< SynDDSTopic > topic, std::function< void(void *)> callback, void *message, bool is_synchronous=true) | |
Construct a new SynDDSSubscriber object. | |
virtual | ~SynDDSSubscriber () |
Destroy the SynDDSSubscriber object. | |
void | DeleteDDSEntities (eprosima::fastdds::dds::DomainParticipant *participant) |
Delete underlying DDS objects using the passed participant. | |
void | Receive (long double wait_time=20.0) |
This function is responsible for synchronous receiving This will block until a message has been received. | |
void | AsyncReceive () |
This function is responsible for asynchronous receiving This function will return immediately. | |
void | WaitForMatches (unsigned int matches) |
Wait for the specified number of matches Each subscriber listener has a callback that will be called when a subscriber is matched with a DataWriter. | |
void | SetCallback (std::function< void(void *)> callback) |
Set the callback for each receive of a message. | |
void | SetMessage (void *message) |
Set the message type for the SubscriberListener The message is a DDS generated message class that will be used to store the data in an easy to access way. | |
eprosima::fastdds::dds::DataReader * | GetDataReader () |
Get the DDS data reader. | |
bool | IsSynchronous () |
Is the Subscriber set to a synchronous subscriber? | |
eprosima::fastdds::dds::Subscriber * | GetSubscriber () |
Friends | |
class | SynDDSCommunicator |
Member Function Documentation
◆ AsyncReceive()
void chrono::synchrono::SynDDSSubscriber::AsyncReceive | ( | ) |
This function is responsible for asynchronous receiving This function will return immediately.
Underlying calls are asynchronous/non-blocking. When a message is received, the passed function is called and the received data is passed as a parameter to the callback.
◆ Receive()
void chrono::synchrono::SynDDSSubscriber::Receive | ( | long double | wait_time = 20.0 | ) |
This function is responsible for synchronous receiving This will block until a message has been received.
When a message is received, the passed function is called and the received data is passed as a parameter to the callback.
- Parameters
-
wait_time timeout of the synchronous waiting
◆ SetCallback()
|
inline |
Set the callback for each receive of a message.
- Parameters
-
callback the callback function called when a message is receive occurs
◆ WaitForMatches()
void chrono::synchrono::SynDDSSubscriber::WaitForMatches | ( | unsigned int | matches | ) |
Wait for the specified number of matches Each subscriber listener has a callback that will be called when a subscriber is matched with a DataWriter.
This function blocks until that the matches are achieved. By default, a subscriber will just wait for a single listener.
The documentation for this class was generated from the following files:
- C:/M/B/src/chrono-9.0.1/src/chrono_synchrono/communication/dds/SynDDSSubscriber.h
- C:/M/B/src/chrono-9.0.1/src/chrono_synchrono/communication/dds/SynDDSSubscriber.cpp