[Debian-iot-packaging] [openzwave-controlpanel] 26/81: New Log::Write interface. Handle NodeProtocolInfo and NodeNaming notifications. Pass more node state and display as flags with tooltips. Add button on configuration display to refresh values. Fix node naming off by one bug. Process out of order node numbers in routing display.

Dara Adib daradib-guest at moszumanska.debian.org
Thu Dec 22 16:57:47 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 673d419e1e74afc54f40a884ac990baea9fe00eb
Author: glsatz at gmail.com <glsatz at gmail.com>
Date:   Thu Feb 23 15:43:17 2012 +0000

    New Log::Write interface.
    Handle NodeProtocolInfo and NodeNaming notifications.
    Pass more node state and display as flags with tooltips.
    Add button on configuration display to refresh values.
    Fix node naming off by one bug.
    Process out of order node numbers in routing display.
---
 cp.js         | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 ozwcp.cpp     | 60 +++++++++++++++++++++++++---------------------
 webserver.cpp | 23 +++++++++++++++++-
 3 files changed, 121 insertions(+), 38 deletions(-)

diff --git a/cp.js b/cp.js
index 79a6739..39ae28d 100644
--- a/cp.js
+++ b/cp.js
@@ -1,6 +1,7 @@
 var pollhttp;
 var scenehttp;
 var topohttp;
+var racphttp;
 var polltmr=null;
 var pollwait=null;
 var divcur=new Array();
@@ -49,6 +50,11 @@ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
 } else {
   topohttp=new ActiveXObject("Microsoft.XMLHTTP");
 }
+if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
+  racphttp=new XMLHttpRequest();
+} else {
+  racphttp=new ActiveXObject("Microsoft.XMLHTTP");
+}
 function SaveNode(newid)
 {
   var i=newid.substr(4);
@@ -168,6 +174,9 @@ function PollReply()
 		     id: elem[i].getAttribute('id'), gtype: elem[i].getAttribute('gtype'),
 		     manufacturer: elem[i].getAttribute('manufacturer'), product: elem[i].getAttribute('product'),
 		     name: elem[i].getAttribute('name'), location: elem[i].getAttribute('location'),
+		     listening: elem[i].getAttribute('listening') == 'true', frequent: elem[i].getAttribute('frequent') == 'true',
+		     beam: elem[i].getAttribute('beam') == 'true', routing: elem[i].getAttribute('routing') == 'true',
+		     security: elem[i].getAttribute('security') == 'true',
 		     values: null, groups: null};
 	var k = 0;
 	var values = elem[i].getElementsByTagName('value');
@@ -229,6 +238,8 @@ function PollReply()
 	  var dt = new Date(nodes[i].time*1000);
 	  var yd = new Date(dt.getDate()-1);
 	  var ts;
+	  var ext;
+	  var exthelp;
 	  if (dt < yd)
 	    ts = dt.toLocaleDateString() + ' ' + dt.toLocaleTimeString();
 	  else
@@ -253,7 +264,35 @@ function PollReply()
 	      }
 	      break;
 	    }
