Skip to content

Commit

Permalink
Fixed node scan over socketcan
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Mar 19, 2024
1 parent e5b06a2 commit a9feb20
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"${workspaceFolder}/common/third_party/duktape-2.6.0/",
"${workspaceFolder}/common/third_party/fastpbkdf2-1.0.0/",
"${workspaceFolder}/../vscp/src/common",
"${workspaceFolder}/../vscp/src/vscp/common"
"${workspaceFolder}/../vscp/src/vscp/common"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "g++ build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "/home/akhe/development/VSCP/vscpworks/src/vscpworks",
"program": "${workspaceFolder}/build/vscp-works-qt",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}/vscpworks/",
Expand Down
14 changes: 11 additions & 3 deletions src/cfrmnodescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include <QXmlStreamReader>
#include <QtSql>
#include <QtWidgets>
#include <QDebug>

// ----------------------------------------------------------------------------

Expand Down Expand Up @@ -113,11 +114,18 @@ CFoundNodeWidgetItem::~CFoundNodeWidgetItem()
static void
eventReceived(vscpEvent* pev, void* pobj)
{
// Check pointers
if ((nullptr == pev) || (nullptr == pobj) ) {
return;
}

printf("Scan event: %X:%X\n", pev->vscp_class, pev->vscp_type);

vscpEvent* pevnew = new vscpEvent;
pevnew->sizeData = 0;
pevnew->pdata = nullptr;
vscp_copyEvent(pevnew, pev);

CFrmSession* pSession = (CFrmSession*)pobj;
pSession->threadReceive(pevnew);
}
Expand Down Expand Up @@ -243,8 +251,8 @@ CFrmNodeScan::CFrmNodeScan(QWidget* parent, QJsonObject* pconn)
"log for more details."));
return;
}
m_vscpClient->setCallback(eventReceived, this);
// m_connectActToolBar->setChecked(true);
//m_vscpClient->setCallback(eventReceived, this);
//m_connectActToolBar->setChecked(true);
connectToRemoteHost(true);
break;
#endif
Expand Down
168 changes: 84 additions & 84 deletions src/cfrmnodescan.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,58 +37,84 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="7" column="1">
<widget class="QPushButton" name="btnScan">
<item row="9" column="0" colspan="3">
<widget class="QTextBrowser" name="infoArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="statusTip">
<string>Information about current selected node</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="editDelay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Start node scan</string>
<string>Delay between slow scan probes in microseconds</string>
</property>
<property name="text">
<string>Scan</string>
</property>
<property name="icon">
<iconset>
<normalon>:/images/svg/search.svg</normalon>
</iconset>
<string>10000</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="chkFetchInfo">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Fetch node info</string>
</property>
<property name="checked">
<bool>true</bool>
<string>Delay:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Timeout:</string>
<item row="0" column="2">
<widget class="QTreeWidget" name="treeFound">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="statusTip">
<string>Nodes found from search</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Discovered nodes</string>
</property>
</column>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="editDelay">
<item row="4" column="2">
<widget class="QLineEdit" name="editSearchNodes">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Delay between slow scan probes in microseconds</string>
<property name="statusTip">
<string>Enter id's for node range to be searched for (1-254 or 1,2,3 or a combination of both)</string>
</property>
<property name="text">
<string>10000</string>
<string>1-253</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Node Info</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="6" column="2">
<widget class="QLineEdit" name="editTimeout">
<property name="enabled">
<bool>false</bool>
Expand All @@ -101,81 +127,62 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="13" column="0" colspan="3">
<widget class="QProgressBar" name="progressBarScan">
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Nodes :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkSlowScan">
<property name="text">
<string>Slow scan</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QTextBrowser" name="infoArea">
<item row="10" column="1">
<widget class="QPushButton" name="btnScan">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="statusTip">
<string>Information about current selected node</string>
<property name="toolTip">
<string>Start node scan</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<property name="text">
<string>Scan</string>
</property>
<property name="icon">
<iconset>
<normalon>:/images/svg/search.svg</normalon>
</iconset>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QTreeWidget" name="treeFound">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="statusTip">
<string>Nodes found from search</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
<item row="6" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Timeout:</string>
</property>
<column>
<property name="text">
<string>Discovered nodes</string>
</property>
</column>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<item row="3" column="2">
<widget class="QCheckBox" name="chkSlowScan">
<property name="text">
<string>Delay:</string>
<string>Slow scan</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="editSearchNodes">
<property name="enabled">
<bool>false</bool>
</property>
<property name="statusTip">
<string>Enter id's for node range to be searched for (1-254 or 1,2,3 or a combination of both)</string>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Nodes :</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="chkFetchInfo">
<property name="text">
<string>1-253</string>
<string>Fetch node info</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
Expand All @@ -189,13 +196,6 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Node Info</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
7 changes: 7 additions & 0 deletions src/vscpworks.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ using namespace kainjow::mustache;
Q_DECLARE_METATYPE(vscpEvent)
Q_DECLARE_METATYPE(vscpEventEx)

/*!
Set to true to remove development functionality
for an official release build.
*/
#define VSCP_WORKS_RELEASE false

/// Application name used in titles and headers
#define APPNAME "VSCP Works+"

// home folder is used for storage of program configuration
Expand Down

0 comments on commit a9feb20

Please sign in to comment.