NVIDIA DeepStream SDK API Reference

9.2 Release
MqttCommunicator Class Reference

Detailed Description

MqttCommunicator class is responsible for handling the communication between camera streams running in the same or across different DS instances.

Definition at line 106 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

Inheritance diagram for MqttCommunicator:
Collaboration diagram for MqttCommunicator:

Public Member Functions

 MqttCommunicator ()
 Construct an uninitialized MQTT communicator. More...
 
 MqttCommunicator (const std::string &configFilePath)
 Construct an MQTT communicator from configuration. More...
 
 ~MqttCommunicator () override
 Stop and destroy the MQTT communicator. More...
 
bool isInitialized () override
 Check if the communicator is initialized. More...
 
void initialize (const StreamId streamId, system_clock::time_point start, std::map< StreamId, std::shared_ptr< ICommunicator >> localInstanceCommunicators, const std::string &sensorName="") override
 Initialize the communicator and start its processing loop. More...
 
MessageType available () override
 Return the type of the next buffered message, or NONE when the buffer is empty. More...
 
void requestToSend (Payload payload) override
 Request to send a message. More...
 
void requestToSend (const std::vector< Payload > &payloads) override
 Request to send a message. More...
 
void get (Payload &payload) override
 Get the message from buffer. More...
 
void processMessage (Payload payload) override
 Process an incoming message. More...
 
void broadcast (Payload payload) override
 Broadcast message. More...
 
void broadcast (std::vector< Payload > payloads)
 Broadcast multiple messages through local and MQTT transports. More...
 
void commLog (std::string event, Payload payload)
 Log a communication event. More...
 
void commLatencyLog (TimeStamp sendTime, TimeStamp recvTime)
 Log communication latency. More...
 
COMMUNICATOR_TYPES getCommunicatorType () override
 Return the communicator implementation type. More...
 
StreamId getStreamId ()
 Return the stream identifier for this communicator. More...
 
void initializePubSubInfo ()
 Initialize publish and subscribe topics from configuration. More...
 
CamId getEgoCamId () override
 Return the ego camera ID from the broker topic or camera configuration. More...
 
std::vector< CamId > getPeerCamIds () override
 Return peer camera IDs from broker topics or camera configuration. More...
 
void waitForConnectionCompletion ()
 Wait until all configured MQTT connections complete or time out. More...
 
 MqttCommunicator ()
 Construct an uninitialized MQTT communicator. More...
 
 MqttCommunicator (const std::string &configFilePath)
 Construct an MQTT communicator from configuration. More...
 
 ~MqttCommunicator () override
 Stop and destroy the MQTT communicator. More...
 
bool isInitialized () override
 Check if the communicator is initialized. More...
 
void initialize (const StreamId streamId, system_clock::time_point start, std::map< StreamId, std::shared_ptr< ICommunicator >> localInstanceCommunicators, const std::string &sensorName="") override
 Initialize the communicator and start its processing loop. More...
 
MessageType available () override
 Return the type of the next buffered message, or NONE when the buffer is empty. More...
 
void requestToSend (Payload payload) override
 Request to send a message. More...
 
void requestToSend (const std::vector< Payload > &payloads) override
 Request to send a message. More...
 
void get (Payload &payload) override
 Get the message from buffer. More...
 
void processMessage (Payload payload) override
 Process an incoming message. More...
 
void broadcast (Payload payload) override
 Broadcast message. More...
 
void broadcast (std::vector< Payload > payloads)
 Broadcast multiple messages through local and MQTT transports. More...
 
void commLog (std::string event, Payload payload)
 Log a communication event. More...
 
void commLatencyLog (TimeStamp sendTime, TimeStamp recvTime)
 Log communication latency. More...
 
COMMUNICATOR_TYPES getCommunicatorType () override
 Return the communicator implementation type. More...
 
StreamId getStreamId ()
 Return the stream identifier for this communicator. More...
 
void initializePubSubInfo ()
 Initialize publish and subscribe topics from configuration. More...
 
CamId getEgoCamId () override
 Return the ego camera ID from the broker topic or camera configuration. More...
 
std::vector< CamId > getPeerCamIds () override
 Return peer camera IDs from broker topics or camera configuration. More...
 
void waitForConnectionCompletion ()
 Wait until all configured MQTT connections complete or time out. More...
 

Data Fields

MqttCommunicatorParams m_params
 Stores MQTT communicator configuration parameters. More...
 
std::map< std::string, bool > m_connStatusMap
 Tracks connection completion by broker topic. More...
 

Constructor & Destructor Documentation

◆ MqttCommunicator() [1/4]

MqttCommunicator::MqttCommunicator ( )

Construct an uninitialized MQTT communicator.

◆ MqttCommunicator() [2/4]

