ddt 1.2.1
|
#include <ddtDataPublisher.hpp>
Protected Attributes | |
int | topic_id |
![]() | |
int | latency |
int | deadline |
int32_t | reply_time |
int32_t | heartbeat_interval |
std::promise< void > | exit_signal_heartbeat |
std::future< void > | future_object_heartbeat |
std::atomic< bool > | heartbeat_active |
std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete< datatransfer::DataBrokerRegistrationSync > > | client |
std::atomic< bool > | connected_to_broker |
elt::mal::rr::ListenerRegistration | connection_listener |
DdtLogger * | logger |
DdtLogger * | my_logger = nullptr |
const int32_t | REPLY_TIME_DEFAULT = 6 |
const int32_t | REPLY_TIME_MIN = 2 |
DdtDataPublisher (DdtLogger *logger) | |
DdtDataPublisher (log4cplus::Logger const &log4cplus_logger) | |
~DdtDataPublisher () override | |
int | RegisterPublisher (const std::string uri, const std::string dsi, const bool compute_crc) override |
int | UnregisterPublisher () override |
void | PublishData () override |
void | SetBufferSize (const int max_sample_size, const int number_samples) |
void | WriteData (const int32_t sample_id, const std::vector< uint8_t > &datavec, const std::vector< uint8_t > &metadatavec) |
void | WriteData (const int32_t sample_id, const uint8_t *const data, const int32_t data_size, const uint8_t *const metadata, const int32_t metadata_size) |
void | set_topic_id (const int id) |
bool | get_connected_to_broker () const |
void | LoadDefaults () |
void | ReadIni () |
Additional Inherited Members | |
![]() | |
virtual int | RegisterSubscriber (const std::string uri, const std::string dsi, const std::string remote_uri, const int32_t interval=10) |
virtual int | UnregisterSubscriber () |
virtual DataSample * | ReadData () |
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 () |
![]() | |
void | StartHeartbeat (const int32_t interval, const std::string id) |
void | StopHeartbeat () |
void | CheckHeartbeatTimeout (int32_t &new_reply_time) |
const std::string | GetConfigFilePath () |
This class provides the functionality for publisher applications to register / unregister at a local broker and to publish 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
bool DdtDataPublisher::get_connected_to_broker | ( | ) | const |
Returns connected_to_broker.
|
protected |
Loads default values for configuration parameters.
|
overridevirtual |
Function for triggering the local broker to publish data over the network.
Reimplemented from ddt::DdtDataTransferLib.
|
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 configured reply time is at least REPLY_TIME_MIN set to default value otherwise
|
overridevirtual |
Function for registering a publisher at the local broker using a MAL client.
uri | The MAL Uniform Resource Identifier. |
dsi | The data stream identifier. |
compute_crc | Used to switch on / off the CRC computation. |
Reimplemented from ddt::DdtDataTransferLib.
void DdtDataPublisher::set_topic_id | ( | const int | id | ) |
Sets the topic_id.
id | The topic ID. |
void DdtDataPublisher::SetBufferSize | ( | const int | max_sample_size, |
const int | number_samples ) |
Specifies the maximum data sample size and the number of samples.
max_sample_size | The maximum data sample size. |
number_samples | The Number of samples stored in the SHM ring buffer. |
|
overridevirtual |
Function for unregistering a publisher from the local broker.
Reimplemented from ddt::DdtDataTransferLib.
void DdtDataPublisher::WriteData | ( | const int32_t | sample_id, |
const std::vector< uint8_t > & | datavec, | ||
const std::vector< uint8_t > & | metadatavec ) |
Writes the data packet into shared memory using a memory accessor.
sample_id | The sample ID. |
datavec | Vector containing the data. |
metadatavec | Vector containing the meta data. |
void DdtDataPublisher::WriteData | ( | const int32_t | sample_id, |
const uint8_t *const | data, | ||
const int32_t | data_size, | ||
const uint8_t *const | metadata, | ||
const int32_t | metadata_size ) |
Writes the data packet into shared memory using a memory accessor. The data is passed as a pointer.
sample_id | The sample ID. |
data | Pointer to the data. |
data_size | The size of the data. |
metadata | Pointer to the meta data. |
metadata_size | The size of the meta data. |
|
protected |
Topic ID of the data