labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

MQTTClient Class Reference

The MQTT Client connects to the broker set in ImportFileWidget. It manages the MQTTSubscriptions, and the MQTTTopics. More...

#include <MQTTClient.h>

Inheritance diagram for MQTTClient:
[legend]
Collaboration diagram for MQTTClient:
[legend]

Classes

struct  MQTTWill
 

Public Types

enum class  UpdateType { TimeInterval = 0 , NewData }
 
enum class  ReadingType { ContinuousFixed = 0 , FromEnd , TillEnd }
 
enum class  WillMessageType { OwnMessage = 0 , Statistics , LastMessage }
 
enum class  WillUpdateType { TimePeriod = 0 , OnClick }
 
enum class  WillStatisticsType {
  NoStatistics = -1 , Minimum , Maximum , ArithmeticMean ,
  GeometricMean , HarmonicMean , ContraharmonicMean , Median ,
  Variance , StandardDeviation , MeanDeviation , MeanDeviationAroundMedian ,
  MedianDeviation , Skewness , Kurtosis , Entropy
}
 
- Public Types inherited from AbstractAspect
enum class  ChildIndexFlag { IncludeHidden = 0x01 , Recursive = 0x02 , Compress = 0x04 }
 Flags which control numbering scheme of children. More...
 

Public Slots

void read ()
 called periodically when update type is TimeInterval More...
 
- Public Slots inherited from AbstractAspect
bool setName (const QString &, bool autoUnique=true)
 AbstractAspect::setName sets the name of the abstract aspect. More...
 
void setComment (const QString &)
 
void remove ()
 Remove me from my parent's list of children. More...
 

Signals

void MQTTSubscribed ()
 
void MQTTTopicsChanged ()
 
void readFromTopics ()
 
void clientAboutToBeDeleted (const QString &, quint16)
 
- Signals inherited from AbstractAspect
void aspectDescriptionAboutToChange (const AbstractAspect *)
 Emitted before the name, comment or caption spec is changed. More...
 
void aspectDescriptionChanged (const AbstractAspect *)
 Emitted after the name, comment or caption spec have changed. More...
 
void aspectAboutToBeAdded (const AbstractAspect *parent, const AbstractAspect *before, const AbstractAspect *child)
 Emitted before a new child is inserted. More...
 
void aspectAdded (const AbstractAspect *)
 Emitted after a new Aspect has been added to the tree. More...
 
void aspectAboutToBeRemoved (const AbstractAspect *)
 Emitted before an aspect is removed from its parent. More...
 
void aspectRemoved (const AbstractAspect *parent, const AbstractAspect *before, const AbstractAspect *child)
 Emitted from the parent after removing a child. More...
 
void aspectHiddenAboutToChange (const AbstractAspect *)
 Emitted before the hidden attribute is changed. More...
 
void aspectHiddenChanged (const AbstractAspect *)
 Emitted after the hidden attribute has changed. More...
 
void statusInfo (const QString &)
 Emitted whenever some aspect in the tree wants to give status information to the user. More...
 
void renameRequested ()
 
void selected (const AbstractAspect *)
 
void deselected (const AbstractAspect *)
 
void childAspectSelectedInView (const AbstractAspect *)
 
void childAspectDeselectedInView (const AbstractAspect *)
 

Public Member Functions

 MQTTClient (const QString &name)
 
virtual ~MQTTClient () override
 
void ready ()
 
UpdateType updateType () const
 Returns the MQTTClient's update type. More...
 
void setUpdateType (UpdateType)
 Sets the MQTTClient's update type to updatetype and handles this change. More...
 
ReadingType readingType () const
 Returns the MQTTClient's reading type. More...
 
void setReadingType (ReadingType)
 Sets the MQTTClient's reading type to readingType. More...
 
int sampleSize () const
 Returns the size rate. More...
 
void setSampleSize (int)
 Sets the size rate to sampleSize. More...
 
bool isPaused () const
 Provides information about whether the reading is paused or not. More...
 
void setUpdateInterval (int)
 Sets the MQTTclient's update interval to interval. More...
 
int updateInterval () const
 Returns the MQTTClient's update interval to interval. More...
 
void setKeepNValues (int)
 Sets how many values we should store. More...
 
int keepNValues () const
 Returns how many values we should store. More...
 
void setKeepLastValues (bool)
 
bool keepLastValues () const
 
void setMQTTClientHostPort (const QString &, quint16)
 Sets the host and port for the client. More...
 
void setMQTTClientAuthentication (const QString &, const QString &)
 Sets the username and password for the client. More...
 
void setMQTTClientId (const QString &)
 Sets the ID of the client. More...
 
void addInitialMQTTSubscriptions (const QMqttTopicFilter &, quint8)
 Adds the initial subscriptions that were set in ImportFileWidget. More...
 
QVector< QString > MQTTSubscriptions () const
 Returns the name of every MQTTSubscription of the MQTTClient. More...
 
bool checkTopicContains (const QString &superior, const QString &inferior)
 Checks if a topic contains another one. More...
 
QString checkCommonLevel (const QString &first, const QString &second)
 Returns the '+' wildcard containing topic name, which includes the given topic names. More...
 
QString clientHostName () const
 Returns hostname of the broker the client is connected to. More...
 
quint16 clientPort () const
 Returns the port used by the broker. More...
 
