Commit 0772fc5f authored by user2684's avatar user2684
Browse files

Add option to unregister a sensor #52

parent b6401a26
...@@ -1479,6 +1479,12 @@ int NodeManager::registerSensor(Sensor* sensor) { ...@@ -1479,6 +1479,12 @@ int NodeManager::registerSensor(Sensor* sensor) {
return sensor->getChildId(); return sensor->getChildId();
} }
// un-register a sensor to this manager
void NodeManager::unRegisterSensor(int sensor_index) {
// unlink the pointer to this sensor
_sensors[sensor_index] == 0;
}
// return a sensor given its index // return a sensor given its index
Sensor* NodeManager::get(int child_id) { Sensor* NodeManager::get(int child_id) {
// return a pointer to the sensor from the given child_id // return a pointer to the sensor from the given child_id
......
...@@ -750,6 +750,8 @@ class NodeManager { ...@@ -750,6 +750,8 @@ class NodeManager {
int registerSensor(int sensor_type, int pin = -1, int child_id = -1); int registerSensor(int sensor_type, int pin = -1, int child_id = -1);
// register a custom sensor // register a custom sensor
int registerSensor(Sensor* sensor); int registerSensor(Sensor* sensor);
// un-register a sensor
void unRegisterSensor(int sensor_index);
// return a sensor by its index // return a sensor by its index
Sensor* get(int sensor_index); Sensor* get(int sensor_index);
Sensor* getSensor(int sensor_index); Sensor* getSensor(int sensor_index);
......
...@@ -154,6 +154,8 @@ Node Manager comes with a reasonable default configuration. If you want/need to ...@@ -154,6 +154,8 @@ Node Manager comes with a reasonable default configuration. If you want/need to
void setSleepBetweenSend(int value); void setSleepBetweenSend(int value);
// register a built-in sensor // register a built-in sensor
int registerSensor(int sensor_type, int pin = -1, int child_id = -1); int registerSensor(int sensor_type, int pin = -1, int child_id = -1);
// un-register a sensor
void unRegisterSensor(int sensor_index);
// register a custom sensor // register a custom sensor
int registerSensor(Sensor* sensor); int registerSensor(Sensor* sensor);
// return a sensor by its index // return a sensor by its index
...@@ -305,13 +307,13 @@ Each sensor class can expose additional methods. ...@@ -305,13 +307,13 @@ Each sensor class can expose additional methods.
#### SensorThermistor #### SensorThermistor
~~~c ~~~c
// resistance at 25 degrees C (default: 10000) // resistance at 25 degrees C (default: 10000)
void setNominalResistor(int value); void setNominalResistor(long value);
// temperature for nominal resistance (default: 25) // temperature for nominal resistance (default: 25)
void setNominalTemperature(int value); void setNominalTemperature(int value);
// The beta coefficient of the thermistor (default: 3950) // The beta coefficient of the thermistor (default: 3950)
void setBCoefficient(int value); void setBCoefficient(int value);
// the value of the resistor in series with the thermistor (default: 10000) // the value of the resistor in series with the thermistor (default: 10000)
void setSeriesResistor(int value); void setSeriesResistor(long value);
// set a temperature offset // set a temperature offset
void setOffset(float value); void setOffset(float value);
~~~ ~~~
......
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