• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Protocols - MQTT I/O
  • MQTTClient
  • 5.0.2

MQTTClient Class

(MQTTIO::MQTTClient)
Inherits: IOServer, OSAPIThread, and
  • List of all members, including inherited members

Public Types

class AliasInfo
class SubscriptionResult

Public Functions

MQTTClient()
~MQTTClient() override
AliasInfo GetAlias(const std::string &topic)
int GetClientProtocolVersion() const
double GetFs() const
void IncreasePublishedCount()
void IncreaseSubscribedCount()
void NotifyWorkerThreadMessageQueueNeedsService()
void RemoveAlias(const std::string &topic)
void SetLastMessageTimestamp()
SubscriptionResult SubscribeToTopic(std::string topic, unsigned short qos, std::variant<unsigned int, TopicBase *> subscriber)
void UngracefullyCloseConnection()
void UnsubscribeFromTopic(std::string topic, unsigned short qos)

Reimplemented Public Functions

virtual void Activate() override
virtual void Create(const char *fullName) override
virtual void Destroy() override
virtual int GetDebugLevel() override
virtual void Suspend() override
  • 32 public functions inherited from IOServer
  • 1 public function inherited from OSAPIThread
  • 92 public functions inherited from CDPComponent
  • 15 public functions inherited from OSAPITask
  • 39 public functions inherited from CDPObject
  • 49 public functions inherited from CDPBaseObject
  • 27 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Protected Functions

void ConnectBroker()
std::string GenerateClientID(const std::string &baseString)
unsigned int GetMaxSubscriptionId() const
bool IsConnectionParamsChanged()
void ProcessMessageQueue()
void PublishFromMessage(unsigned int clientHandle, const std::string_view messagePayload)
void PublishLWTOnConnect()
void PublishLWTOnDisconnect()
void QueueRPCMessageToWorkerThread(const MessagePacketHandle &procedure)
void SendConnectionStatus(unsigned int clientHandle)
void SetConnected(bool newStatus)
void SubscribeFromMessage(unsigned int clientHandle, const std::string_view messagePayload)
void WaitForReconnectTimeoutOrStop()
void on_connect(int rc, int flags, const mosquitto_property *properties) override
void on_disconnect(int rc, const mosquitto_property *properties) override
void on_log(int level, const char *log) override

Reimplemented Protected Functions

virtual void Configure(const char *xml) override
virtual void FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const override
virtual bool HandleXMLElement(XMLElementEx *XMLel) override
virtual bool IsCommProblem() override
virtual void Main() override
virtual void ProcessOffline() override
virtual void ProcessOnline() override
virtual void SetPropertyHandler(CDPPropertyBase *pProp) override
  • 1 protected function inherited from IOServer
  • 1 protected function inherited from OSAPIThread
  • 12 protected functions inherited from CDPComponent
  • 15 protected functions inherited from CDPObject
  • 1 protected function inherited from CDP::StudioAPI::CDPNode

Additional Inherited Members

  • 2 static public members inherited from CDPComponent
  • 6 static public members inherited from CDPObject
  • 1 static public member inherited from CDPBaseObject
  • 8 protected variables inherited from IOServer
  • 42 protected variables inherited from CDPComponent
  • 1 protected type inherited from OSAPITask
  • 9 protected variables inherited from CDPObject
  • 10 protected variables inherited from CDPBaseObject

Member Function Documentation

MQTTClient::MQTTClient()

Default constructs an instance of MQTTClient.

MQTTClient::~MQTTClient()

Destroys the instance of MQTTClient.

[override virtual] void MQTTClient::Activate()

[override virtual protected] void MQTTClient::Configure(const char *xml)

[protected] void MQTTClient::ConnectBroker()

[override virtual] void MQTTClient::Create(const char *fullName)

[override virtual] void MQTTClient::Destroy()

[override virtual protected] void MQTTClient::FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const

[protected] std::string MQTTClient::GenerateClientID(const std::string &baseString)

AliasInfo MQTTClient::GetAlias(const std::string &topic)

int MQTTClient::GetClientProtocolVersion() const

[override virtual] int MQTTClient::GetDebugLevel()

double MQTTClient::GetFs() const

[protected] unsigned int MQTTClient::GetMaxSubscriptionId() const

[override virtual protected] bool MQTTClient::HandleXMLElement(XMLElementEx *XMLel)

void MQTTClient::IncreasePublishedCount()

void MQTTClient::IncreaseSubscribedCount()

[override virtual protected] bool MQTTClient::IsCommProblem()

[protected] bool MQTTClient::IsConnectionParamsChanged()

[override virtual protected] void MQTTClient::Main()

void MQTTClient::NotifyWorkerThreadMessageQueueNeedsService()

[protected] void MQTTClient::ProcessMessageQueue()

[override virtual protected] void MQTTClient::ProcessOffline()

[override virtual protected] void MQTTClient::ProcessOnline()

[protected] void MQTTClient::PublishFromMessage(unsigned int clientHandle, const std::string_view messagePayload)

[protected] void MQTTClient::PublishLWTOnConnect()

[protected] void MQTTClient::PublishLWTOnDisconnect()

[protected] void MQTTClient::QueueRPCMessageToWorkerThread(const MessagePacketHandle &procedure)

void MQTTClient::RemoveAlias(const std::string &topic)

[protected] void MQTTClient::SendConnectionStatus(unsigned int clientHandle)

[protected] void MQTTClient::SetConnected(bool newStatus)

void MQTTClient::SetLastMessageTimestamp()

[override virtual protected] void MQTTClient::SetPropertyHandler(CDPPropertyBase *pProp)

[protected] void MQTTClient::SubscribeFromMessage(unsigned int clientHandle, const std::string_view messagePayload)

SubscriptionResult MQTTClient::SubscribeToTopic(std::string topic, unsigned short qos, std::variant<unsigned int, TopicBase *> subscriber)

[override virtual] void MQTTClient::Suspend()

void MQTTClient::UngracefullyCloseConnection()

void MQTTClient::UnsubscribeFromTopic(std::string topic, unsigned short qos)

[protected] void MQTTClient::WaitForReconnectTimeoutOrStop()

[protected] void MQTTClient::on_connect(int rc, int flags, const mosquitto_property *properties)

[protected] void MQTTClient::on_disconnect(int rc, const mosquitto_property *properties)

[protected] void MQTTClient::on_log(int level, const char *log)

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top