[Debian-iot-packaging] [openzwave-controlpanel] 03/81: Capture and display controller's node number. Add optional support for gnutls.

Dara Adib daradib-guest at moszumanska.debian.org
Thu Dec 22 16:57:44 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 d0c880c5dc115f932758cb4d8223cf021006e13d
Author: glsatz <glsatz at gmail.com>
Date:   Wed Apr 20 02:32:01 2011 +0000

    Capture and display controller's node number.
    Add optional support for gnutls.
---
 Makefile      | 6 ++++--
 cp.js         | 7 ++++++-
 ozwcp.cpp     | 5 ++++-
 webserver.cpp | 6 ++++++
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 2abf794..7bddc76 100644
--- a/Makefile
+++ b/Makefile
@@ -27,10 +27,12 @@ INCLUDES := -I ../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ \
 	-I ../libmicrohttpd/src/include
 LIBZWAVE := $(wildcard ../open-zwave/cpp/lib/linux/*.a)
 LIBUSB := -ludev
+# Remove comment below for gnutls support
+GNUTLS := #-lgnutls
 # for Mac OS X comment out above 2 lines and uncomment next 2 lines
 # LIBZWAVE := $(wildcard ../open-zwave/cpp/lib/mac/*.a)
 # LIBUSB := -framework IOKit -framework CoreFoundation
-LIBS := $(LIBZWAVE) ../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a -pthread $(LIBUSB)
+LIBS := $(LIBZWAVE) $(GNUTLS) ../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a -pthread $(LIBUSB)
 
 %.o : %.cpp
 	$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
@@ -49,4 +51,4 @@ webserver.o: webserver.h ozwcp.h ../open-zwave/cpp/src/Options.h ../open-zwave/c
 	../open-zwave/cpp/src/Notification.h ../open-zwave/cpp/src/platform/Log.h
 
 ozwcp:	ozwcp.o webserver.o zwavelib.o
-	$(LD) -o $@ $(LDFLAGS) ozwcp.o webserver.o zwavelib.o $(LIBS)
\ No newline at end of file
+	$(LD) -o $@ $(LDFLAGS) ozwcp.o webserver.o zwavelib.o $(LIBS)
diff --git a/cp.js b/cp.js
index 168fbda..5996694 100644
--- a/cp.js
+++ b/cp.js
@@ -13,6 +13,7 @@ var nodepollpoll=new Array();
 var astate = false;
 var needsave=0;
 var nodecount;
+var nodeid;
 if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
   pollhttp=new XMLHttpRequest();
 } else {
@@ -65,6 +66,9 @@ function PollReply()
       nodecount = elem[0].getAttribute('nodecount');
       document.getElementById('nodecount').value = nodecount;
     }
+    if (elem[0].getAttribute('nodeid') != nodeid) {
+      nodeid = elem[0].getAttribute('nodeid');
+    }
     if (elem[0].getAttribute('cmode') != document.getElementById('cmode').value)
       document.getElementById('cmode').value = elem[0].getAttribute('cmode');
     if (elem[0].getAttribute('save') != needsave) {
@@ -125,7 +129,8 @@ function PollReply()
 	    }
 	  }
 	}
-	stuff=stuff+'<tr id="node'+i+'" onmouseover="this.className=\'highlight\';" onmouseout="if (this.id == curnode) this.className=\'click\'; else this.className=\'normal\';" onclick="return SaveNode(this.id);" ondblClick="SaveNode(this.id); return DisplayNode();"><td>'+elem[i].getAttribute('id')+'</td><td>'+elem[i].getAttribute('btype')+'</td><td>'+elem[i].getAttribute('gtype')+'</td><td>'+elem[i].getAttribute('manufacturer')+' '+elem[i].getAttribute('product')+'</td><td>'+elem[i].getAttri [...]
+	var id = elem[i].getAttribute('id');
+	stuff=stuff+'<tr id="node'+i+'" onmouseover="this.className=\'highlight\';" onmouseout="if (this.id == curnode) this.className=\'click\'; else this.className=\'normal\';" onclick="return SaveNode(this.id);" ondblClick="SaveNode(this.id); return DisplayNode();"><td>'+id+(id == nodeid ? '*' : '')+'</td><td>'+elem[i].getAttribute('btype')+'</td><td>'+elem[i].getAttribute('gtype')+'</td><td>'+elem[i].getAttribute('manufacturer')+' '+elem[i].getAttribute('product')+'</td><td>'+elem[i].getAtt [...]
 	CreateDivs(elem, 'user', divcur, i);
 	CreateDivs(elem, 'config', divcon, i);
 	CreateDivs(elem, 'system', divinfo, i);
diff --git a/ozwcp.cpp b/ozwcp.cpp
index 8d8dc13..ec290b5 100644
--- a/ozwcp.cpp
+++ b/ozwcp.cpp
@@ -65,6 +65,7 @@ pthread_mutex_t glock = PTHREAD_MUTEX_INITIALIZER;
 bool done = false;
 bool needsave = false;
 uint32 homeId = 0;
+uint8 nodeId = 0;
 char *cmode = "";
 int32 debug = false;
 
@@ -507,9 +508,11 @@ void OnNotification (Notification const* _notification, void* _context)
     //pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_DriverReady:
-    Log::Write("Notification: Driver Ready, homeId %08x", _notification->GetHomeId());
+    Log::Write("Notification: Driver Ready, homeId %08x, nodeId %d", _notification->GetHomeId(),
+	       _notification->GetNodeId());
     pthread_mutex_lock(&glock);
     homeId = _notification->GetHomeId();
+    nodeId = _notification->GetNodeId();
     if (Manager::Get()->IsStaticUpdateController(homeId))
       cmode = "SUC";
     else if (Manager::Get()->IsPrimaryController(homeId))
diff --git a/webserver.cpp b/webserver.cpp
index 080adcd..a4c8d44 100644
--- a/webserver.cpp
+++ b/webserver.cpp
@@ -83,6 +83,7 @@ extern pthread_mutex_t glock;
 extern bool done;
 extern bool needsave;
 extern uint32 homeId;
+extern uint8 nodeId;
 extern char *cmode;
 extern int debug;
 
@@ -290,6 +291,11 @@ int Webserver::SendPollResponse (struct MHD_Connection *conn)
   else
     str[0] = '\0';
   pollElement->SetAttribute("homeid", str);
+  if (nodeId != 0L)
+    snprintf(str, sizeof(str), "%d", nodeId);
+  else
+    str[0] = '\0';
+  pollElement->SetAttribute("nodeid", str);
   pollElement->SetAttribute("nodecount", MyNode::getNodeCount());
   pollElement->SetAttribute("cmode", cmode);
   pollElement->SetAttribute("save", needsave);

-- 
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