[Debian-iot-packaging] [openzwave-controlpanel] 20/81: Add a USB test harness. Fix topology display to handle non-consecutive nodes.
Dara Adib
daradib-guest at moszumanska.debian.org
Thu Dec 22 16:57:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
daradib-guest pushed a commit to branch debian/master
in repository openzwave-controlpanel.
commit ecf24b737d11c277860e618c419e8cfdc6d1a0d2
Author: glsatz <glsatz at gmail.com>
Date: Fri Feb 10 03:01:06 2012 +0000
Add a USB test harness.
Fix topology display to handle non-consecutive nodes.
---
Makefile | 4 ++--
TODO | 1 -
testusb.sh | 23 +++++++++++++++++++++++
webserver.cpp | 40 +++++++++++++++++++++++-----------------
4 files changed, 48 insertions(+), 20 deletions(-)
diff --git a/Makefile b/Makefile
index 8fd054d..0143daa 100644
--- a/Makefile
+++ b/Makefile
@@ -37,8 +37,8 @@ GNUTLS := #-lgnutls
#LIBUSB := -ludev
# for Mac OS X comment out above 2 lines and uncomment next 2 lines
-LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
-LIBUSB := -framework IOKit -framework CoreFoundation
+#LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
+#LIBUSB := -framework IOKit -framework CoreFoundation
LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB)
diff --git a/TODO b/TODO
index 06fb386..cf9d398 100644
--- a/TODO
+++ b/TODO
@@ -3,5 +3,4 @@ opwcp to do list: (3/12/2011)
Update Makefile to automatically compile on Mac OS X
Support various flavors of Internet Explorer
Figure out packaging/distribution mechanism
-Add routing table display
Finish testing all controller functions
diff --git a/testusb.sh b/testusb.sh
new file mode 100755
index 0000000..2833b34
--- /dev/null
+++ b/testusb.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+for (( i = 1 ; i <= 10 ; i = i + 1 )) ; do
+ echo loop $i
+ wget -r -l 1 -O /dev/null -o /dev/null 'http://backup:9900'
+ sleep 1
+ echo open
+ wget -O /dev/null -o /dev/null --post-data="fn=open&usb=true" 'http://backup:9900/devpost.html?dev=&fn=open&usb=true'
+ wget -O /dev/null -o /dev/null 'http://backup:9900'
+ j=20
+ while [ $j -gt 0 ]; do
+ wget -O /tmp/poll.xml -o /dev/null 'http://backup:9900/poll.xml'
+ if ( test -s /tmp/poll.xml && grep 'log size="0"' /tmp/poll.xml > /dev/null 2>&1 ) ; then
+ let j--
+ else
+ j=100
+ fi
+ done
+ echo close
+ wget -O /dev/null -o /dev/null --post-data="fn=close&usb=true" 'http://backup:9900/devpost.html?dev=&fn=close&usb=true'
+ wget -O /dev/null -o /dev/null 'http://backup:9900'
+done
+echo exit
+wget -O /dev/null -o /dev/null --post-data="fn=exit" 'http://backup:9900/devpost.html?dev=&fn=exit'
diff --git a/webserver.cpp b/webserver.cpp
index e3a3e01..28a558a 100644
--- a/webserver.cpp
+++ b/webserver.cpp
@@ -290,7 +290,7 @@ const char *Webserver::SendTopoResponse (struct MHD_Connection *conn, const char
string s;
static char fntemp[32];
char *fn;
- uint i, j;
+ uint i, j, k;
uint8 cnt;
uint32 len;
uint8 *neighbors;
@@ -301,24 +301,30 @@ const char *Webserver::SendTopoResponse (struct MHD_Connection *conn, const char
if (strcmp(fun, "load") == 0) {
cnt = MyNode::getNodeCount();
- for (i = 0; i < cnt; i++) {
- len = Manager::Get()->GetNodeNeighbors(homeId, i+1, &neighbors);
- if (len > 0) {
- TiXmlElement* nodeElement = new TiXmlElement("node");
- snprintf(str, sizeof(str), "%d", i+1);
- nodeElement->SetAttribute("id", str);
- string list = "";
- for (j = 0; j < len; j++) {
- snprintf(str, sizeof(str), "%d", neighbors[j]);
- list += str;
- if (j < (len - 1))
- list += ",";
+ i = 0;
+ j = 1;
+ while (j <= cnt && i < MAX_NODES) {
+ if (nodes[i] != NULL) {
+ len = Manager::Get()->GetNodeNeighbors(homeId, i, &neighbors);
+ if (len > 0) {
+ TiXmlElement* nodeElement = new TiXmlElement("node");
+ snprintf(str, sizeof(str), "%d", i);
+ nodeElement->SetAttribute("id", str);
+ string list = "";
+ for (k = 0; k < len; k++) {
+ snprintf(str, sizeof(str), "%d", neighbors[k]);
+ list += str;
+ if (k < (len - 1))
+ list += ",";
+ }
+ TiXmlText *textElement = new TiXmlText(list.c_str());
+ nodeElement->LinkEndChild(textElement);
+ topoElement->LinkEndChild(nodeElement);
+ delete [] neighbors;
}
- TiXmlText *textElement = new TiXmlText(list.c_str());
- nodeElement->LinkEndChild(textElement);
- topoElement->LinkEndChild(nodeElement);
+ j++;
}
- delete [] neighbors;
+ i++;
}
}
strncpy(fntemp, "/tmp/ozwcp.scenes.XXXXXX", sizeof(fntemp));
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-iot/openzwave-controlpanel.git
More information about the Debian-iot-packaging
mailing list