QString clientPassword () const
 Returns the password used for authentication. More...
 
QString clientUserName () const
 Returns the username used for authentication. More...
 
QString clientID () const
 Returns the ID of the client. More...
 
void updateNow ()
 Updates the MQTTTopics of the client. More...
 
void pauseReading ()
 Pause the reading from messages. More...
 
void continueReading ()
 Continue reading from messages after it was paused. More...
 
void setFilter (AsciiFilter *)
 Sets the filter of the MQTTClient. The ownership of the filter is passed to MQTTClient. More...
 
AsciiFilterfilter () const
 Returns the filter of the MQTTClient. More...
 
QIcon icon () const override
 Returns the MQTTClient's icon. More...
 
void save (QXmlStreamWriter *) const override
 
bool load (XmlStreamReader *, bool preview) override
 
QVector< QString > topicNames () const
 Returns the name of every MQTTTopics which already received a message, and is child of the MQTTClient. More...
 
bool checkAllArrived ()
 
void setWillSettings (const MQTTWill &)
 
MQTTWill willSettings () const
 
void setMQTTWillUse (bool)
 Sets whether the user wants to use will message or not. More...
 
bool MQTTWillUse () const
 Returns whether the user wants to use will message or not. More...
 
void setWillTopic (const QString &)
 Sets the will topic of the client. More...
 
QString willTopic () const
 Returns the will topic of the client. More...
 
QString statistics (const MQTTTopic *) const
 Returns the statistical data that is needed by the topic for its MQTTClient's will message. More...
 
void setWillRetain (bool)
 Sets the retain flag of the client's will message. More...
 
bool willRetain () const
 Returns the retain flag of the client's will message. More...
 
void setWillQoS (quint8)
 Sets the QoS level of the client's will message. More...
 
quint8 willQoS () const
 Returns the QoS level of the client's will message. More...
 
void setWillMessageType (WillMessageType)
 Sets the will message type of the client. More...
 
WillMessageType willMessageType () const
 Returns the will message type of the client. More...
 
void setWillOwnMessage (const QString &)
 Sets the own will message of the user. More...
 
QString willOwnMessage () const
 Returns the own will message of the user. More...
 
WillUpdateType willUpdateType () const
 Returns the MQTTClient's will update type. More...
 
void setWillUpdateType (WillUpdateType)
 Sets the MQTTClient's will update type. More...
 
int willTimeInterval () const
 Returns the time interval of updating the MQTTClient's will message. More...
 
void setWillTimeInterval (int)
 Sets the time interval of updating the MQTTClient's will message, if update type is TimePeriod. More...
 
void startWillTimer () const
 Starts the will timer, which will update the will message. More...
 
void stopWillTimer () const
 Stops the will timer. More...
 
void updateWillMessage ()
 Updates the will message of the client. More...
 
void setMQTTRetain (bool)
 Sets the flag on the given value. If retain is true we interpret retain messages, otherwise we do not. More...
 
bool MQTTRetain () const
 Returns the flag, which set to true means that interpret retain messages, otherwise we do not. More...
 
void setMQTTUseID (bool)
 Sets the flag on the given value. If set true it means that user wants to set the client ID, otherwise it's not the case. More...
 
bool MQTTUseID () const
 Returns whether the user wants to set the client ID or not. More...
 
void setMQTTUseAuthentication (bool)
 Sets the flag on the given value. If set true it means that the broker requires authentication, otherwise it doesn't. More...
 
bool MQTTUseAuthentication () const
 Returns whether the broker requires authentication or not. More...
 
void clearLastMessage ()
 Clear the lastly received message by the will topic Called when the will topic is changed. More...
 
void addWillStatistics (WillStatisticsType)
 Sets true the corresponding flag of the statistic type, what means that the given statistic type will be added to the will message. More...
 
void removeWillStatistics (WillStatisticsType)
 Sets false the corresponding flag of the statistic type, what means that the given statistic will no longer be added to the will message. More...
 
QVector< bool > willStatistics () const
 Returns a bool vector, meaning which statistic types are included in the will message If the corresponding value is true, the statistic type is included, otherwise it isn't. More...
 
void addMQTTSubscription (const QString &, quint8)
 Adds a new MQTTSubscription to the MQTTClient. More...
 
void removeMQTTSubscription (const QString &)
 Removes a MQTTSubscription from the MQTTClient. More...
 
void addBeforeRemoveSubscription (const QString &, quint8)
 Adds a MQTTSubscription to the MQTTClient Used when the user unsubscribes from a topic of a MQTTSubscription. More...
 
void reparentTopic (const QString &topic, const QString &parent)
 Reparents the given MQTTTopic to the given MQTTSubscription. More...
 
- Public Member Functions inherited from Folder
 Folder (const QString &name, AspectType type=AspectType::Folder)
 
QMenu * createContextMenu () override
 Return a new context menu. More...
 
void setPathesToLoad (const QStringList &)
 
const QStringList & pathesToLoad () const
 
bool isDraggable () const override
 
QVector< AspectTypedropableOn () const override
 
void processDropEvent (const QVector< quintptr > &) override
 
- Public Member Functions inherited from AbstractAspect
 AbstractAspect (const QString &name, AspectType type)
 
 ~AbstractAspect () override
 
