[Debian-iot-packaging] [openzwave-controlpanel] 18/81: sort valueids in display list. Print out floating value's precision.
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 2dbbb7c6517fa67ae0a9ac82619c5162a1718406
Author: glsatz at gmail.com <glsatz at gmail.com>
Date: Mon Oct 24 03:55:24 2011 +0000
sort valueids in display list. Print out floating value's precision.
---
ozwcp.cpp | 21 +++++++++++++++++++++
ozwcp.h | 1 +
webserver.cpp | 5 +++++
3 files changed, 27 insertions(+)
diff --git a/ozwcp.cpp b/ozwcp.cpp
index 9bfdce8..5698b4c 100644
--- a/ozwcp.cpp
+++ b/ozwcp.cpp
@@ -126,6 +126,24 @@ void MyNode::remove (int32 const ind)
}
/*
+ * compareValue
+ * Function to compare values in the vector for sorting.
+ */
+bool compareValue (MyValue *a, MyValue *b)
+{
+ return (a->getId() < b->getId());
+}
+
+/*
+ * MyNode::sortValues
+ * Sort the ValueIDs
+ */
+void MyNode::sortValues ()
+{
+ sort(values.begin(), values.end(), compareValue);
+ setChanged(true);
+}
+/*
* MyNode::addValue
* Per notifications, add a value to a node.
*/
@@ -571,6 +589,9 @@ void OnNotification (Notification const* _notification, void* _context)
break;
case Notification::Type_NodeQueriesComplete:
Log::Write("Notification: Node %d Queries Complete", _notification->GetNodeId());
+ pthread_mutex_lock(&nlock);
+ nodes[_notification->GetNodeId()]->sortValues();
+ pthread_mutex_unlock(&nlock);
break;
case Notification::Type_EssentialNodeQueriesComplete:
Log::Write("Notification: Essential Node %d Queries Complete", _notification->GetNodeId());
diff --git a/ozwcp.h b/ozwcp.h
index f785923..5e7930d 100644
--- a/ozwcp.h
+++ b/ozwcp.h
@@ -81,6 +81,7 @@ public:
MyNode(int32 const);
static void remove(int32 const);
static int32 getNodeCount() { return nodecount; };
+ void sortValues();
void addValue(ValueID id);
void removeValue(ValueID id);
void saveValue(ValueID id);
diff --git a/webserver.cpp b/webserver.cpp
index 602ae83..e3a3e01 100644
--- a/webserver.cpp
+++ b/webserver.cpp
@@ -258,6 +258,11 @@ void Webserver::web_get_values (int i, TiXmlElement *ep)
textElement = new TiXmlText(str.c_str());
else
textElement = new TiXmlText("");
+ if (id.GetType() == ValueID::ValueType_Decimal) {
+ uint8 precision;
+ if (Manager::Get()->GetValueFloatPrecision(id, &precision))
+ fprintf(stderr, "node = %d id = %d value = %s precision = %d\n", i, j, str.c_str(), precision);
+ }
valueElement->LinkEndChild(textElement);
}
--
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