diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..abe73b13 --- /dev/null +++ b/TODO.md @@ -0,0 +1,73 @@ +# VSCP Works + -- Things to do + + +## MQTT + - Handel string, binary, json and xml content + - First character is not 0x00, "<" or "{" ==> STRING + - First character 0x00 and content len > 0 ==> BINARY (UDP format) + - First non white space character "<" ==> XML + - First non white space character "{" ==> JSON + +## LOCAL Dialog + - TODO Add log file types + +### CANAL - dialog + + +## SOCKETCAN - dialog + + +## UDP - dialog + - TODO test connection needs to be implemented. + +## MULTICAST - dialog + - TODO test connection needs to be implemented. + +## GUID database + - TODO GUID to name (database, DNS). + - TODO Load/save GUID sets + +## RAW CANAL + - TODO Collect id's and allow to filtering on them (SavveyCAN). + - TODO Two views (ID frequency, messages) a'la PEAK. + +## Session window + - TODO Colormarking from filter. Match set filter/icon. + - TODO Set filter from recived event. + - Undefined events should be possible to display info for as user defined evenst + - Received event cloned to transmit + - Received event cloned to filter and !filter + - Toolbar: connect | filter active | filter combo | base combo + - Define your own data rendering (Javascript/mustasch) + - Custom data rendering for any event from db. + - Config device from session window. + - Change line and status info when GUID symbolic or sensor symbolic has been updated + - MQTT: activate/deactivate subscription on the fly. (publish topics also maybe) + - Better and more flexible sizing + +## Configuration window + - search register / next + - search remote variable /next + - Remove ctrl+0/1/2... from menu keep functionality. + +## Scan window + + +## Bootloader window + + +## MDF editor window +Encoding/decoding of strings to match JSON/XML. + + +## GUID Known nodes Dialog +TODO Dialog with add/edit/delete of known GUID's. CDlgGuid.ui + +## Dialog log viewer +TODO Dialog with log viewing/filtering CDlgLog + +## Misc. +Generate code for web page interfaces + +## FUTURE +https://github.com/mguentner/cannelloni diff --git a/src/TODO.todo b/src/TODO.todo deleted file mode 100644 index e4692441..00000000 --- a/src/TODO.todo +++ /dev/null @@ -1,85 +0,0 @@ - -MQTT -==== -Handel string, binary, json and xml content -First character is not 0x00, "<" or "{" ==> STRING -First character 0x00 and content len > 0 ==> BINARY (UDP format) -First non white space character "<" ==> XML -First non white space character "{" ==> JSON - -LOCAL Dialog -============ -TODO Add log file types - -CANAL - dialog -============== - - -SOCKETCAN - dialog -================== - - -UDP - dialog -============ -TODO test connection needs to be implemented. - -MULTICAST - dialog -================== -TODO test connection needs to be implemented. - -GUID database -============= -TODO GUID to name (database, DNS). -TODO Load/save GUID sets - -RAW CANAL -========= -TODO Collect id's and allow to filtering on them (SavveyCAN). -TODO Two views (ID frequency, messages) a'la PEAK. - -Session window -============== -TODO Colormarking from filter. Match set filter/icon. -TODO Set filter from recived event. -Undefined events should be possible to display info for as user defined evenst -Received event cloned to transmit -Received event cloned to filter and !filter -Toolbar: connect | filter active | filter combo | base combo -Define your own data rendering (Javascript/mustasch) -Custom data rendering for any event from db. -Config device from session window. -Change line and status info when GUID symbolic or sensor symbolic has been updated -MQTT: activate/deactivate subscription on the fly. (publish topics also maybe) - -Configuration window -==================== -search register / next -search remote variable /next -Remove ctrl+0/1/2... from menu keep functionality. - -Scan window -=========== - -Bootloader window -================= - -MDF editor window -================= -Encoding/decoding of strings to match JSON/XML. - - -GUID Known nodes Dialog -======================= -TODO Dialog with add/edit/delete of known GUID's. CDlgGuid.ui - -Dialog log viewer -================= -TODO Dialog with log viewing/filtering CDlgLog - -Misc. -===== -Generate code for web page interfaces - -FUTURE -====== -https://github.com/mguentner/cannelloni diff --git a/src/cdlgselectmqtttopics.cpp b/src/cdlgselectmqtttopics.cpp index cfd5d2e6..f98796b0 100644 --- a/src/cdlgselectmqtttopics.cpp +++ b/src/cdlgselectmqtttopics.cpp @@ -67,8 +67,8 @@ CDlgSelectMqttTopics::CDlgSelectMqttTopics(QWidget* parent) // this, // &CDlgSelectMqttTopics::onRowDoubleClicked); - m_bSubscriptionTopics = true; // Subscription topics is default - m_pvscpClient = nullptr; // No client yet + m_type = CDlgSelectMqttTopics::SUBSCRIBE; // Subscription topics is default + m_pvscpClient = nullptr; // No client yet } /////////////////////////////////////////////////////////////////////////////// @@ -150,21 +150,34 @@ CDlgSelectMqttTopics::fillPublishTopics(void) // init // -void -CDlgSelectMqttTopics::init(bool bSubscription, const CVscpClient* pvscpClient) +int +CDlgSelectMqttTopics::init(CDlgSelectMqttTopics::dlgtype type, const CVscpClient* pvscpClient) { - m_bSubscriptionTopics = bSubscription; - m_pvscpClient = (vscpClientMqtt*)pvscpClient; + m_type = type; + + // Check pointer + if (nullptr == pvscpClient) { + return VSCP_ERROR_INVALID_POINTER; + } + + m_pvscpClient = (vscpClientMqtt*)pvscpClient; // Fill the table with data - if (bSubscription) { + if (CDlgSelectMqttTopics::SUBSCRIBE == type) { + setWindowTitle("MQTT Subscription topics"); fillSubscriptionTopics(); } - else { + else if (CDlgSelectMqttTopics::PUBLISH == type) { + setWindowTitle("MQTT Publish topics"); + fillPublishTopics(); + } + else if (CDlgSelectMqttTopics::CLRRETAIN == type) { + setWindowTitle("MQTT clear retain publish topics"); fillPublishTopics(); } QIcon icon(":/check-mark-red.png"); + return VSCP_ERROR_SUCCESS; } /////////////////////////////////////////////////////////////////////////////// @@ -194,7 +207,7 @@ void CDlgSelectMqttTopics::accepted(void) { int pos = 0; - if (m_bSubscriptionTopics) { + if (CDlgSelectMqttTopics::SUBSCRIBE == m_type) { std::list* plist = m_pvscpClient->getSubscribeList(); for (std::list::iterator it = plist->begin(); it != plist->end(); ++it) { subscribeTopic* psub = *it; @@ -202,14 +215,14 @@ CDlgSelectMqttTopics::accepted(void) pos++; } } - else { - pos = 0; + else if (CDlgSelectMqttTopics::PUBLISH == m_type) { + pos = 0; std::list* plist = m_pvscpClient->getPublishList(); for (std::list::iterator it = plist->begin(); it != plist->end(); ++it) { publishTopic* ppub = *it; - ppub->setActive(isActive(pos)); + std::string str = ppub->getTopic(); + m_pvscpClient->clearRetain4Topic(str); pos++; } } } - diff --git a/src/cdlgselectmqtttopics.h b/src/cdlgselectmqtttopics.h index 2daffeb7..25f7e4de 100644 --- a/src/cdlgselectmqtttopics.h +++ b/src/cdlgselectmqtttopics.h @@ -44,6 +44,15 @@ class CDlgSelectMqttTopics : public QDialog { ~CDlgSelectMqttTopics(); public: + // const int SUBSCRIBE = 0; + // const int PUBLISH = 1; + // const int CLRRETAIN = 2; + typedef enum { + SUBSCRIBE, + PUBLISH, + CLRRETAIN + } dlgtype; + /*! Fill table with subscription topics */ @@ -60,8 +69,9 @@ class CDlgSelectMqttTopics : public QDialog { false to handel publiosh topics @param pvscpClient Pointer to client object. Is expected to be initialized and opened. + @return VSCP_ERROR_SUCCESS if OK otherwise errorcode */ - void init(bool bSubscription, const CVscpClient* pvscpClient); + int init(dlgtype type, const CVscpClient* pvscpClient); /*! Get state for a row in the table widget list @@ -72,21 +82,21 @@ public slots: /*! Called when the accepted button is pressed - Will update the subscribe/publish list with + Will update the subscribe/publish list with the active/inactive content from the list */ void accepted(void); - + /*! Double click is used to select or deselect topics */ - //void onRowDoubleClicked(void); + // void onRowDoubleClicked(void); private: Ui::CDlgSelectMqttTopics* ui; - /// Subscription topics - bool m_bSubscriptionTopics; + /// Topics types + bool m_type; /// Pointer to client object vscpClientMqtt* m_pvscpClient; diff --git a/src/cfrmsession.cpp b/src/cfrmsession.cpp index 0c41705a..37ff813e 100644 --- a/src/cfrmsession.cpp +++ b/src/cfrmsession.cpp @@ -58,8 +58,8 @@ #include #include -#include "cdlgselectmqtttopics.h" #include "cdlgknownguid.h" +#include "cdlgselectmqtttopics.h" #include "cdlgsessionfilter.h" #include "cfrmsession.h" @@ -562,8 +562,8 @@ CFrmSession::createMenu() // * * * Connection menu * * * - //m_connMenu = new QMenu(tr("&Connection"), this); - + // m_connMenu = new QMenu(tr("&Connection"), this); + // m_connectAct = m_connMenu->addAction(tr("Connect to interface..."), // this, // &CFrmSession::menu_connect); @@ -574,7 +574,7 @@ CFrmSession::createMenu() // m_pauseAct = m_connMenu->addAction(tr("Pause host")); // m_addHostAct = m_connMenu->addAction(tr("Add host...")); - //m_menuBar->addMenu(m_connMenu); + // m_menuBar->addMenu(m_connMenu); // * * * VSCP menu * * * m_vscpMenu = new QMenu(tr("&VSCP"), this); @@ -605,6 +605,9 @@ CFrmSession::createMenu() m_mqttPublishTopics = m_mqttMenu->addAction(tr("MQTT publish topics..."), this, &CFrmSession::openMqttPublishTopics); + m_mqttPublishTopics = m_mqttMenu->addAction(tr("Clear MQTT retain topics..."), + this, + &CFrmSession::openClearMqttRetainPublishTopics); m_menuBar->addMenu(m_mqttMenu); } @@ -1011,6 +1014,8 @@ CFrmSession::menu_clear_rxlist(void) QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::processEvents(); + m_infoArea->clear(); + m_rxTable->setCurrentCell(-1, -1); // unselect all m_mutexRxList.lock(); @@ -1401,8 +1406,11 @@ CFrmSession::sendTxEvent(void) CTxWidgetItem* itemEvent = (CTxWidgetItem*)m_txTable->item(it->row(), txrow_event); vscpEvent* pev = itemEvent->m_tx.getEvent(); + pev->timestamp = vscp_makeTimeStamp(); // Set timestamp + vscp_setEventToNow(pev); // Set time information to "now" for (int i = 0; i < itemEvent->m_tx.getCount(); i++) { + // Send Event if (VSCP_ERROR_SUCCESS != m_vscpClient->send(*pev)) { spdlog::error(std::string(tr("Session: Unable to send event").toStdString())); QMessageBox::information( @@ -3624,7 +3632,7 @@ void CFrmSession::openMqttSubscribeTopics(void) { CDlgSelectMqttTopics dlg; - dlg.init(true, m_vscpClient); + dlg.init(CDlgSelectMqttTopics::SUBSCRIBE, m_vscpClient); if (QDialog::Accepted == dlg.exec()) { // Disconnect connectToRemoteHost(false); @@ -3641,7 +3649,7 @@ void CFrmSession::openMqttPublishTopics(void) { CDlgSelectMqttTopics dlg; - dlg.init(false, m_vscpClient); + dlg.init(CDlgSelectMqttTopics::PUBLISH, m_vscpClient); if (QDialog::Accepted == dlg.exec()) { // Disconnect connectToRemoteHost(false); @@ -3650,6 +3658,20 @@ CFrmSession::openMqttPublishTopics(void) } } +/////////////////////////////////////////////////////////////////////////////// +// openClearMqttRetainPublishTopics +// + +void +CFrmSession::openClearMqttRetainPublishTopics(void) +{ + CDlgSelectMqttTopics dlg; + dlg.init(CDlgSelectMqttTopics::CLRRETAIN, m_vscpClient); + if (QDialog::Accepted == dlg.exec()) { + // Noting to do + } +} + /////////////////////////////////////////////////////////////////////////////// // getClassInfo // diff --git a/src/cfrmsession.h b/src/cfrmsession.h index 6f24ac69..fb2c965d 100644 --- a/src/cfrmsession.h +++ b/src/cfrmsession.h @@ -458,6 +458,9 @@ public slots: /// Open dialog to let user select active publish topics void openMqttPublishTopics(void); + /// Open dialog to let user select retain publish topics to clear + void openClearMqttRetainPublishTopics(void); + signals: /// Data received from callback