QString name () const
 
QString comment () const
 
void setCreationTime (const QDateTime &)
 
QDateTime creationTime () const
 
virtual Projectproject ()
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one. More...
 
virtual QString path () const
 Return the path that leads from the top-most Aspect (usually a Project) to me. More...
 
void setHidden (bool)
 Set "hidden" property, i.e. whether to exclude this aspect from being shown in the explorer. More...
 
bool hidden () const
 
void setIsLoading (bool)
 
bool isLoading () const
 
AspectType type () const
 
bool inherits (AspectType type) const
 
AbstractAspectparentAspect () const
 Return my parent Aspect or 0 if I currently don't have one. More...
 
AbstractAspectparent (AspectType type) const
 In the parent-child hierarchy, return the first parent of type. More...
 
void setParentAspect (AbstractAspect *)
 
Folderfolder ()
 Return the folder the Aspect is contained in or 0 if there is none. More...
 
bool isDescendantOf (AbstractAspect *other)
 Return whether the there is a path upwards to the given aspect. More...
 
void addChild (AbstractAspect *)
 Add the given Aspect to my list of children. More...
 
void addChildFast (AbstractAspect *)
 Add the given Aspect to my list of children without any checks and without putting this step onto the undo-stack. More...
 
virtual void finalizeAdd ()
 
QVector< AbstractAspect * > children (AspectType type, ChildIndexFlags flags={}) const
 
void insertChildBefore (AbstractAspect *child, AbstractAspect *before)
 Insert the given Aspect at a specific position in my list of children. More...
 
void insertChildBeforeFast (AbstractAspect *child, AbstractAspect *before)
 Insert the given Aspect at a specific position in my list of children.without any checks and without putting this step onto the undo-stack. More...
 
void reparent (AbstractAspect *newParent, int newIndex=-1)
 Move a child to another parent aspect and transfer ownership. More...
 
void removeChild (AbstractAspect *)
 Remove the given Aspect from my list of children. More...
 
void removeAllChildren ()
 Remove all child Aspects. More...
 
virtual QVector< AbstractAspect * > dependsOn () const
 
template<class T >
T * ancestor () const
 Return the closest ancestor of class T (or NULL if none found). More...
 
template<class T >
QVector< T * > children (ChildIndexFlags flags={}) const
 
template<class T >
T * child (int index, ChildIndexFlags flags={}) const
 
template<class T >
T * child (const QString &name) const
 Get child by name and class. More...
 
template<class T >
int childCount (ChildIndexFlags flags={}) const
 Return the number of child Aspects inheriting from given class. More...
 
template<class T >
int indexOfChild (const AbstractAspect *child, ChildIndexFlags flags={}) const
 Return (0 based) index of child in the list of children inheriting from class T. More...
 
void setSelected (bool)
 
void setUndoAware (bool)
 
virtual QUndoStack * undoStack () const
 Return the undo stack of the Project, or 0 if this Aspect is not part of a Project. More...
 
void exec (QUndoCommand *)
 Execute the given command, pushing it on the undoStack() if available. More...
 
void exec (QUndoCommand *command, const char *preChangeSignal, const char *postChangeSignal, QGenericArgument val0=QGenericArgument(), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument())
 Execute command and arrange for signals to be sent before/after it is redone or undone. More...
 
void beginMacro (const QString &text)
 Begin an undo stack macro (series of commands) More...
 
void endMacro ()
 End the current undo stack macro. More...
 

Private Slots

void onMQTTConnect ()
 called when the client successfully connected to the broker More...
 
void MQTTSubscriptionMessageReceived (const QMqttMessage &)
 called when a message is received by a topic belonging to one of subscriptions of the client. It passes the message to the appropriate MQTTSubscription which will pass it to the appropriate MQTTTopic More...
 
void MQTTErrorChanged (QMqttClient::ClientError)
 Handles some of the possible errors of the client, using MQTTErrorWidget. More...
 
void subscriptionLoaded (const QString &)
 Called when a subscription is loaded. Checks whether every saved subscription was loaded or not. If everything is loaded, it makes the connection and starts the reading. More...
 

Private Attributes

UpdateType m_updateType {UpdateType::TimeInterval}
 
ReadingType m_readingType {ReadingType::ContinuousFixed}
 
bool m_paused {false}
 
bool m_prepared {false}
 
int m_sampleSize {1}
 
int m_keepNValues {0}
 
int m_updateInterval {1000}
 
AsciiFilterm_filter {nullptr}
 
QTimer * m_updateTimer
 
QMqttClient * m_client
 
QMap< QMqttTopicFilter, quint8 > m_subscribedTopicNameQoS
 
QVector< QString > m_subscriptions
 
QVector< QString > m_topicNames
 
bool m_MQTTTest {false}
 
QTimer * m_willTimer
 
bool m_MQTTFirstConnectEstablished {false}
 
bool m_MQTTRetain {false}
 
bool m_MQTTUseID {false}
 
bool m_MQTTUseAuthentication {false}
 
QVector< MQTTSubscription * > m_MQTTSubscriptions
 
bool m_disconnectForWill {false}
 
bool m_loaded {false}
 
int m_subscriptionsLoaded {0}
 
int m_subscriptionCountToLoad {0}
 
MQTTWill m_MQTTWill
 

Additional Inherited Members

