#include <ddtDataSubscriber.hpp>
Public Member Functions | |
| DdtDataSubscriber (DdtLogger *logger) | |
| DdtDataSubscriber (log4cplus::Logger const &log4cplus_logger) | |
| ~DdtDataSubscriber () override | |
| int | RegisterSubscriber (const std::string uri, const std::string dsi, const std::string remote_uri, const int32_t interval=10) override |
| int | UnregisterSubscriber () override |
| DataSample * | ReadData () override |
| void | StartNotificationSubscription () |
| void | StopNotificationSubscription () |
| DdtStatistics | get_statistics () |
| boost::signals2::connection | connect (const SignalT::slot_type &event_listener) |
Public Member Functions inherited from ddt::DdtDataTransferLib | |
| DdtDataTransferLib (DdtLogger *ddt_logger) | |
| DdtDataTransferLib (log4cplus::Logger const &log4cplus_logger) | |
| virtual | ~DdtDataTransferLib () |
| void | SetQoS (const int ddt_latency, const int ddt_deadline) |
| const std::string | VerifyPathInBrokerUri (std::string broker_uri) |
| int | InitMAL (const std::string broker_uri) |
| std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete< datatransfer::DataBrokerRegistrationSync > > | GetBrokerClient () |
| virtual int | RegisterPublisher (const std::string uri, const std::string dsi, const bool compute_crc) |
| virtual int | UnregisterPublisher () |
| virtual void | PublishData () |
| boost::signals2::connection | ConnectToConnectionState (const std::function< void(ConnectionState)> &callback) |
Protected Member Functions | |
| void | LoadDefaults () |
| void | StopThreads () override |
| void | ReadIni () |
Protected Member Functions inherited from ddt::DdtDataTransferLib | |
| void | StartHeartbeat (const int32_t interval, const std::string id) |
| void | StopHeartbeat () |
| void | Reconnect () |
| void | CheckHeartbeatTimeout (int32_t &new_reply_time) |
| void | NotifyConnectionState (ConnectionState state) |
| const std::string | GetConfigFilePath () |
| void | SpawnReconnectionThread () |
Protected Attributes | |
| int32_t | max_age_data_sample = 0 |
| const int32_t | MAX_AGE_DATA_SAMPLE_DEFAULT = 10000 |
Protected Attributes inherited from ddt::DdtDataTransferLib | |
| int | latency = 0 |
| int | deadline = 0 |
| int32_t | reply_time = 0 |
| int32_t | heartbeat_interval = 0 |
| std::thread | hb_thread |
| std::thread | reconnect_thread |
| std::atomic< bool > | reconnect_pending {false} |
| std::mutex | hb_cv_mutex |
| std::condition_variable | hb_cv |
| std::atomic< bool > | heartbeat_active {false} |
| std::atomic< bool > | shutdown_in_progress {false} |
| std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete< datatransfer::DataBrokerRegistrationSync > > | client |
| std::atomic< bool > | connected_to_broker {false} |
| ConnectionStateSignalT | connection_state_signal |
| std::atomic< ConnectionState > | last_notified_state {ConnectionState::Disconnected} |
| std::string | broker_uri |
| elt::mal::rr::ListenerRegistration | connection_listener |
| DdtLogger * | logger = nullptr |
| DdtLogger * | my_logger = nullptr |
| const int32_t | REPLY_TIME_DEFAULT = 6 |
| const int32_t | REPLY_TIME_MIN = 2 |
| int32_t | wait_for_connection = 0 |
| const int32_t | WAIT_FOR_CONNECTION_DEFAULT = 10 |
| const int32_t | WAIT_FOR_CONNECTION_MIN = 2 |
| int32_t | max_consecutive_failures = 0 |
| const int32_t | MAX_CONSECUTIVE_FAILURES_DEFAULT = 3 |
| const int32_t | MAX_CONSECUTIVE_FAILURES_MIN = 1 |
Additional Inherited Members | |
Public Types inherited from ddt::DdtDataTransferLib | |
| enum class | ConnectionState { Disconnected = 0 , Connected , Reconnecting , PublisherDisconnected } |
| using | ConnectionStateSignalT = boost::signals2::signal<void(ConnectionState)> |
This class provides the functionality for subscriber applications to register / unregister at a local broker and to receive data for a specified data stream.
|
explicit |
Constructor
| logger | A DDT logger object (no transfer of ownership). |
|
explicit |
Constructor, taking a log4cplus logger as input
| log4cplus_logger | A log4cplus logger object (no transfer of ownership). |
|
override |
Destructor
| boost::signals2::connection DdtDataSubscriber::connect | ( | const SignalT::slot_type & | event_listener | ) |
Connects the event_listener with the DataAvailableSignal from the memory accessor.
| event_listener | Slot for the DataAvailable signal. |
| DdtStatistics DdtDataSubscriber::get_statistics | ( | ) |
Returns the statistics.
|
protected |
Loads default values for configuration parameters.
|
overridevirtual |
|
protected |
Reads the datatransferlib configuration file.
An exception is thrown if the config file does not exist. In that case the default values are used instead.
make sure max_age_data_sample is at least MAX_AGE_DATA_SAMPLE_MIN set to default value otherwise
make sure reply_time is at least REPLY_TIME_MIN set to default value otherwise
|
overridevirtual |
Function for registering a subscriber at the local broker using a MAL client.
| uri | The MAL Uniform Resource Identifier. |
| dsi | The data stream identifier. |
| remote_uri | The URI of the remote broker. |
| interval | The reading interval. |
Reimplemented from ddt::DdtDataTransferLib.
| void DdtDataSubscriber::StartNotificationSubscription | ( | ) |
Starts MAL subscription for notifications as a separate thread.
| void DdtDataSubscriber::StopNotificationSubscription | ( | ) |
Stops MAL subscription.
|
overrideprotectedvirtual |
Sends stop to all running threads and joins them.
Reimplemented from ddt::DdtDataTransferLib.
|
overridevirtual |
Function for unregistering a subscriber from the local broker.
Reimplemented from ddt::DdtDataTransferLib.
|
protected |
Configurable time window for dropping data samples in [ms].
|
protected |
Default value of the time window for dropping data samples in [ms].