-	  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>'+nodes[i].id+(nodes[i].id == nodeid ? '*' : '')+'</td><td>'+nodes[i].btype+'</td><td>'+nodes[i].gtype+'</td><td>'+nodes[i].manufacturer+' '+nodes[i].product+'</td><td>'+nodes[i].name+'</td><td>'+nodes[i].location+'</td><td> [...]
+	  ext = ' ';
+	  exthelp = '';
+	  if (nodes[i].id == nodeid) {
+	    ext = ext + '*';
+	    exthelp = exthelp + 'controller, ';
+	  }
+	  if (nodes[i].listening) {
+	    ext = ext + 'L';
+	    exthelp = exthelp + 'listening, ';
+	  }
+	  if (nodes[i].frequent) {
+	    ext = ext + 'F';
+	    exthelp = exthelp + 'FLiRS, ';
+	  }
+	  if (nodes[i].beam) {
+	    ext = ext + 'B';
+	    exthelp = exthelp + 'beaming, ';
+	  }
+	  if (nodes[i].routing) {
+	    ext = ext + 'R';
+	    exthelp = exthelp + 'routing, ';
+	  }
+	  if (nodes[i].security) {
+	    ext = ext + 'S';
+	    exthelp = exthelp + 'security, ';
+	  }
+	  if (exthelp.length > 0)
+	    exthelp = exthelp.substr(0, exthelp.length - 2);
+	  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 onmouseover="ShowToolTip(\''+exthelp+'\',0);" onmouseout="HideToolTip();">'+nodes[i].id+ext+'</td><td>'+nodes[i].btype+'</td><td>'+nodes[i].gtype+'</td><td>'+nodes[i].manufacturer+' '+nodes[i].product+'</td><td>'+nodes[i].na [...]
 	  CreateDivs('user', divcur, i);
 	  CreateDivs('config', divcon, i);
 	  CreateDivs('system', divinfo, i);
@@ -1138,21 +1177,23 @@ function TopoReply()
       }
       var stuff = '<tr><th>Nodes</th>';
       var topohead = document.getElementById('topohead');