- Protected Slots inherited from AbstractAspect
virtual void childSelected (const AbstractAspect *)
 
virtual void childDeselected (const AbstractAspect *)
 
- Protected Member Functions inherited from Folder
bool readChildAspectElement (XmlStreamReader *, bool preview)
 Read child aspect from XML. More...
 
- Protected Member Functions inherited from AbstractAspect
void info (const QString &text)
 Implementations should call this whenever status information should be given to the user. More...
 
bool readBasicAttributes (XmlStreamReader *)
 Load name and creation time from XML. More...
 
void writeBasicAttributes (QXmlStreamWriter *) const
 Save name and creation time to XML. More...
 
void writeCommentElement (QXmlStreamWriter *) const
 Save the comment to XML. More...
 
bool readCommentElement (XmlStreamReader *)
 Load comment from an XML element. More...
 
- Protected Attributes inherited from AbstractAspect
const AspectType m_type
 

Detailed Description

The MQTT Client connects to the broker set in ImportFileWidget. It manages the MQTTSubscriptions, and the MQTTTopics.

File : MQTTClient.cpp Project : LabPlot

Description : Represents a MQTT Client

Copyright : (C) 2018 Kovacs Ferencz (kferi.nosp@m.ke98.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
  • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
  • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Definition at line 48 of file MQTTClient.h.

Member Enumeration Documentation

◆ ReadingType

Enumerator
ContinuousFixed 
FromEnd 
TillEnd 

Definition at line 57 of file MQTTClient.h.

◆ UpdateType

Enumerator
TimeInterval 
NewData 

Definition at line 52 of file MQTTClient.h.

◆ WillMessageType

Enumerator
OwnMessage 
Statistics 
LastMessage 

Definition at line 63 of file MQTTClient.h.

◆ WillStatisticsType

Enumerator
NoStatistics 
Minimum 
Maximum 
ArithmeticMean 
GeometricMean 
HarmonicMean 
ContraharmonicMean 
Median 
Variance 
StandardDeviation 
MeanDeviation 
MeanDeviationAroundMedian 
MedianDeviation 
Skewness 
Kurtosis 
Entropy 

Definition at line 74 of file MQTTClient.h.

◆ WillUpdateType

Enumerator
TimePeriod 
OnClick 

Definition at line 69 of file MQTTClient.h.

Constructor & Destructor Documentation

◆ MQTTClient()

MQTTClient::MQTTClient ( const QString &  name)
explicit

◆ ~MQTTClient()

MQTTClient::~MQTTClient ( )
overridevirtual

Member Function Documentation

◆ addBeforeRemoveSubscription()

void MQTTClient::addBeforeRemoveSubscription ( const QString &  topicName,
quint8  QoS 
)

Adds a MQTTSubscription to the MQTTClient Used when the user unsubscribes from a topic of a MQTTSubscription.

Parameters
topic,thename of the topic
QoS

Definition at line 479 of file MQTTClient.cpp.

References AbstractAspect::addChildFast(), checkTopicContains(), filter(), m_client, m_MQTTSubscriptions, m_subscribedTopicNameQoS, m_subscriptions, MQTTSubscription, MQTTSubscriptionMessageReceived(), and MQTTSubscription::topics().

◆ addInitialMQTTSubscriptions()

void MQTTClient::addInitialMQTTSubscriptions ( const QMqttTopicFilter &  filter,
quint8  qos 
)

Adds the initial subscriptions that were set in ImportFileWidget.

Parameters
filterthe name of the subscribed topic
qosthe qos level of the subscription

Definition at line 349 of file MQTTClient.cpp.

References filter(), and m_subscribedTopicNameQoS.

◆ addMQTTSubscription()

void MQTTClient::addMQTTSubscription ( const QString &  topicName,
quint8  QoS 
)

◆ addWillStatistics()

void MQTTClient::addWillStatistics ( WillStatisticsType  statistic)

Sets true the corresponding flag of the statistic type, what means that the given statistic type will be added to the will message.

Parameters
statistics

Definition at line 957 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willStatistics.

◆ checkAllArrived()

bool MQTTClient::checkAllArrived ( )

◆ checkCommonLevel()

QString MQTTClient::checkCommonLevel ( const QString &  first,
const QString &  second 
)

Returns the '+' wildcard containing topic name, which includes the given topic names.

Parameters
firstthe name of a topic
secondthe name of a topic
Returns
The name of the common topic, if it exists, otherwise an empty string

Definition at line 619 of file MQTTClient.cpp.

◆ checkTopicContains()

bool MQTTClient::checkTopicContains ( const QString &  superior,
const QString &  inferior 
)

Checks if a topic contains another one.

Parameters
superiorthe name of a topic
inferiorthe name of a topic
Returns
true if superior is equal to or contains(if superior contains wildcards) inferior, false otherwise

Definition at line 576 of file MQTTClient.cpp.

Referenced by addBeforeRemoveSubscription(), addMQTTSubscription(), and MQTTSubscriptionMessageReceived().

◆ clearLastMessage()

void MQTTClient::clearLastMessage ( )

Clear the lastly received message by the will topic Called when the will topic is changed.

Definition at line 947 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willLastMessage.

◆ clientAboutToBeDeleted

void MQTTClient::clientAboutToBeDeleted ( const QString &  ,
quint16   
)
signal

Referenced by ~MQTTClient().

◆ clientHostName()

QString MQTTClient::clientHostName ( ) const

Returns hostname of the broker the client is connected to.

Definition at line 233 of file MQTTClient.cpp.

References m_client.

◆ clientID()

QString MQTTClient::clientID ( ) const

Returns the ID of the client.

Definition at line 315 of file MQTTClient.cpp.

References m_client.

◆ clientPassword()

QString MQTTClient::clientPassword ( ) const

Returns the password used for authentication.

Definition at line 282 of file MQTTClient.cpp.

References m_client.

◆ clientPort()

quint16 MQTTClient::clientPort ( ) const

Returns the port used by the broker.

Definition at line 240 of file MQTTClient.cpp.

References m_client.

◆ clientUserName()

QString MQTTClient::clientUserName ( ) const

Returns the username used for authentication.

Definition at line 275 of file MQTTClient.cpp.

References m_client.

◆ continueReading()

void MQTTClient::continueReading ( )

Continue reading from messages after it was paused.

Definition at line 88 of file MQTTClient.cpp.

References m_paused, m_updateInterval, m_updateTimer, m_updateType, and TimeInterval.

◆ filter()

AsciiFilter * MQTTClient::filter ( ) const

◆ icon()

QIcon MQTTClient::icon ( ) const
overridevirtual

Returns the MQTTClient's icon.

Reimplemented from Folder.

Definition at line 215 of file MQTTClient.cpp.

◆ isPaused()

bool MQTTClient::isPaused ( ) const

Provides information about whether the reading is paused or not.

Returns
true if the reading is paused
false otherwise

Definition at line 160 of file MQTTClient.cpp.

References m_paused.

Referenced by MQTTSubscription::messageArrived().

◆ keepLastValues()

bool MQTTClient::keepLastValues ( ) const

◆ keepNValues()

int MQTTClient::keepNValues ( ) const

Returns how many values we should store.

Definition at line 150 of file MQTTClient.cpp.

References m_keepNValues.

Referenced by setKeepNValues().

◆ load()

◆ MQTTErrorChanged

void MQTTClient::MQTTErrorChanged ( QMqttClient::ClientError  clientError)
privateslot

Handles some of the possible errors of the client, using MQTTErrorWidget.

Definition at line 1104 of file MQTTClient.cpp.

References Qxt::NoError.

Referenced by MQTTClient().

◆ MQTTRetain()

bool MQTTClient::MQTTRetain ( ) const

Returns the flag, which set to true means that interpret retain messages, otherwise we do not.

Definition at line 332 of file MQTTClient.cpp.

References m_MQTTRetain.

◆ MQTTSubscribed

void MQTTClient::MQTTSubscribed ( )
signal

Referenced by onMQTTConnect().

◆ MQTTSubscriptionMessageReceived

void MQTTClient::MQTTSubscriptionMessageReceived ( const QMqttMessage &  msg)
privateslot

called when a message is received by a topic belonging to one of subscriptions of the client. It passes the message to the appropriate MQTTSubscription which will pass it to the appropriate MQTTTopic

Definition at line 1077 of file MQTTClient.cpp.

References checkTopicContains(), m_MQTTRetain, m_MQTTSubscriptions, m_MQTTWill, m_topicNames, MQTTTopicsChanged(), MQTTClient::MQTTWill::willLastMessage, and MQTTClient::MQTTWill::willTopic.

Referenced by addBeforeRemoveSubscription(), addMQTTSubscription(), and onMQTTConnect().

◆ MQTTSubscriptions()

QVector< QString > MQTTClient::MQTTSubscriptions ( ) const

Returns the name of every MQTTSubscription of the MQTTClient.

Definition at line 356 of file MQTTClient.cpp.

References m_subscriptions.

◆ MQTTTopicsChanged

void MQTTClient::MQTTTopicsChanged ( )
signal

◆ MQTTUseAuthentication()

bool MQTTClient::MQTTUseAuthentication ( ) const

Returns whether the broker requires authentication or not.

Definition at line 257 of file MQTTClient.cpp.

References m_MQTTUseAuthentication.

◆ MQTTUseID()

bool MQTTClient::MQTTUseID ( ) const

Returns whether the user wants to set the client ID or not.

Definition at line 299 of file MQTTClient.cpp.

References m_MQTTUseID.

◆ MQTTWillUse()

bool MQTTClient::MQTTWillUse ( ) const

Returns whether the user wants to use will message or not.

Definition at line 691 of file MQTTClient.cpp.

References MQTTClient::MQTTWill::enabled, and m_MQTTWill.

◆ onMQTTConnect

void MQTTClient::onMQTTConnect ( )
privateslot

◆ pauseReading()

void MQTTClient::pauseReading ( )

Pause the reading from messages.

Definition at line 97 of file MQTTClient.cpp.

References m_paused, m_updateTimer, m_updateType, and TimeInterval.

Referenced by AbstractAspect::removeChild(), and ~MQTTClient().

◆ read

void MQTTClient::read ( )
slot

called periodically when update type is TimeInterval

Definition at line 1001 of file MQTTClient.cpp.

References m_client, m_filter, m_MQTTFirstConnectEstablished, m_prepared, and readFromTopics().

Referenced by MQTTClient(), subscriptionLoaded(), MQTTErrorWidget::tryToReconnect(), and updateNow().

◆ readFromTopics

void MQTTClient::readFromTopics ( )
signal

Referenced by MQTTTopic::MQTTTopic(), and read().

◆ readingType()

MQTTClient::ReadingType MQTTClient::readingType ( ) const

Returns the MQTTClient's reading type.

Definition at line 190 of file MQTTClient.cpp.

References m_readingType.

Referenced by setReadingType().

◆ ready()

void MQTTClient::ready ( )

depending on the update type, periodically or on data changes, starts the timer.

Definition at line 70 of file MQTTClient.cpp.

References m_updateInterval, m_updateTimer, m_updateType, and TimeInterval.

◆ removeMQTTSubscription()

void MQTTClient::removeMQTTSubscription ( const QString &  subscriptionName)

Removes a MQTTSubscription from the MQTTClient.

Parameters
name,thename of the subscription to remove

Definition at line 434 of file MQTTClient.cpp.

References filter(), m_client, m_MQTTSubscriptions, m_subscribedTopicNameQoS, m_subscriptions, m_topicNames, MQTTTopicsChanged(), AbstractAspect::removeChild(), and MQTTSubscription::topics().

◆ removeWillStatistics()

void MQTTClient::removeWillStatistics ( WillStatisticsType  statistic)

Sets false the corresponding flag of the statistic type, what means that the given statistic will no longer be added to the will message.

Parameters
statistics

Definition at line 967 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willStatistics.

◆ reparentTopic()

void MQTTClient::reparentTopic ( const QString &  topicName,
const QString &  parentTopicName 
)

Reparents the given MQTTTopic to the given MQTTSubscription.

Parameters
topic,thename of the MQTTTopic
parent,thename of the MQTTSubscription

Definition at line 538 of file MQTTClient.cpp.

References m_MQTTSubscriptions, m_subscriptions, m_topicNames, and AbstractAspect::Recursive.

◆ sampleSize()

int MQTTClient::sampleSize ( ) const

Returns the size rate.

Definition at line 175 of file MQTTClient.cpp.

References m_sampleSize.

Referenced by setSampleSize().

◆ save()

◆ setFilter()

void MQTTClient::setFilter ( AsciiFilter f)

Sets the filter of the MQTTClient. The ownership of the filter is passed to MQTTClient.

Parameters
fa pointer to the new filter

Definition at line 109 of file MQTTClient.cpp.

References m_filter.

Referenced by load().

◆ setKeepLastValues()

void MQTTClient::setKeepLastValues ( bool  )

◆ setKeepNValues()

void MQTTClient::setKeepNValues ( int  keepNValues)

Sets how many values we should store.

Parameters
keepNValues

Definition at line 143 of file MQTTClient.cpp.

References keepNValues(), and m_keepNValues.

◆ setMQTTClientAuthentication()

void MQTTClient::setMQTTClientAuthentication ( const QString &  username,
const QString &  password 
)

Sets the username and password for the client.

Parameters
usernamethe username used for authentication
passwordthe password used for authentication

Definition at line 267 of file MQTTClient.cpp.

References m_client.

Referenced by MQTTErrorWidget::tryToReconnect().

◆ setMQTTClientHostPort()

void MQTTClient::setMQTTClientHostPort ( const QString &  host,
quint16  port 
)

Sets the host and port for the client.

Parameters
hostthe hostname of the broker we want to connect to
portthe port used by the broker

Definition at line 225 of file MQTTClient.cpp.

References m_client.

◆ setMQTTClientId()

void MQTTClient::setMQTTClientId ( const QString &  clientId)

Sets the ID of the client.

Parameters
id

Definition at line 308 of file MQTTClient.cpp.

References m_client.

Referenced by MQTTErrorWidget::tryToReconnect().

◆ setMQTTRetain()

void MQTTClient::setMQTTRetain ( bool  retain)

Sets the flag on the given value. If retain is true we interpret retain messages, otherwise we do not.

Parameters
retain

Definition at line 325 of file MQTTClient.cpp.

References m_MQTTRetain.

◆ setMQTTUseAuthentication()

void MQTTClient::setMQTTUseAuthentication ( bool  use)

Sets the flag on the given value. If set true it means that the broker requires authentication, otherwise it doesn't.

Parameters
use

Definition at line 250 of file MQTTClient.cpp.

References m_MQTTUseAuthentication.

◆ setMQTTUseID()

void MQTTClient::setMQTTUseID ( bool  use)

Sets the flag on the given value. If set true it means that user wants to set the client ID, otherwise it's not the case.

Parameters
use

Definition at line 292 of file MQTTClient.cpp.

References m_MQTTUseID.

◆ setMQTTWillUse()

void MQTTClient::setMQTTWillUse ( bool  use)

Sets whether the user wants to use will message or not.

Parameters
use

Definition at line 682 of file MQTTClient.cpp.

References MQTTClient::MQTTWill::enabled, m_MQTTWill, and m_willTimer.

◆ setReadingType()

void MQTTClient::setReadingType ( ReadingType  readingType)

Sets the MQTTClient's reading type to readingType.

Parameters
readingType

Definition at line 183 of file MQTTClient.cpp.

References m_readingType, and readingType().

◆ setSampleSize()

void MQTTClient::setSampleSize ( int  sampleSize)

Sets the size rate to sampleSize.

Parameters
sampleSize

Definition at line 168 of file MQTTClient.cpp.

References m_sampleSize, and sampleSize().

◆ setUpdateInterval()

void MQTTClient::setUpdateInterval ( int  interval)

Sets the MQTTclient's update interval to interval.

Parameters
interval

Definition at line 125 of file MQTTClient.cpp.

References m_paused, m_updateInterval, and m_updateTimer.

◆ setUpdateType()

void MQTTClient::setUpdateType ( UpdateType  updateType)

Sets the MQTTClient's update type to updatetype and handles this change.

Parameters
updatetype

Definition at line 198 of file MQTTClient.cpp.

References m_updateTimer, m_updateType, NewData, and updateType().

◆ setWillMessageType()

void MQTTClient::setWillMessageType ( WillMessageType  messageType)

Sets the will message type of the client.

Parameters
messageType

Definition at line 749 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willMessageType.

◆ setWillOwnMessage()

void MQTTClient::setWillOwnMessage ( const QString &  ownMessage)

Sets the own will message of the user.

Parameters
ownMessage

Definition at line 765 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willOwnMessage.

◆ setWillQoS()

void MQTTClient::setWillQoS ( quint8  QoS)

Sets the QoS level of the client's will message.

Parameters
QoS

Definition at line 733 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willQoS.

◆ setWillRetain()

void MQTTClient::setWillRetain ( bool  retain)

Sets the retain flag of the client's will message.

Parameters
retain

Definition at line 717 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willRetain.

◆ setWillSettings()

void MQTTClient::setWillSettings ( const MQTTWill settings)

Definition at line 669 of file MQTTClient.cpp.

References m_MQTTWill.

◆ setWillTimeInterval()

void MQTTClient::setWillTimeInterval ( int  interval)

Sets the time interval of updating the MQTTClient's will message, if update type is TimePeriod.

Parameters
interval

Definition at line 939 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willTimeInterval.

◆ setWillTopic()

void MQTTClient::setWillTopic ( const QString &  topic)

Sets the will topic of the client.

Parameters
topic

Definition at line 700 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willTopic.

◆ setWillUpdateType()

void MQTTClient::setWillUpdateType ( WillUpdateType  willUpdateType)

Sets the MQTTClient's will update type.

Parameters
willUpdateType

Definition at line 923 of file MQTTClient.cpp.

References m_MQTTWill, MQTTClient::MQTTWill::willUpdateType, and willUpdateType().

◆ startWillTimer()

void MQTTClient::startWillTimer ( ) const

Starts the will timer, which will update the will message.

Definition at line 982 of file MQTTClient.cpp.

References m_MQTTWill, m_willTimer, TimePeriod, MQTTClient::MQTTWill::willTimeInterval, and MQTTClient::MQTTWill::willUpdateType.

◆ statistics()

QString MQTTClient::statistics ( const MQTTTopic topic) const

◆ stopWillTimer()

void MQTTClient::stopWillTimer ( ) const

Stops the will timer.

Definition at line 990 of file MQTTClient.cpp.

References m_willTimer.

◆ subscriptionLoaded

void MQTTClient::subscriptionLoaded ( const QString &  name)
privateslot

Called when a subscription is loaded. Checks whether every saved subscription was loaded or not. If everything is loaded, it makes the connection and starts the reading.

Parameters
name,thename of the subscription

Definition at line 1118 of file MQTTClient.cpp.

References filter(), m_loaded, m_MQTTSubscriptions, m_subscribedTopicNameQoS, m_subscriptionCountToLoad, m_subscriptions, m_subscriptionsLoaded, m_topicNames, AbstractAspect::name(), and read().

Referenced by load().

◆ topicNames()

QVector< QString > MQTTClient::topicNames ( ) const

Returns the name of every MQTTTopics which already received a message, and is child of the MQTTClient.

Definition at line 339 of file MQTTClient.cpp.

References m_topicNames.

◆ updateInterval()

int MQTTClient::updateInterval ( ) const

Returns the MQTTClient's update interval to interval.

Parameters
interval

Definition at line 135 of file MQTTClient.cpp.

References m_updateInterval.

◆ updateNow()

void MQTTClient::updateNow ( )

Updates the MQTTTopics of the client.

Definition at line 78 of file MQTTClient.cpp.

References m_paused, m_updateInterval, m_updateTimer, m_updateType, read(), and TimeInterval.

◆ updateType()

MQTTClient::UpdateType MQTTClient::updateType ( ) const

Returns the MQTTClient's update type.

Definition at line 208 of file MQTTClient.cpp.

References m_updateType.

Referenced by MQTTSubscription::messageArrived(), and setUpdateType().

◆ updateWillMessage()

◆ willMessageType()

MQTTClient::WillMessageType MQTTClient::willMessageType ( ) const

Returns the will message type of the client.

Definition at line 756 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willMessageType.

◆ willOwnMessage()

QString MQTTClient::willOwnMessage ( ) const

Returns the own will message of the user.

Definition at line 772 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willOwnMessage.

◆ willQoS()

quint8 MQTTClient::willQoS ( ) const

Returns the QoS level of the client's will message.

Definition at line 740 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willQoS.

◆ willRetain()

bool MQTTClient::willRetain ( ) const

Returns the retain flag of the client's will message.

Definition at line 724 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willRetain.

◆ willSettings()

MQTTClient::MQTTWill MQTTClient::willSettings ( ) const

Definition at line 673 of file MQTTClient.cpp.

References m_MQTTWill.

◆ willStatistics()

QVector< bool > MQTTClient::willStatistics ( ) const

Returns a bool vector, meaning which statistic types are included in the will message If the corresponding value is true, the statistic type is included, otherwise it isn't.

Definition at line 975 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willStatistics.

Referenced by statistics().

◆ willTimeInterval()

int MQTTClient::willTimeInterval ( ) const

Returns the time interval of updating the MQTTClient's will message.

Definition at line 930 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willTimeInterval.

◆ willTopic()

QString MQTTClient::willTopic ( ) const

Returns the will topic of the client.

Definition at line 708 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willTopic.

Referenced by updateWillMessage().

◆ willUpdateType()

MQTTClient::WillUpdateType MQTTClient::willUpdateType ( ) const

Returns the MQTTClient's will update type.

Definition at line 914 of file MQTTClient.cpp.

References m_MQTTWill, and MQTTClient::MQTTWill::willUpdateType.

Referenced by setWillUpdateType().

Member Data Documentation

◆ m_client

◆ m_disconnectForWill

bool MQTTClient::m_disconnectForWill {false}
private

Definition at line 236 of file MQTTClient.h.

Referenced by updateWillMessage().

◆ m_filter

AsciiFilter* MQTTClient::m_filter {nullptr}
private

Definition at line 223 of file MQTTClient.h.

Referenced by filter(), load(), read(), save(), setFilter(), and ~MQTTClient().

◆ m_keepNValues

int MQTTClient::m_keepNValues {0}
private

Definition at line 221 of file MQTTClient.h.

Referenced by keepNValues(), load(), save(), and setKeepNValues().

◆ m_loaded

bool MQTTClient::m_loaded {false}
private

Definition at line 237 of file MQTTClient.h.

Referenced by onMQTTConnect(), and subscriptionLoaded().

◆ m_MQTTFirstConnectEstablished

bool MQTTClient::m_MQTTFirstConnectEstablished {false}
private

Definition at line 231 of file MQTTClient.h.

Referenced by onMQTTConnect(), and read().

◆ m_MQTTRetain

bool MQTTClient::m_MQTTRetain {false}
private

Definition at line 232 of file MQTTClient.h.

Referenced by load(), MQTTRetain(), MQTTSubscriptionMessageReceived(), save(), and setMQTTRetain().

◆ m_MQTTSubscriptions

◆ m_MQTTTest

bool MQTTClient::m_MQTTTest {false}
private

Definition at line 229 of file MQTTClient.h.

◆ m_MQTTUseAuthentication

bool MQTTClient::m_MQTTUseAuthentication {false}
private

Definition at line 234 of file MQTTClient.h.

Referenced by load(), MQTTUseAuthentication(), save(), and setMQTTUseAuthentication().

◆ m_MQTTUseID

bool MQTTClient::m_MQTTUseID {false}
private

Definition at line 233 of file MQTTClient.h.

Referenced by load(), MQTTUseID(), save(), and setMQTTUseID().

◆ m_MQTTWill

◆ m_paused

bool MQTTClient::m_paused {false}
private

Definition at line 218 of file MQTTClient.h.

Referenced by continueReading(), isPaused(), pauseReading(), setUpdateInterval(), and updateNow().

◆ m_prepared

bool MQTTClient::m_prepared {false}
private

Definition at line 219 of file MQTTClient.h.

Referenced by read().

◆ m_readingType

ReadingType MQTTClient::m_readingType {ReadingType::ContinuousFixed}
private

Definition at line 217 of file MQTTClient.h.

Referenced by load(), readingType(), save(), and setReadingType().

◆ m_sampleSize

int MQTTClient::m_sampleSize {1}
private

Definition at line 220 of file MQTTClient.h.

Referenced by load(), sampleSize(), save(), and setSampleSize().

◆ m_subscribedTopicNameQoS

QMap<QMqttTopicFilter, quint8> MQTTClient::m_subscribedTopicNameQoS
private

◆ m_subscriptionCountToLoad

int MQTTClient::m_subscriptionCountToLoad {0}
private

Definition at line 239 of file MQTTClient.h.

Referenced by load(), and subscriptionLoaded().

◆ m_subscriptions

◆ m_subscriptionsLoaded

int MQTTClient::m_subscriptionsLoaded {0}
private

Definition at line 238 of file MQTTClient.h.

Referenced by subscriptionLoaded().

◆ m_topicNames

QVector<QString> MQTTClient::m_topicNames
private

◆ m_updateInterval

int MQTTClient::m_updateInterval {1000}
private

◆ m_updateTimer

QTimer* MQTTClient::m_updateTimer
private

◆ m_updateType

UpdateType MQTTClient::m_updateType {UpdateType::TimeInterval}
private

◆ m_willTimer

QTimer* MQTTClient::m_willTimer
private

Definition at line 230 of file MQTTClient.h.

Referenced by MQTTClient(), setMQTTWillUse(), startWillTimer(), stopWillTimer(), and ~MQTTClient().


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