MqttCommunicator::MqttCommunicator ( const std::string &  configFilePath)

Construct an MQTT communicator from configuration.

Parameters
[in]configFilePathPath to the configuration file.

◆ ~MqttCommunicator() [1/2]

MqttCommunicator::~MqttCommunicator ( )
override

Stop and destroy the MQTT communicator.

◆ MqttCommunicator() [3/4]

MqttCommunicator::MqttCommunicator ( )

Construct an uninitialized MQTT communicator.

◆ MqttCommunicator() [4/4]

MqttCommunicator::MqttCommunicator ( const std::string &  configFilePath)

Construct an MQTT communicator from configuration.

Parameters
[in]configFilePathPath to the configuration file.

◆ ~MqttCommunicator() [2/2]

MqttCommunicator::~MqttCommunicator ( )
override

Stop and destroy the MQTT communicator.

Member Function Documentation

◆ available() [1/2]

MessageType MqttCommunicator::available ( )
overridevirtual

Return the type of the next buffered message, or NONE when the buffer is empty.

Implements ICommunicator.

◆ available() [2/2]

MessageType MqttCommunicator::available ( )
overridevirtual

Return the type of the next buffered message, or NONE when the buffer is empty.

Implements ICommunicator.

◆ broadcast() [1/4]

void MqttCommunicator::broadcast ( Payload  payload)
overridevirtual

Broadcast message.

Parameters
[in]payloadMessage to broadcast.

Implements ICommunicator.

◆ broadcast() [2/4]

void MqttCommunicator::broadcast ( Payload  payload)
overridevirtual

Broadcast message.

Parameters
[in]payloadMessage to broadcast.

Implements ICommunicator.

◆ broadcast() [3/4]

void MqttCommunicator::broadcast ( std::vector< Payload >  payloads)

Broadcast multiple messages through local and MQTT transports.

Parameters
[in]payloadsMessages to broadcast.

◆ broadcast() [4/4]

void MqttCommunicator::broadcast ( std::vector< Payload >  payloads)

Broadcast multiple messages through local and MQTT transports.

Parameters
[in]payloadsMessages to broadcast.

◆ commLatencyLog() [1/2]

void MqttCommunicator::commLatencyLog ( TimeStamp  sendTime,
TimeStamp  recvTime 
)

Log communication latency.

Parameters
[in]sendTimeTimestamp when the message was sent.
[in]recvTimeTimestamp when the message was received.

◆ commLatencyLog() [2/2]

void MqttCommunicator::commLatencyLog ( TimeStamp  sendTime,
TimeStamp  recvTime 
)

Log communication latency.

Parameters
[in]sendTimeTimestamp when the message was sent.
[in]recvTimeTimestamp when the message was received.

◆ commLog() [1/2]

void MqttCommunicator::commLog ( std::string  event,
Payload  payload 
)

Log a communication event.

Parameters
[in]eventEvent name.
[in]payloadPayload to log.

◆ commLog() [2/2]

void MqttCommunicator::commLog ( std::string  event,
Payload  payload 
)

Log a communication event.

Parameters
[in]eventEvent name.
[in]payloadPayload to log.

◆ get() [1/2]

void MqttCommunicator::get ( Payload &  payload)
overridevirtual

Get the message from buffer.

Parameters
[out]payloadMessage removed from the input buffer.

Implements ICommunicator.

◆ get() [2/2]

void MqttCommunicator::get ( Payload &  payload)
overridevirtual

Get the message from buffer.

Parameters
[out]payloadMessage removed from the input buffer.

Implements ICommunicator.

◆ getCommunicatorType() [1/2]

COMMUNICATOR_TYPES MqttCommunicator::getCommunicatorType ( )
inlineoverridevirtual

Return the communicator implementation type.

Implements ICommunicator.

Definition at line 194 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

References MQTT_COMMUNICATOR.

◆ getCommunicatorType() [2/2]

COMMUNICATOR_TYPES MqttCommunicator::getCommunicatorType ( )
inlineoverridevirtual

Return the communicator implementation type.

Implements ICommunicator.

Definition at line 194 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

References MQTT_COMMUNICATOR.

◆ getEgoCamId() [1/2]

CamId MqttCommunicator::getEgoCamId ( )
inlineoverridevirtual

Return the ego camera ID from the broker topic or camera configuration.

Reimplemented from ICommunicator.

Definition at line 203 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ getEgoCamId() [2/2]

CamId MqttCommunicator::getEgoCamId ( )
inlineoverridevirtual

Return the ego camera ID from the broker topic or camera configuration.

Reimplemented from ICommunicator.

Definition at line 203 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ getPeerCamIds() [1/2]

std::vector<CamId> MqttCommunicator::getPeerCamIds ( )
inlineoverridevirtual

