! * \brief Used for testing the MQTT related features * \param topic */
| 810 | * \param topic |
| 811 | */ |
| 812 | bool LiveDataDock::testSubscribe(const QString& topic) { |
| 813 | QStringList topicList = topic.split(QLatin1Char('/'), Qt::SkipEmptyParts); |
| 814 | QTreeWidgetItem* currentItem = nullptr; |
| 815 | for (int i = 0; i < m_subscriptionWidget->topicCount(); ++i) { |
| 816 | if (m_subscriptionWidget->topLevelTopic(i)->text(0) == topicList[0]) { |
| 817 | currentItem = m_subscriptionWidget->topLevelTopic(i); |
| 818 | break; |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | if (currentItem) { |
| 823 | for (int i = 1; i < topicList.size(); ++i) { |
| 824 | if (topicList[i] == QLatin1Char('#')) |
| 825 | break; |
| 826 | |
| 827 | for (int j = 0; j < currentItem->childCount(); ++j) { |
| 828 | if (currentItem->child(j)->text(0) == topicList[i]) { |
| 829 | currentItem = currentItem->child(j); |
| 830 | break; |
| 831 | } else if (j == currentItem->childCount() - 1) |
| 832 | return false; |
| 833 | } |
| 834 | } |
| 835 | } else |
| 836 | return false; |
| 837 | |
| 838 | m_subscriptionWidget->testSubscribe(currentItem); |
| 839 | return true; |
| 840 | } |
| 841 | |
| 842 | /*! |
| 843 | * \brief Used for testing the MQTT related features |
nothing calls this directly
no test coverage detected