Commit 33eab368 authored by user2684's avatar user2684
Browse files

Possibility to set sensor name #59

parent 940914cc
...@@ -123,6 +123,9 @@ void Sensor::setType(int value) { ...@@ -123,6 +123,9 @@ void Sensor::setType(int value) {
int Sensor::getType() { int Sensor::getType() {
return _type; return _type;
} }
void Sensor::setDescription(char* value) {
_description = value;
}
void Sensor::setRetries(int value) { void Sensor::setRetries(int value) {
_retries = value; _retries = value;
} }
...@@ -170,7 +173,7 @@ void Sensor::presentation() { ...@@ -170,7 +173,7 @@ void Sensor::presentation() {
Serial.print(F(" T=")); Serial.print(F(" T="));
Serial.println(_presentation); Serial.println(_presentation);
#endif #endif
present(_child_id, _presentation); present(_child_id, _presentation,_description);
} }
// call the sensor-specific implementation of before // call the sensor-specific implementation of before
......
...@@ -276,6 +276,8 @@ class Sensor { ...@@ -276,6 +276,8 @@ class Sensor {
// type of this sensor (default: V_CUSTOM) // type of this sensor (default: V_CUSTOM)
void setType(int value); void setType(int value);
int getType(); int getType();
// description of the sensor (default: '')
void setDescription(char *value);
// when queried, send the message multiple times (default: 1) // when queried, send the message multiple times (default: 1)
void setRetries(int value); void setRetries(int value);
// For some sensors, the measurement can be queried multiple times and an average is returned (default: 1) // For some sensors, the measurement can be queried multiple times and an average is returned (default: 1)
...@@ -320,6 +322,7 @@ class Sensor { ...@@ -320,6 +322,7 @@ class Sensor {
int _child_id; int _child_id;
int _presentation = S_CUSTOM; int _presentation = S_CUSTOM;
int _type = V_CUSTOM; int _type = V_CUSTOM;
char* _description = "";
int _retries = 1; int _retries = 1;
int _samples = 1; int _samples = 1;
int _samples_interval = 0; int _samples_interval = 0;
......
...@@ -258,6 +258,8 @@ The following methods are available for all the sensors: ...@@ -258,6 +258,8 @@ The following methods are available for all the sensors:
void setPresentation(int value); void setPresentation(int value);
// type of this sensor (default: V_CUSTOM) // type of this sensor (default: V_CUSTOM)
void setType(int value); void setType(int value);
// description of the sensor (default: '')
void setDescription(char *value);
// when queried, send the message multiple times (default: 1) // when queried, send the message multiple times (default: 1)
void setRetries(int value); void setRetries(int value);
// For some sensors, the measurement can be queried multiple times and an average is returned (default: 1) // For some sensors, the measurement can be queried multiple times and an average is returned (default: 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment