#include <ddtDataTransferLib.hpp>
Base class for DdtDataPublishers and DdtDataSubscribers.
◆ DdtDataTransferLib() [1/2]
DdtDataTransferLib::DdtDataTransferLib |
( |
DdtLogger * |
ddt_logger | ) |
|
|
explicit |
Constructor
- Parameters
-
ddt_logger | A DDT logger object (no transfer of ownership). |
◆ DdtDataTransferLib() [2/2]
DdtDataTransferLib::DdtDataTransferLib |
( |
log4cplus::Logger const & |
log4cplus_logger | ) |
|
|
explicit |
Constructor
- Parameters
-
log4cplus_logger | A log4cplus logger object (no transfer of ownership). |
◆ ~DdtDataTransferLib()
DdtDataTransferLib::~DdtDataTransferLib |
( |
| ) |
|
|
virtual |
◆ CheckHeartbeatTimeout()
void DdtDataTransferLib::CheckHeartbeatTimeout |
( |
int32_t & |
new_reply_time | ) |
|
|
protected |
Verifies that the heartbeat timeout retrieved from the broker is greater than reply time.
- Parameters
-
new_reply_time | MAL reply time for the case that the client needs to get recreated. |
Make sure the heartbeat timeout is greater than the reply time! If not, recreate MAL client with new reply time.
reset reply_time (the connection manager makes sure that the heartbeat timeout has a valid value (at least 3s)
◆ GetBrokerClient()
std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete< datatransfer::DataBrokerRegistrationSync > > DdtDataTransferLib::GetBrokerClient |
( |
| ) |
|
Retrieve the smart pointer for the client created by the MAL Factory
- Returns
- Unique pointer for DDT Broker Client
◆ GetConfigFilePath()
const std::string DdtDataTransferLib::GetConfigFilePath |
( |
| ) |
|
|
protected |
This function reads the environment variable DDT_TRANSFERCONFIG_PATH and returns path and name of the configuration file.
- Returns
- A string containing the path to the configuration file.
check if DDT_TRANSFERCONFIG_PATH is set return empty string if not set
◆ InitMAL()
int DdtDataTransferLib::InitMAL |
( |
const std::string |
broker_uri | ) |
|
Initializes the MAL.
- Parameters
-
broker_uri | The URI of the broker. |
- Returns
- 1 if initialization was successfull, -1 otherwise.
determine MAL mapping from uri and load it obtain reference to CiiFactory
Synchronous client example w/ ReplyTime QoS set. DataBrokerRegistrationSync interface is requested.
◆ PublishData()
virtual void ddt::DdtDataTransferLib::PublishData |
( |
| ) |
|
|
inlinevirtual |
Function for triggering the local broker to publish data over the network.
Reimplemented in ddt::DdtDataPublisher.
◆ ReadData()
virtual DataSample * ddt::DdtDataTransferLib::ReadData |
( |
| ) |
|
|
inlinevirtual |
◆ RegisterPublisher()
virtual int ddt::DdtDataTransferLib::RegisterPublisher |
( |
const std::string |
uri, |
|
|
const std::string |
dsi, |
|
|
const bool |
compute_crc |
|
) |
| |
|
inlinevirtual |
Function for registering a publisher at the local broker using a MAL client.
- Parameters
-
uri | The MAL Uniform Resource Identifier. |
dsi | The data stream identifier. |
compute_crc | Used to switch on / off the CRC computation. |
- Returns
- Success of registration.
Reimplemented in ddt::DdtDataPublisher.
◆ RegisterSubscriber()
virtual int ddt::DdtDataTransferLib::RegisterSubscriber |
( |
const std::string |
uri, |
|
|
const std::string |
dsi, |
|
|
const std::string |
remote_uri, |
|
|
const int32_t |
interval = 10 |
|
) |
| |
|
inlinevirtual |
Function for registering a subscriber at the local broker using a MAL client.
- Parameters
-
uri | The MAL Uniform Resource Identifier. |
dsi | The data stream identifier. |
remote_uri | The URI of the remote broker. |
interval | The reading interval. |
- Returns
- Success of registration.
Reimplemented in ddt::DdtDataSubscriber.
◆ SetQoS()
void DdtDataTransferLib::SetQoS |
( |
const int |
ddt_latency, |
|
|
const int |
ddt_deadline |
|
) |
| |
Sets quality of service parameters.
- Parameters
-
ddt_latency | A MAL QoS parameter. Shall be the maximum time a sample may remain in-transit between the publisher and subscriber in [ms]. |
ddt_deadline | A MAL QoS parameter. Shall be the maximum age of a sample in [s]. |
◆ StartHeartbeat()
void DdtDataTransferLib::StartHeartbeat |
( |
const int32_t |
interval, |
|
|
const std::string |
id |
|
) |
| |
|
protected |
Starts the heartbeat thread.
- Parameters
-
interval | The heartbeat interval in [s]. |
id | The data stream identifier (in case of a publisher) or the UUID (in case of a subscriber). |
◆ StopHeartbeat()
void DdtDataTransferLib::StopHeartbeat |
( |
| ) |
|
|
protected |
Stops the heartbeat thread.
◆ UnregisterPublisher()
virtual int ddt::DdtDataTransferLib::UnregisterPublisher |
( |
| ) |
|
|
inlinevirtual |
Function for unregistering a publisher from the local broker.
- Returns
- Success of unregistration.
Reimplemented in ddt::DdtDataPublisher.
◆ UnregisterSubscriber()
virtual int ddt::DdtDataTransferLib::UnregisterSubscriber |
( |
| ) |
|
|
inlinevirtual |
Function for unregistering a subscriber from the local broker.
- Returns
- Success of unregistration.
Reimplemented in ddt::DdtDataSubscriber.
◆ VerifyPathInBrokerUri()
const std::string DdtDataTransferLib::VerifyPathInBrokerUri |
( |
std::string |
broker_uri | ) |
|
This function verifies if the broker uri contains the path element. If not specified by the user the path element is added.
- Parameters
-
broker_uri | The URI of the broker. |
- Returns
- The URI of the broker including a path element that is required by MAL.
◆ client
std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete<datatransfer::DataBrokerRegistrationSync> > ddt::DdtDataTransferLib::client |
|
protected |
MAL client used to connect to data brokers.
◆ connected_to_broker
std::atomic<bool> ddt::DdtDataTransferLib::connected_to_broker |
|
protected |
Stores connection state to broker.
◆ connection_listener
elt::mal::rr::ListenerRegistration ddt::DdtDataTransferLib::connection_listener |
|
protected |
Observes the connection to the broker.
◆ deadline
int ddt::DdtDataTransferLib::deadline |
|
protected |
Maximum age of a sample [s].
◆ exit_signal_heartbeat
std::promise<void> ddt::DdtDataTransferLib::exit_signal_heartbeat |
|
protected |
A std::promise object used to stop the heartbeat thread.
◆ future_object_heartbeat
std::future<void> ddt::DdtDataTransferLib::future_object_heartbeat |
|
protected |
A std::future object associated with exit_signal_heartbeat.
◆ heartbeat_active
std::atomic<bool> ddt::DdtDataTransferLib::heartbeat_active |
|
protected |
When the HearbeatThread is stopped it waits until heartbeat_active is set to false.
◆ heartbeat_interval
int32_t ddt::DdtDataTransferLib::heartbeat_interval |
|
protected |
Interval for the heartbeat in [s] retrieved from the data broker.
◆ latency
int ddt::DdtDataTransferLib::latency |
|
protected |
Duration between send and receive cannot be greater than 'latency' [ms].
◆ logger
◆ my_logger
DdtLogger* ddt::DdtDataTransferLib::my_logger = nullptr |
|
protected |
◆ reply_time
int32_t ddt::DdtDataTransferLib::reply_time |
|
protected |
Configurable reply time for MAL clients in [s].
◆ REPLY_TIME_DEFAULT
const int32_t ddt::DdtDataTransferLib::REPLY_TIME_DEFAULT = 6 |
|
protected |
Default value for the reply time.
◆ REPLY_TIME_MIN
const int32_t ddt::DdtDataTransferLib::REPLY_TIME_MIN = 2 |
|
protected |
Minimum value for the reply time.
The documentation for this class was generated from the following files: