From 33eab368fa16fe7020c9eeaf92bf6d5bc857bd51 Mon Sep 17 00:00:00 2001 From: user2684 <you@example.com> Date: Wed, 12 Apr 2017 17:36:33 +0200 Subject: [PATCH] Possibility to set sensor name #59 --- NodeManager.cpp | 5 ++++- NodeManager.h | 3 +++ README.md | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NodeManager.cpp b/NodeManager.cpp index 3a2fe8b..1cc6182 100644 --- a/NodeManager.cpp +++ b/NodeManager.cpp @@ -123,6 +123,9 @@ void Sensor::setType(int value) { int Sensor::getType() { return _type; } +void Sensor::setDescription(char* value) { + _description = value; +} void Sensor::setRetries(int value) { _retries = value; } @@ -170,7 +173,7 @@ void Sensor::presentation() { Serial.print(F(" T=")); Serial.println(_presentation); #endif - present(_child_id, _presentation); + present(_child_id, _presentation,_description); } // call the sensor-specific implementation of before diff --git a/NodeManager.h b/NodeManager.h index 5a60a87..c457c4b 100644 --- a/NodeManager.h +++ b/NodeManager.h @@ -276,6 +276,8 @@ class Sensor { // type of this sensor (default: V_CUSTOM) void setType(int value); int getType(); + // description of the sensor (default: '') + void setDescription(char *value); // when queried, send the message multiple times (default: 1) void setRetries(int value); // For some sensors, the measurement can be queried multiple times and an average is returned (default: 1) @@ -320,6 +322,7 @@ class Sensor { int _child_id; int _presentation = S_CUSTOM; int _type = V_CUSTOM; + char* _description = ""; int _retries = 1; int _samples = 1; int _samples_interval = 0; diff --git a/README.md b/README.md index 9daace7..04dfae1 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,8 @@ The following methods are available for all the sensors: void setPresentation(int value); // type of this sensor (default: V_CUSTOM) void setType(int value); + // description of the sensor (default: '') + void setDescription(char *value); // when queried, send the message multiple times (default: 1) void setRetries(int value); // For some sensors, the measurement can be queried multiple times and an average is returned (default: 1) -- GitLab