DDS subscriber wrapper. Listens for information on a topic.
#include <SynDDSSubscriber.h>
|
| 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. More...
|
|
virtual | ~SynDDSSubscriber () |
| Destroy the SynDDSSubscriber object. More...
|
|
void | DeleteDDSEntities (eprosima::fastdds::dds::DomainParticipant *participant) |
| Delete underlying DDS objects using the passed participant. More...
|
|
void | Receive (long double wait_time=20.0) |
| This function is responsible for synchronous receiving This will block until a message has been received. More...
|
|
void | AsyncReceive () |
| This function is responsible for asynchronous receiving This function will return immediately. More...
|
|
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. More...
|
|
void | SetCallback (std::function< void(void *)> callback) |
| Set the callback for each receive of a message. More...
|
|
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. More...
|
|
eprosima::fastdds::dds::DataReader * | GetDataReader () |
| Get the DDS data reader. More...
|
|
bool | IsSynchronous () |
| Is the Subscriber set to a synchronous subscriber? More...
|
|
eprosima::fastdds::dds::Subscriber * | GetSubscriber () |
|
◆ SynDDSSubscriber()
chrono::synchrono::SynDDSSubscriber::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 |
|
) |
| |
◆ ~SynDDSSubscriber()
chrono::synchrono::SynDDSSubscriber::~SynDDSSubscriber |
( |
| ) |
|
|
virtual |
◆ 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.
◆ DeleteDDSEntities()
void chrono::synchrono::SynDDSSubscriber::DeleteDDSEntities |
( |
eprosima::fastdds::dds::DomainParticipant * |
participant | ) |
|
Delete underlying DDS objects using the passed participant.
◆ GetDataReader()
eprosima::fastdds::dds::DataReader* chrono::synchrono::SynDDSSubscriber::GetDataReader |
( |
| ) |
|
|
inline |
◆ IsSynchronous()
bool chrono::synchrono::SynDDSSubscriber::IsSynchronous |
( |
| ) |
|
|
inline |
Is the Subscriber set to a synchronous subscriber?
◆ 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()
void chrono::synchrono::SynDDSSubscriber::SetCallback |
( |
std::function< void(void *)> |
callback | ) |
|
|
inline |
Set the callback for each receive of a message.
- Parameters
-
callback | the callback function called when a message is receive occurs |
◆ SetMessage()
void chrono::synchrono::SynDDSSubscriber::SetMessage |
( |
void * |
message | ) |
|
|
inline |
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.
◆ 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:
- /builds/uwsbel/chrono/src/chrono_synchrono/communication/dds/SynDDSSubscriber.h
- /builds/uwsbel/chrono/src/chrono_synchrono/communication/dds/SynDDSSubscriber.cpp