-      for (i = 1; i < routes.length; i++) {
-	if (routes[i] == undefined)
-	  routes[i]=new Array();
+      for (i = 1; i < nodes.length; i++) {
+	if (nodes[i] == null)
+	  continue;
 	stuff=stuff+'<th>'+i+'</th>';
       }
       stuff=stuff+'</tr>'
       topohead.innerHTML = stuff;
       stuff = '';
-      for (i = 1; i < routes.length; i++) {
+      for (i = 1; i < nodes.length; i++) {
+	if (nodes[i] == null)
+	  continue;
 	stuff=stuff+'<tr><td style="vertical-align: top; text-decoration: underline; background-color: #FFFFFF;">'+i+'</td>';
 	var j, k = 0;
-	for (j = 1; j < routes.length; j++) {
-	  if (i == j) {
-	    stuff=stuff+'<td> </td>';
-	  } else if (k < routes[i].length && j == routes[i][k]) {
+	for (j = 1; j < nodes.length; j++) {
+	  if (nodes[j] == null)
+	    continue;
+	  if (routes[i] != undefined && k < routes[i].length && j == routes[i][k]) {
 	    stuff=stuff+'<td>*</td>';
 	    k++;
 	  } else {
@@ -1166,6 +1207,18 @@ function TopoReply()
     }
   }
 }
+function RequestAllConfig(n)
+{
+  var params='fun=racp&node='+n;
+  racphttp.open('POST','confparmpost.html',false);
+  racphttp.onreadystatechange = PollReply;
+  racphttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+  racphttp.setRequestHeader("Content-length", params.length);
+  racphttp.setRequestHeader("Connection", "close");
+  racphttp.send(params);
+
+  return false;
+}
 function quotestring(s)
 {
   return s.replace(/\'/g, "");
@@ -1257,7 +1310,7 @@ function CreateButton(i,j,vid)
 function CreateDivs(genre,divto,ind)
 {
   divto[ind]='<table border="0" cellpadding="1" cellspacing="0"><tbody>';
-  if (nodes[ind].values != null)
+  if (nodes[ind].values != null) {
     for (var i = 0; i < nodes[ind].values.length; i++) {
       if (nodes[ind].values[i].genre != genre)
 	continue;
@@ -1284,6 +1337,9 @@ function CreateDivs(genre,divto,ind)
 	divto[ind]=divto[ind]+CreateButton(ind,i,vid);
       }
     }
+    if (genre == 'config')
+      divto[ind]=divto[ind]+'<tr><td> </td><td><button type="submit" id="requestallconfig" name="requestallconfig" onclick="return RequestAllConfig('+ind+');">Refresh</button></td><td> </td></tr>';
+  }
   divto[ind]=divto[ind]+'</tbody></table>';
 }
 function CreateName(val,ind)
diff --git a/ozwcp.cpp b/ozwcp.cpp
index f6a3244..d5982c2 100644
--- a/ozwcp.cpp
+++ b/ozwcp.cpp
@@ -78,7 +78,7 @@ list<uint8> MyNode::removed;
 MyNode::MyNode (int32 const ind) : type(0)
 {
   if (ind < 1 || ind > MAX_NODES) {
-    Log::Write("new: bad node value %d, ignoring...", ind);
+    Log::Write(LogLevel_Info, "new: bad node value %d, ignoring...", ind);
     delete this;
     return;
   }
@@ -114,7 +114,7 @@ MyNode::~MyNode ()
 void MyNode::remove (int32 const ind)
 {
   if (ind < 1 || ind > MAX_NODES) {
-    Log::Write("remove: bad node value %d, ignoring...", ind);
+    Log::Write(LogLevel_Info, "remove: bad node value %d, ignoring...", ind);
     return;
   }
   if (nodes[ind] != NULL) {
@@ -438,7 +438,7 @@ void OnNotification (Notification const* _notification, void* _context)
   ValueID id = _notification->GetValueID();
   switch (_notification->GetType()) {
   case Notification::Type_ValueAdded:
-    Log::Write("Notification: Value Added Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Value Added Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -447,7 +447,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_ValueRemoved:
-    Log::Write("Notification: Value Removed Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Value Removed Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -456,7 +456,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_ValueChanged:
-    Log::Write("Notification: Value Changed Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Value Changed Home 0x%08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -466,7 +466,7 @@ void OnNotification (Notification const* _notification, void* _context)
     break;
   case Notification::Type_Group:
     {
-      Log::Write("Notification: Group Home 0x%08x Node %d Group %d",
+      Log::Write(LogLevel_Info, "Notification: Group Home 0x%08x Node %d Group %d",
 		 _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetGroupIdx());
       uint8 *v;
       int8 n = Manager::Get()->GetAssociations(homeId, _notification->GetNodeId(), _notification->GetGroupIdx(), &v);
@@ -477,7 +477,7 @@ void OnNotification (Notification const* _notification, void* _context)
     }
     break;
   case Notification::Type_NodeNew:
-    Log::Write("Notification: Node New Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Node New Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -486,7 +486,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&glock);
     break;
   case Notification::Type_NodeAdded:
-    Log::Write("Notification: Node Added Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Node Added Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -498,7 +498,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&glock);
     break;
   case Notification::Type_NodeRemoved:
-    Log::Write("Notification: Node Removed Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Node Removed Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -510,19 +510,25 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&glock);
     break;
   case Notification::Type_NodeProtocolInfo:
-    Log::Write("Notification: Node Protocol Info Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Node Protocol Info Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
+    pthread_mutex_lock(&nlock);
+    nodes[_notification->GetNodeId()]->saveValue(id);
+    pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_NodeNaming:
-    Log::Write("Notification: Node Naming Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Node Naming Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
+    pthread_mutex_lock(&nlock);
+    nodes[_notification->GetNodeId()]->saveValue(id);
+    pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_NodeEvent:
-    Log::Write("Notification: Node Event Home %08x Node %d Status %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Node Event Home %08x Node %d Status %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetEvent(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -531,7 +537,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_PollingDisabled:
-    Log::Write("Notification: Polling Disabled Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Polling Disabled Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -540,7 +546,7 @@ void OnNotification (Notification const* _notification, void* _context)
     //pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_PollingEnabled:
-    Log::Write("Notification: Polling Enabled Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
+    Log::Write(LogLevel_Info, "Notification: Polling Enabled Home %08x Node %d Genre %s Class %s Instance %d Index %d Type %s",
 	       _notification->GetHomeId(), _notification->GetNodeId(),
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
@@ -549,23 +555,23 @@ void OnNotification (Notification const* _notification, void* _context)
     //pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_CreateButton:
-    Log::Write("Notification: Create button Home %08x Node %d Button %d",
+    Log::Write(LogLevel_Info, "Notification: Create button Home %08x Node %d Button %d",
 	       _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetButtonId());
     break;
   case Notification::Type_DeleteButton:
-    Log::Write("Notification: Delete button Home %08x Node %d Button %d",
+    Log::Write(LogLevel_Info, "Notification: Delete button Home %08x Node %d Button %d",
 	       _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetButtonId());
     break;
   case Notification::Type_ButtonOn:
-    Log::Write("Notification: Button On Home %08x Node %d Button %d",
+    Log::Write(LogLevel_Info, "Notification: Button On Home %08x Node %d Button %d",
 	       _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetButtonId());
     break;
   case Notification::Type_ButtonOff:
-    Log::Write("Notification: Button Off Home %08x Node %d Button %d",
+    Log::Write(LogLevel_Info, "Notification: Button Off Home %08x Node %d Button %d",
 	       _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetButtonId());
     break;
   case Notification::Type_DriverReady:
-    Log::Write("Notification: Driver Ready, homeId %08x, nodeId %d", _notification->GetHomeId(),
+    Log::Write(LogLevel_Info, "Notification: Driver Ready, homeId %08x, nodeId %d", _notification->GetHomeId(),
 	       _notification->GetNodeId());
     pthread_mutex_lock(&glock);
     homeId = _notification->GetHomeId();
@@ -579,7 +585,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&glock);
     break;
   case Notification::Type_DriverFailed:
-    Log::Write("Notification: Driver Failed, homeId %08x", _notification->GetHomeId());
+    Log::Write(LogLevel_Info, "Notification: Driver Failed, homeId %08x", _notification->GetHomeId());
     pthread_mutex_lock(&glock);
     done = false;
     needsave = false;
@@ -592,7 +598,7 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_DriverReset:
-    Log::Write("Notification: Driver Reset, homeId %08x", _notification->GetHomeId());
+    Log::Write(LogLevel_Info, "Notification: Driver Reset, homeId %08x", _notification->GetHomeId());
     pthread_mutex_lock(&glock);
     done = false;
     needsave = false;
@@ -610,25 +616,25 @@ void OnNotification (Notification const* _notification, void* _context)
     pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_MsgComplete:
-    Log::Write("Notification: Message Complete");
+    Log::Write(LogLevel_Info, "Notification: Message Complete");
     break;
   case Notification::Type_EssentialNodeQueriesComplete:
-    Log::Write("Notification: Essential Node %d Queries Complete", _notification->GetNodeId());
+    Log::Write(LogLevel_Info, "Notification: Essential Node %d Queries Complete", _notification->GetNodeId());
     break;
   case Notification::Type_NodeQueriesComplete:
-    Log::Write("Notification: Node %d Queries Complete", _notification->GetNodeId());
+    Log::Write(LogLevel_Info, "Notification: Node %d Queries Complete", _notification->GetNodeId());
     pthread_mutex_lock(&nlock);
     nodes[_notification->GetNodeId()]->sortValues();
     pthread_mutex_unlock(&nlock);
     break;
   case Notification::Type_AwakeNodesQueried:
-    Log::Write("Notification: Awake Nodes Queried");
+    Log::Write(LogLevel_Info, "Notification: Awake Nodes Queried");
     break;
   case Notification::Type_AllNodesQueried:
-    Log::Write("Notification: All Nodes Queried");
+    Log::Write(LogLevel_Info, "Notification: All Nodes Queried");
     break;
   default:
-    Log::Write("Notification: type %d home %08x node %d genre %d class %d instance %d index %d type %d",
+    Log::Write(LogLevel_Info, "Notification: type %d home %08x node %d genre %d class %d instance %d index %d type %d",
 	       _notification->GetType(), _notification->GetHomeId(),
 	       _notification->GetNodeId(), id.GetGenre(), id.GetCommandClassId(),
 	       id.GetInstance(), id.GetIndex(), id.GetType());
diff --git a/webserver.cpp b/webserver.cpp
index cf58c42..e01f5c0 100644
--- a/webserver.cpp
+++ b/webserver.cpp
@@ -552,6 +552,11 @@ int Webserver::SendPollResponse (struct MHD_Connection *conn)
 	nodeElement->SetAttribute("location", Manager::Get()->GetNodeLocation(homeId, i).c_str());
 	nodeElement->SetAttribute("manufacturer", Manager::Get()->GetNodeManufacturerName(homeId, i).c_str());
 	nodeElement->SetAttribute("product", Manager::Get()->GetNodeProductName(homeId, i).c_str());
+	nodeElement->SetAttribute("listening", Manager::Get()->IsNodeListeningDevice(homeId, i) ? "true" : "false");
+	nodeElement->SetAttribute("frequent", Manager::Get()->IsNodeFrequentListeningDevice(homeId, i) ? "true" : "false");
+	nodeElement->SetAttribute("beam", Manager::Get()->IsNodeBeamingDevice(homeId, i) ? "true" : "false");
+	nodeElement->SetAttribute("routing", Manager::Get()->IsNodeRoutingDevice(homeId, i) ? "true" : "false");
+	nodeElement->SetAttribute("security", Manager::Get()->IsNodeSecurityDevice(homeId, i) ? "true" : "false");
 	nodeElement->SetAttribute("time", nodes[i]->getTime());
 	web_get_groups(i, nodeElement);
 	// Don't think the UI needs these
@@ -691,6 +696,11 @@ int web_config_post (void *cls, enum MHD_ValueKind kind, const char *key, const
   } else if (strcmp(cp->conn_url, "/topopost.html") == 0) {
     if (strcmp(key, "fun") == 0)
       cp->conn_arg1 = (void *)strdup(data);
+  } else if (strcmp(cp->conn_url, "/confparmpost.html") == 0) {
+    if (strcmp(key, "fun") == 0)
+      cp->conn_arg1 = (void *)strdup(data);
+    else if (strcmp(key, "node") == 0)
+      cp->conn_arg2 = (void *)strdup(data);
   }
   return MHD_YES;
 }
@@ -864,6 +874,17 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
 	cp->conn_res = (void *)SendTopoResponse(conn, (char *)cp->conn_arg1, (char *)cp->conn_arg2, (char *)cp->conn_arg3, (char *)cp->conn_arg4);
       } else
 	ret = web_send_file(conn, (char *)cp->conn_res, MHD_HTTP_OK, true);
+    } else if (strcmp(url, "/confparmpost.html") == 0) {
+      if (*up_data_size != 0) {
+	MHD_post_process(cp->conn_pp, up_data, *up_data_size);
+	*up_data_size = 0;
+	if (cp->conn_arg2 != NULL && strlen((char *)cp->conn_arg2) > 0) {
+	  uint8 node = strtol((char *)cp->conn_arg2, NULL, 10);
+	  Manager::Get()->RequestAllConfigParams(homeId, node);
+	}
+	return MHD_YES;
+      } else
+	ret = web_send_data(conn, EMPTY, MHD_HTTP_OK, false, false, NULL); // no free, no copy
     } else if (strcmp(url, "/admpost.html") == 0) {
       if (*up_data_size != 0) {
 	MHD_post_process(cp->conn_pp, up_data, *up_data_size);
@@ -1011,7 +1032,7 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
 	*up_data_size = 0;
 
 	if (cp->conn_arg2 != NULL && strlen((char *)cp->conn_arg2) > 4 && cp->conn_arg3 != NULL) {
-	  node = strtol(((char *)cp->conn_arg2) + 4, NULL, 10) + 1;
+	  node = strtol(((char *)cp->conn_arg2) + 4, NULL, 10);
 	  if (strcmp((char *)cp->conn_arg1, "nam") == 0) { /* Node naming */
 	    Manager::Get()->SetNodeName(homeId, node, (char *)cp->conn_arg3);
 	  } else if (strcmp((char *)cp->conn_arg1, "loc") == 0) { /* Node location */

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