Return peer camera IDs from broker topics or camera configuration.

Reimplemented from ICommunicator.

Definition at line 209 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ getPeerCamIds() [2/2]

std::vector<CamId> MqttCommunicator::getPeerCamIds ( )
inlineoverridevirtual

Return peer camera IDs from broker topics or camera configuration.

Reimplemented from ICommunicator.

Definition at line 209 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ getStreamId() [1/2]

StreamId MqttCommunicator::getStreamId ( )
inline

Return the stream identifier for this communicator.

Definition at line 197 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ getStreamId() [2/2]

StreamId MqttCommunicator::getStreamId ( )
inline

Return the stream identifier for this communicator.

Definition at line 197 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ initialize() [1/2]

void MqttCommunicator::initialize ( const StreamId  streamId,
system_clock::time_point  start,
std::map< StreamId, std::shared_ptr< ICommunicator >>  localInstanceCommunicators,
const std::string &  sensorName = "" 
)
overridevirtual

Initialize the communicator and start its processing loop.

Parameters
[in]streamIdStream identifier for this communicator.
[in]startReference start time for timestamp conversion.
[in]localInstanceCommunicatorsCommunicators for local streams.
[in]sensorNameSensor name used by external transports.

Implements ICommunicator.

◆ initialize() [2/2]

void MqttCommunicator::initialize ( const StreamId  streamId,
system_clock::time_point  start,
std::map< StreamId, std::shared_ptr< ICommunicator >>  localInstanceCommunicators,
const std::string &  sensorName = "" 
)
overridevirtual

Initialize the communicator and start its processing loop.

Parameters
[in]streamIdStream identifier for this communicator.
[in]startReference start time for timestamp conversion.
[in]localInstanceCommunicatorsCommunicators for local streams.
[in]sensorNameSensor name used by external transports.

Implements ICommunicator.

◆ initializePubSubInfo() [1/2]

void MqttCommunicator::initializePubSubInfo ( )

Initialize publish and subscribe topics from configuration.

◆ initializePubSubInfo() [2/2]

void MqttCommunicator::initializePubSubInfo ( )

Initialize publish and subscribe topics from configuration.

◆ isInitialized() [1/2]

bool MqttCommunicator::isInitialized ( )
overridevirtual

Check if the communicator is initialized.

Returns
True if the communicator is initialized.

Implements ICommunicator.

◆ isInitialized() [2/2]

bool MqttCommunicator::isInitialized ( )
overridevirtual

Check if the communicator is initialized.

Returns
True if the communicator is initialized.

Implements ICommunicator.

◆ processMessage() [1/2]

void MqttCommunicator::processMessage ( Payload  payload)
overridevirtual

Process an incoming message.

Parameters
[in]payloadIncoming message to place in the input buffers.

Implements ICommunicator.

◆ processMessage() [2/2]

void MqttCommunicator::processMessage ( Payload  payload)
overridevirtual

Process an incoming message.

Parameters
[in]payloadIncoming message to place in the input buffers.

Implements ICommunicator.

◆ requestToSend() [1/4]

void MqttCommunicator::requestToSend ( const std::vector< Payload > &  payloads)
overridevirtual

Request to send a message.

Parameters
[in]payloadsMessages to send.

Implements ICommunicator.

◆ requestToSend() [2/4]

void MqttCommunicator::requestToSend ( const std::vector< Payload > &  payloads)
overridevirtual

Request to send a message.

Parameters
[in]payloadsMessages to send.

Implements ICommunicator.

◆ requestToSend() [3/4]

void MqttCommunicator::requestToSend ( Payload  payload)
overridevirtual

Request to send a message.

Parameters
[in]payloadMessage to send.

Implements ICommunicator.

◆ requestToSend() [4/4]

void MqttCommunicator::requestToSend ( Payload  payload)
overridevirtual

Request to send a message.

Parameters
[in]payloadMessage to send.

Implements ICommunicator.

◆ waitForConnectionCompletion() [1/2]

void MqttCommunicator::waitForConnectionCompletion ( )

Wait until all configured MQTT connections complete or time out.

◆ waitForConnectionCompletion() [2/2]

void MqttCommunicator::waitForConnectionCompletion ( )

Wait until all configured MQTT connections complete or time out.

Field Documentation

◆ m_connStatusMap

std::map< std::string, bool > MqttCommunicator::m_connStatusMap

Tracks connection completion by broker topic.

Definition at line 218 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.

◆ m_params

MqttCommunicatorParams MqttCommunicator::m_params

Stores MQTT communicator configuration parameters.

Definition at line 217 of file sources/libs/nvmultiobjecttracker/include/modules/MultiViewAssociator/MqttCommunicator.hpp.


The documentation for this class was generated from the following file: