MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / onMessageReceived

Method onMessageReceived

app/src/IO/Drivers/MQTT.cpp:965–992  ·  view source on GitHub ↗

* @brief Forwards a received MQTT message into the frame-reader pipeline. */

Source from the content-addressed store, hash-verified

963 * @brief Forwards a received MQTT message into the frame-reader pipeline.
964 */
965void IO::Drivers::MQTT::onMessageReceived(const QByteArray& message, const QMqttTopicName& topic)
966{
967 Q_ASSERT(topic.isValid());
968
969 const auto& token = Licensing::CommercialToken::current();
970 if (!token.isValid() || !SS_LICENSE_GUARD()
971 || token.featureTier() < Licensing::FeatureTier::Trial) {
972 qCWarning(lcMqttSub) << "messageReceived dropped: no commercial license";
973 return;
974 }
975
976 if (message.isEmpty()) {
977 qCInfo(lcMqttSub) << "messageReceived: empty payload on" << topic.name() << "-- dropped";
978 return;
979 }
980
981 QMqttTopicFilter filter(m_topicFilter);
982 if (!filter.match(topic)) {
983 qCInfo(lcMqttSub) << "messageReceived: topic" << topic.name() << "did not match filter"
984 << m_topicFilter << "-- dropped";
985 return;
986 }
987
988 qCDebug(lcMqttSub) << "messageReceived on" << topic.name() << "size=" << message.size()
989 << "preview=" << message.left(80);
990
991 publishReceivedData(message);
992}
993
994//--------------------------------------------------------------------------------------------------
995// Persistence helpers

Callers

nothing calls this directly

Calls 5

featureTierMethod · 0.80
isEmptyMethod · 0.80
isValidMethod · 0.45
nameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected