[Debian-iot-packaging] [openzwave-controlpanel] 31/81: Update change times better. Add new Awake notification. Capture and output error messages from controller callback. Add Heal function. AddDevice and RemoveDevice are only controller functions. AddController and RemoveController are no longer present.

Dara Adib daradib-guest at moszumanska.debian.org
Thu Dec 22 16:57:48 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 101f8dbda77ebf1aaa6aea4c7b55395e2ef4ef6d
Author: glsatz <glsatz at gmail.com>
Date:   Wed Dec 19 04:53:03 2012 +0000

    Update change times better. Add new Awake notification. Capture and output
    error messages from controller callback. Add Heal function. AddDevice and
    RemoveDevice are only controller functions. AddController and
    RemoveController are no longer present.
---
 Makefile      |  4 +--
 cp.html       | 17 +++++++----
 cp.js         | 80 ++++++++++++++++++++++++++++----------------------
 ozwcp.cpp     | 11 ++++++-
 ozwcp.h       |  4 ++-
 webserver.cpp | 94 ++++++++++++++++++++++++++++++++++++-----------------------
 webserver.h   |  2 +-
 zwavelib.cpp  | 32 ++++++++++++++++++++
 8 files changed, 162 insertions(+), 82 deletions(-)

diff --git a/Makefile b/Makefile
index 6069419..698baed 100644
--- a/Makefile
+++ b/Makefile
@@ -33,8 +33,8 @@ INCLUDES := -I $(OPENZWAVE)/cpp/src -I $(OPENZWAVE)/cpp/src/command_classes/ \
 GNUTLS := #-lgnutls
 
 # for Linux uncomment out next two lines
-#LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/linux/*.a)
-#LIBUSB := -ludev
+LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/linux/*.a)
+LIBUSB := -ludev
 
 # for Mac OS X comment out above 2 lines and uncomment next 2 lines
 #LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
diff --git a/cp.html b/cp.html
index ad29923..b0073d5 100644
--- a/cp.html
+++ b/cp.html
@@ -139,7 +139,7 @@
 	      <option value="scen">Scenes</option>
 	      <option value="topo">Topology</option>
 	      <option value="stat">Statistics</option>
-	      <option value="test">Test Network</option>
+	      <option value="test">Test & Heal</option>
 	    </select>
 	  </div>
 	  <div class="rsb" style="margin-left: 10px;">
@@ -345,14 +345,21 @@
 	      </table>
 	    </div>
 	  </div>
-	  <div id="testcntl" name="testcntl" class="rsb" style="display: none; margin-right: 5px;">
+	  <div id="thcntl" name="thcntl" class="rsb" style="display: none; margin-right: 5px;">
 	    <div class="rsb" style="margin-left: 5px;">
-	      <button id="testbutton" name="testbutton" onclick="return TestLoad('load');" type="submit">Run</button>
+	      <button id="testbutton" name="testbutton" onclick="return TestHealLoad('test');" type="submit">Run</button>
 	      <label><span class="legend" style="font-size: 12px;">Message count:</span></label>
 	      <input id="testmcnt" type="text" size="5" class="legend">
 	    </div>
+	    <br>
+	    <div class="rsb" style="margin-left: 5px;">
+	      <button id="healbutton" name="healbutton" onclick="return TestHealLoad('heal');" type="submit">Run</button>
+	      <label><span class="legend" style="font-size: 12px;">Node:</span></label>
+	      <input id="healnode" type="text" size="5" class="legend">
+	      <input id="healrrs" type="checkbox" value="healrr">Heal Return Routes
+	    </div>
 	  </div>
-	  <div id="testreport" class="log" style="float: left; margin-left: 5px; width: 98%; text-align: left; display: none;">
+	  <div id="testhealreport" class="log" style="float: left; margin-left: 5px; width: 98%; text-align: left; display: none;">
 	  </div>
 	</form>
       </fieldset>
@@ -364,11 +371,9 @@
 	  <div class="esb" style="margin-left: 14px; width: 200px;">
 	    <select id="adminops" onchange="return DoAdmHelp();">
 	      <option value="choice" selected="true">Select an operation:</option>
-	      <option value="addc">Add Controller</option>
 	      <option value="addd">Add Device</option>
 	      <option value="cprim">Create Primary</option>
 	      <option value="rconf">Receive Configuration</option>
-	      <option value="remc">Remove Controller</option>
 	      <option value="remd">Remove Device</option>
 	      <option value="remfn">Remove Failed Node</option>
 	      <option value="hnf">Has Node Failed</option>
diff --git a/cp.js b/cp.js
index 404d7e7..d9f1304 100644
--- a/cp.js
+++ b/cp.js
@@ -147,8 +147,8 @@ function PollReply()
 	}
       }
       if (elem[0].getAttribute('noop') == '1') {
-	var testreport = document.getElementById('testreport');
-	testreport.innerHTML = testreport.innerHTML + 'No Operation message completed.<br>';  
+	var testhealreport = document.getElementById('testhealreport');
+	testhealreport.innerHTML = testhealreport.innerHTML + 'No Operation message completed.<br>';  
       }	  
       elem = xml.getElementsByTagName('admin');
       if (elem[0].getAttribute('active') == 'true') {
@@ -564,8 +564,8 @@ function DoNetHelp()
   var statnet = document.getElementById('statnet');
   var statnode = document.getElementById('statnode');
   var statclass = document.getElementById('statclass');
-  var testcntl = document.getElementById('testcntl');
-  var testreport = document.getElementById('testreport');
+  var thcntl = document.getElementById('thcntl');
+  var testhealreport = document.getElementById('testhealreport');
   if (document.NetPost.netops.value == 'scen') {
     ninfo.innerHTML = 'Scene management and execution.';
     ninfo.style.display = 'block';
@@ -576,8 +576,8 @@ function DoNetHelp()
     statnet.style.display = 'none';
     statnode.style.display = 'none';
     statclass.style.display = 'none';
-    testcntl.style.display = 'none';
-    testreport.style.display = 'none';
+    thcntl.style.display = 'none';
+    testhealreport.style.display = 'none';
     SceneLoad('load');
   } else if (document.NetPost.netops.value == 'topo') {
     ninfo.innerHTML = 'Topology views';
@@ -589,8 +589,8 @@ function DoNetHelp()
     statnet.style.display = 'none';
     statnode.style.display = 'none';
     statclass.style.display = 'none';
-    testcntl.style.display = 'none';
-    testreport.style.display = 'none';
+    thcntl.style.display = 'none';
+    testhealreport.style.display = 'none';
     curscene = null;
     TopoLoad('load');
   } else if (document.NetPost.netops.value == 'stat') {
@@ -602,12 +602,12 @@ function DoNetHelp()
     statcntl.style.display = 'block';
     statnet.style.display = 'block';
     statnode.style.display = 'block';
-    testcntl.style.display = 'none';
-    testreport.style.display = 'none';
+    thcntl.style.display = 'none';
+    testhealreport.style.display = 'none';
     curscene = null;
     StatLoad('load');
   } else if (document.NetPost.netops.value == 'test') {
-    ninfo.innerHTML = 'Test Network';
+    ninfo.innerHTML = 'Test & Heal Network';
     ninfo.style.display = 'block';
     scencntl.style.display = 'none';
     topocntl.style.display = 'none';
@@ -616,8 +616,8 @@ function DoNetHelp()
     statnet.style.display = 'none';
     statnode.style.display = 'none';
     statclass.style.display = 'none';
-    testcntl.style.display = 'block';
-    testreport.style.display = 'block';
+    thcntl.style.display = 'block';
+    testhealreport.style.display = 'block';
     curscene = null;
   } else {
     ninfo.style.display = 'none';
@@ -628,8 +628,8 @@ function DoNetHelp()
     statnet.style.display = 'none';
     statnode.style.display = 'none';
     statclass.style.display = 'none';
-    testcntl.style.display = 'none';
-    testreport.style.display = 'none';
+    thcntl.style.display = 'none';
+    testhealreport.style.display = 'none';
     curscene = null;
   }
   return true;
@@ -697,11 +697,8 @@ function DoAdmHelp()
   var acntl = document.getElementById('admcntl');
   acntl.innerHTML = '';
   document.AdmPost.admgo.style.display = 'inline';
-  if (document.AdmPost.adminops.value == 'addc') {
-    ainfo.innerHTML = 'Add a new secondary controller to the Z-Wave network.';
-    ainfo.style.display = 'block';
-  } else if (document.AdmPost.adminops.value == 'addd') {
-    ainfo.innerHTML = 'Add a new device (but not a controller) to the Z-Wave network.';
+  if (document.AdmPost.adminops.value == 'addd') {
+    ainfo.innerHTML = 'Add a new device or controller to the Z-Wave network.';
     ainfo.style.display = 'block';
   } else if (document.AdmPost.adminops.value == 'cprim') {
     ainfo.innerHTML = 'Add a new primary controller in place of dead old controller.';
@@ -709,11 +706,8 @@ function DoAdmHelp()
   } else if (document.AdmPost.adminops.value == 'rconf') {
     ainfo.innerHTML = 'Receive configuration from another controller.';   
     ainfo.style.display = 'block';
-  } else if (document.AdmPost.adminops.value == 'remc') {
-    ainfo.innerHTML = 'Remove a controller from the Z-Wave network.';
-    ainfo.style.display = 'block';
   } else if (document.AdmPost.adminops.value == 'remd') {
-    ainfo.innerHTML = 'Remove a device (but not a controller) from the Z-Wave network.';
+    ainfo.innerHTML = 'Remove a device or controller from the Z-Wave network.';
     ainfo.style.display = 'block';
   } else if (document.AdmPost.adminops.value == 'remfn') {
     ainfo.innerHTML = 'Move a node to the controller\'s list of failed nodes.';
@@ -1371,33 +1365,49 @@ function StatReply()
     }
   }
 }
-function TestLoad(fun)
+function TestHealLoad(fun)
 {
   var params='fun='+fun;
-  var cnt = document.getElementById('testmcnt');
-  if (cnt.value.length == 0) {
-    alert('Missing count value');
-    return false;
+  if (fun == 'test') {
+    var cnt = document.getElementById('testmcnt');
+    if (cnt.value.length == 0) {
+      alert('Missing count value');
+      return false;
+    }
+    params = params+'&num='+cnt.value;
+  } else if (fun == 'heal') {
+    var cnt = document.getElementById('healnode');
+    if (cnt.value.length == 0) {
+      params = params+'&num=0';
+    } else {
+      params = params+'&num='+cnt.value;
+    }
+    var check = document.getElementById('healrrs');
+    if (check.checked)
+      params = params+'&healrrs=1';
   }
-  params = params+'&cnt='+cnt.value;
-  atsthttp.open('POST','testpost.html', true);
-  atsthttp.onreadystatechange = TestReply;
+  atsthttp.open('POST','thpost.html', true);
+  atsthttp.onreadystatechange = TestHealReply;
   atsthttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   atsthttp.send(params);
 
   return false;
 }
-function TestReply()
+function TestHealReply()
 {
   var xml;
   var elem;
 
   if (atsthttp.readyState == 4 && atsthttp.status == 200) {
     xml = atsthttp.responseXML;
+    var threport = document.getElementById('testhealreport');
     elem = xml.getElementsByTagName('test');
     if (elem.length > 0) {
-      var testreport = document.getElementById('testreport');
-      testreport.innerHTML = '';
+      threport.innerHTML = '';
+    }
+    elem = xml.getElementsByTagName('heal');
+    if (elem.length > 0) {
+      threport.innerHTML = '';
     }
   }
 }
diff --git a/ozwcp.cpp b/ozwcp.cpp
index d9e461a..60ed6ac 100644
--- a/ozwcp.cpp
+++ b/ozwcp.cpp
@@ -178,8 +178,8 @@ void MyNode::removeValue (ValueID id)
 	    cclassStr(id.GetCommandClassId()), id.GetInstance(), id.GetIndex(),
 	    valueTypeStr(id.GetType()));
 
-  setChanged(true);
   setTime(time(NULL));
+  setChanged(true);
 }
 
 /*
@@ -472,6 +472,7 @@ void OnNotification (Notification const* _notification, void* _context)
 	       valueGenreStr(id.GetGenre()), cclassStr(id.GetCommandClassId()), id.GetInstance(),
 	       id.GetIndex(), valueTypeStr(id.GetType()));
     pthread_mutex_lock(&nlock);
+    nodes[_notification->GetNodeId()]->setTime(time(NULL));
     nodes[_notification->GetNodeId()]->setChanged(true);
     pthread_mutex_unlock(&nlock);
     break;
@@ -664,6 +665,14 @@ void OnNotification (Notification const* _notification, void* _context)
       noop = true;
       pthread_mutex_unlock(&glock);
       break;
+    case Notification::Code_Awake:
+      Log::Write(LogLevel_Info, "Notification: Notification home %08x node %d Awake",
+		 _notification->GetHomeId(), _notification->GetNodeId());
+      pthread_mutex_lock(&nlock);
+      nodes[_notification->GetNodeId()]->setTime(time(NULL));
+      nodes[_notification->GetNodeId()]->setChanged(true);
+      pthread_mutex_unlock(&nlock);
+      break;
     default:
       Log::Write(LogLevel_Info, "Notification: Notification home %08x node %d Unknown %d",
 		 _notification->GetHomeId(), _notification->GetNodeId(), _notification->GetNotification());
diff --git a/ozwcp.h b/ozwcp.h
index 079570a..10bde73 100644
--- a/ozwcp.h
+++ b/ozwcp.h
@@ -36,6 +36,7 @@
 
 #include <list>
 #include <algorithm>
+#include "Driver.h"
 #include "Notification.h"
 #include "ValueStore.h"
 #include "Value.h"
@@ -55,9 +56,10 @@ extern const char *valueGenreStr(ValueID::ValueGenre);
 extern ValueID::ValueGenre valueGenreNum(char const *);
 extern const char *valueTypeStr(ValueID::ValueType);
 extern ValueID::ValueType valueTypeNum(char const *);
-extern const char *nodeBasicStr (uint8);
+extern const char *nodeBasicStr(uint8);
 extern const char *cclassStr(uint8);
 extern uint8 cclassNum(char const *str);
+extern const char *controllerErrorStr(Driver::ControllerError err);
 
 class MyValue {
   friend class MyNode;
diff --git a/webserver.cpp b/webserver.cpp
index 34ab968..61f9700 100644
--- a/webserver.cpp
+++ b/webserver.cpp
@@ -410,6 +410,7 @@ const char *Webserver::SendStatResponse (struct MHD_Connection *conn, const char
     infoElement->LinkEndChild(newstat("stat", "Bad Routes", data.m_badroutes));
     infoElement->LinkEndChild(newstat("stat", "No ACK", data.m_noack));
     infoElement->LinkEndChild(newstat("stat", "Network Busy", data.m_netbusy));
+    infoElement->LinkEndChild(newstat("stat", "Not Idle", data.m_notidle));
     infoElement->LinkEndChild(newstat("stat", "Non Delivery", data.m_nondelivery));
     infoElement->LinkEndChild(newstat("stat", "Routes Busy", data.m_routedbusy));
     statElement->LinkEndChild(infoElement);
@@ -464,28 +465,42 @@ const char *Webserver::SendStatResponse (struct MHD_Connection *conn, const char
 }
 
 /*
- * SendTestResponse
- * Process network test request
+ * SendTestHealResponse
+ * Process network test and heal requests
  */
 
-const char *Webserver::SendTestResponse (struct MHD_Connection *conn, const char *fun,
-					 const char *arg1, const char *arg2, const char *arg3)
+const char *Webserver::SendTestHealResponse (struct MHD_Connection *conn, const char *fun,
+					     const char *arg1, const char *arg2, const char *arg3)
 {
   TiXmlDocument doc;
   int cnt;
+  bool healrrs = false;
   static char fntemp[32];
   char *fn;
 
   TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "utf-8", "" );
   doc.LinkEndChild(decl);
-  TiXmlElement* testElement = new TiXmlElement("test");
+  TiXmlElement* testElement = new TiXmlElement("testheal");
   doc.LinkEndChild(testElement);
 
-  if (strcmp(fun, "load") == 0 && arg1 != NULL) {
+  if (strcmp(fun, "test") == 0 && arg1 != NULL) {
     cnt = atoi((char *)arg1);
     Manager::Get()->TestNetwork(homeId, cnt);
+  } else if (strcmp(fun, "heal") == 0 && arg1 != NULL) {
+    testElement = new TiXmlElement("heal");
+    cnt = atoi((char *)arg1);
+    if (arg2 != NULL) {
+      int i = atoi((char *)arg2);
+      if (i != 0)
+	healrrs = true;
+    }
+    if (cnt == 0)
+      Manager::Get()->HealNetwork(homeId, healrrs);
+    else
+      Manager::Get()->HealNetworkNode(homeId, cnt, healrrs);
   }
-  strncpy(fntemp, "/tmp/ozwcp.test.XXXXXX", sizeof(fntemp));
+
+  strncpy(fntemp, "/tmp/ozwcp.testheal.XXXXXX", sizeof(fntemp));
   fn = mktemp(fntemp);
   if (fn == NULL)
     return EMPTY;
@@ -749,37 +764,54 @@ int Webserver::SendPollResponse (struct MHD_Connection *conn)
 void web_controller_update (Driver::ControllerState cs, Driver::ControllerError err, void *ct)
 {
   Webserver *cp = (Webserver *)ct;
+  string s;
+  bool more = true;
  
   switch (cs) {
   case Driver::ControllerState_Normal:
-    cp->setAdminMessage(": no command in progress.");
+    s = ": no command in progress.";
+    break;
+  case Driver::ControllerState_Starting:
+    s = ": starting controller command.";
+    break;
+  case Driver::ControllerState_Cancel:
+    s = ": command was cancelled.";
+    more = false;
+    break;
+  case Driver::ControllerState_Error:
+    s = ": command returned an error: ";
+    more = false;
     break;
   case Driver::ControllerState_Waiting:
-    cp->setAdminMessage(": waiting for a user action.");
+    s = ": waiting for a user action.";
     break;
   case Driver::ControllerState_InProgress:
-    cp->setAdminMessage(": communicating with the other device.");
+    s = ": communicating with the other device.";
     break;
   case Driver::ControllerState_Completed:
-    cp->setAdminMessage(": command has completed successfully.");
-    cp->setAdminState(false);
+    s = ": command has completed successfully.";
+    more = false;
     break;
   case Driver::ControllerState_Failed:
-    cp->setAdminMessage(": command has failed.");
-    cp->setAdminState(false);
+    s = ": command has failed.";
+    more = false;
     break;
   case Driver::ControllerState_NodeOK:
-    cp->setAdminMessage(": the node is OK.");
-    cp->setAdminState(false);
+    s = ": the node is OK.";
+    more = false;
     break;
   case Driver::ControllerState_NodeFailed:
-    cp->setAdminMessage(": the node has failed.");
-    cp->setAdminState(false);
+    s = ": the node has failed.";
+    more = false;
     break;
   default:
-    cp->setAdminMessage(": unknown respose.");
+    s = ": unknown respose.";
     break;
   }
+  if (err != Driver::ControllerError_None)
+    s  = s + controllerErrorStr(err);
+  cp->setAdminMessage(s);
+  cp->setAdminState(more);
 }
 
 /*
@@ -859,11 +891,13 @@ int web_config_post (void *cls, enum MHD_ValueKind kind, const char *key, const
   } else if (strcmp(cp->conn_url, "/statpost.html") == 0) {
     if (strcmp(key, "fun") == 0)
       cp->conn_arg1 = (void *)strdup(data);
-  } else if (strcmp(cp->conn_url, "/testpost.html") == 0) {
+  } else if (strcmp(cp->conn_url, "/thpost.html") == 0) {
     if (strcmp(key, "fun") == 0)
       cp->conn_arg1 = (void *)strdup(data);
-    if (strcmp(key, "cnt") == 0)
+    if (strcmp(key, "num") == 0)
       cp->conn_arg2 = (void *)strdup(data);
+    if (strcmp(key, "healrrs") == 0)
+      cp->conn_arg3 = (void *)strdup(data);
   } else if (strcmp(cp->conn_url, "/confparmpost.html") == 0) {
     if (strcmp(key, "fun") == 0)
       cp->conn_arg1 = (void *)strdup(data);
@@ -1046,12 +1080,12 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
       } else
 	ret = web_send_file(conn, (char *)cp->conn_res, MHD_HTTP_OK, true);
 	return MHD_YES;
-    } else if (strcmp(url, "/testpost.html") == 0) {
+    } else if (strcmp(url, "/thpost.html") == 0) {
       if (*up_data_size != 0) {
 	MHD_post_process(cp->conn_pp, up_data, *up_data_size);
 	*up_data_size = 0;
 
-	cp->conn_res = (void *)SendTestResponse(conn, (char *)cp->conn_arg1, (char *)cp->conn_arg2, (char *)cp->conn_arg3, (char *)cp->conn_arg4);
+	cp->conn_res = (void *)SendTestHealResponse(conn, (char *)cp->conn_arg1, (char *)cp->conn_arg2, (char *)cp->conn_arg3, (char *)cp->conn_arg4);
 	return MHD_YES;
       } else
 	ret = web_send_file(conn, (char *)cp->conn_res, MHD_HTTP_OK, true);
@@ -1074,12 +1108,6 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
 	if (strcmp((char *)cp->conn_arg1, "cancel") == 0) { /* cancel controller function */
 	  Manager::Get()->CancelControllerCommand(homeId);
 	  setAdminState(false);
-	} else if (strcmp((char *)cp->conn_arg1, "addc") == 0) {
-	  setAdminFunction("Add Controller");
-	  setAdminState(
-			Manager::Get()->BeginControllerCommand(homeId,
-							       Driver::ControllerCommand_AddController,
-							       web_controller_update, this, true));
 	} else if (strcmp((char *)cp->conn_arg1, "addd") == 0) {
 	  setAdminFunction("Add Device");
 	  setAdminState(
@@ -1098,12 +1126,6 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
 			Manager::Get()->BeginControllerCommand(homeId,
 							       Driver::ControllerCommand_ReceiveConfiguration,
 							       web_controller_update, this, true));
-	} else if (strcmp((char *)cp->conn_arg1, "remc") == 0) {
-	  setAdminFunction("Remove Controller");
-	  setAdminState(
-			Manager::Get()->BeginControllerCommand(homeId,
-							       Driver::ControllerCommand_RemoveController,
-							       web_controller_update, this, true));
 	} else if (strcmp((char *)cp->conn_arg1, "remd") == 0) {
 	  setAdminFunction("Remove Device");
 	  setAdminState(
@@ -1233,7 +1255,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 && strlen((char *)cp->conn_arg3) > 0 && cp->conn_arg4 != NULL) {
+	    cp->conn_arg3 != NULL && strlen((char *)cp->conn_arg3) > 0) {
 	  node = strtol(((char *)cp->conn_arg2) + 4, NULL, 10);
 	  grp = strtol((char *)cp->conn_arg3, NULL, 10);
 	  if (strcmp((char *)cp->conn_arg1, "group") == 0) { /* Group update */
diff --git a/webserver.h b/webserver.h
index ed45df9..ba13798 100644
--- a/webserver.h
+++ b/webserver.h
@@ -61,7 +61,7 @@ private:
   const char *SendSceneResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
   const char *SendTopoResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
   const char *SendStatResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
-  const char *SendTestResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
+  const char *SendTestHealResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
 
   static bool usb;
   static char *devname;
diff --git a/zwavelib.cpp b/zwavelib.cpp
index 3720d0d..8798ece 100644
--- a/zwavelib.cpp
+++ b/zwavelib.cpp
@@ -471,3 +471,35 @@ uint8 cclassNum (char const *str)
   else
     return 0xFF;
 }
+
+const char *controllerErrorStr (Driver::ControllerError err)
+{
+  switch (err) {
+  case Driver::ControllerError_None:
+    return "None";
+  case Driver::ControllerError_ButtonNotFound:
+    return "Button Not Found";
+  case Driver::ControllerError_NodeNotFound:
+    return "Node Not Found";
+  case Driver::ControllerError_NotBridge:
+    return "Not a Bridge";
+  case Driver::ControllerError_NotPrimary:
+    return "Not Primary Controller";
+  case Driver::ControllerError_NotSUC:
+    return "Not Static Update Controller";
+  case Driver::ControllerError_NotSecondary:
+    return "Not Secondary Controller";
+  case Driver::ControllerError_NotFound:
+    return "Not Found";
+  case Driver::ControllerError_Busy:
+    return "Controller Busy";
+  case Driver::ControllerError_Failed:
+    return "Failed";
+  case Driver::ControllerError_Disabled:
+    return "Disabled";
+  case Driver::ControllerError_Overflow:
+    return "Overflow";
+  default:
+    return "Unknown error";
+  }
+}

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