Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NodeManager_GasSensor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartHome
NodeManager_GasSensor
Commits
7ad3d6c5
Commit
7ad3d6c5
authored
8 years ago
by
user2684
Browse files
Options
Downloads
Patches
Plain Diff
Add option to retrieve the latest value of a sensor #104
parent
cec50cca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NodeManager.cpp
+12
-0
12 additions, 0 deletions
NodeManager.cpp
NodeManager.h
+5
-0
5 additions, 0 deletions
NodeManager.h
README.md
+12
-0
12 additions, 0 deletions
README.md
with
29 additions
and
0 deletions
NodeManager.cpp
+
12
−
0
View file @
7ad3d6c5
...
@@ -152,6 +152,9 @@ void Sensor::setForceUpdate(int value) {
...
@@ -152,6 +152,9 @@ void Sensor::setForceUpdate(int value) {
void
Sensor
::
setValueType
(
int
value
)
{
void
Sensor
::
setValueType
(
int
value
)
{
_value_type
=
value
;
_value_type
=
value
;
}
}
int
Sensor
::
getValueType
()
{
return
_value_type
;
}
void
Sensor
::
setFloatPrecision
(
int
value
)
{
void
Sensor
::
setFloatPrecision
(
int
value
)
{
_float_precision
=
value
;
_float_precision
=
value
;
}
}
...
@@ -178,6 +181,15 @@ void Sensor::setInterruptPin(int value) {
...
@@ -178,6 +181,15 @@ void Sensor::setInterruptPin(int value) {
int
Sensor
::
getInterruptPin
()
{
int
Sensor
::
getInterruptPin
()
{
return
_interrupt_pin
;
return
_interrupt_pin
;
}
}
int
Sensor
::
getValueInt
()
{
return
_last_value_int
;
}
float
Sensor
::
getValueFloat
()
{
return
_last_value_float
;
}
char
*
Sensor
::
getValueString
()
{
return
_last_value_string
;
}
// present the sensor to the gateway and controller
// present the sensor to the gateway and controller
void
Sensor
::
presentation
()
{
void
Sensor
::
presentation
()
{
...
...
This diff is collapsed.
Click to expand it.
NodeManager.h
+
5
−
0
View file @
7ad3d6c5
...
@@ -345,6 +345,7 @@ class Sensor {
...
@@ -345,6 +345,7 @@ class Sensor {
void
setForceUpdate
(
int
value
);
void
setForceUpdate
(
int
value
);
// the value type of this sensor (default: TYPE_INTEGER)
// the value type of this sensor (default: TYPE_INTEGER)
void
setValueType
(
int
value
);
void
setValueType
(
int
value
);
int
getValueType
();
// for float values, set the float precision (default: 2)
// for float values, set the float precision (default: 2)
void
setFloatPrecision
(
int
value
);
void
setFloatPrecision
(
int
value
);
// optionally sleep interval in milliseconds before sending each message to the radio network (default: 0)
// optionally sleep interval in milliseconds before sending each message to the radio network (default: 0)
...
@@ -362,6 +363,10 @@ class Sensor {
...
@@ -362,6 +363,10 @@ class Sensor {
// manually turn the power off
// manually turn the power off
void
powerOff
();
void
powerOff
();
#endif
#endif
// get the latest recorded value from the sensor
int
getValueInt
();
float
getValueFloat
();
char
*
getValueString
();
// define what to do at each stage of the sketch
// define what to do at each stage of the sketch
virtual
void
before
();
virtual
void
before
();
virtual
void
presentation
();
virtual
void
presentation
();
...
...
This diff is collapsed.
Click to expand it.
README.md
+
12
−
0
View file @
7ad3d6c5
...
@@ -343,12 +343,16 @@ The following methods are available for all the sensors:
...
@@ -343,12 +343,16 @@ The following methods are available for all the sensors:
~~~
c
~~~
c
// where the sensor is attached to (default: not set)
// where the sensor is attached to (default: not set)
void
setPin
(
int
value
);
void
setPin
(
int
value
);
int
getPin
();
// child_id of this sensor (default: not set)
// child_id of this sensor (default: not set)
void
setChildId
(
int
value
);
void
setChildId
(
int
value
);
int
getChildId
();
// presentation of this sensor (default: S_CUSTOM)
// presentation of this sensor (default: S_CUSTOM)
void
setPresentation
(
int
value
);
void
setPresentation
(
int
value
);
int
getPresentation
();
// type of this sensor (default: V_CUSTOM)
// type of this sensor (default: V_CUSTOM)
void
setType
(
int
value
);
void
setType
(
int
value
);
int
getType
();
// description of the sensor (default: '')
// description of the sensor (default: '')
void
setDescription
(
char
*
value
);
void
setDescription
(
char
*
value
);
// set this to true if you want destination node to send ack back to this node (default: false)
// set this to true if you want destination node to send ack back to this node (default: false)
...
@@ -365,10 +369,14 @@ The following methods are available for all the sensors:
...
@@ -365,10 +369,14 @@ The following methods are available for all the sensors:
void
setForceUpdate
(
int
value
);
void
setForceUpdate
(
int
value
);
// the value type of this sensor (default: TYPE_INTEGER)
// the value type of this sensor (default: TYPE_INTEGER)
void
setValueType
(
int
value
);
void
setValueType
(
int
value
);
int
getValueType
();
// for float values, set the float precision (default: 2)
// for float values, set the float precision (default: 2)
void
setFloatPrecision
(
int
value
);
void
setFloatPrecision
(
int
value
);
// optionally sleep interval in milliseconds before sending each message to the radio network (default: 0)
// optionally sleep interval in milliseconds before sending each message to the radio network (default: 0)
void
setSleepBetweenSend
(
int
value
);
void
setSleepBetweenSend
(
int
value
);
// set the interrupt pin the sensor is attached to so its loop() will be executed only upon that interrupt (default: -1)
void
setInterruptPin
(
int
value
);
int
getInterruptPin
();
#if POWER_MANAGER == 1
#if POWER_MANAGER == 1
// to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand
// to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand
void
setPowerPins
(
int
ground_pin
,
int
vcc_pin
,
long
wait
=
0
);
void
setPowerPins
(
int
ground_pin
,
int
vcc_pin
,
long
wait
=
0
);
...
@@ -379,6 +387,10 @@ The following methods are available for all the sensors:
...
@@ -379,6 +387,10 @@ The following methods are available for all the sensors:
// manually turn the power off
// manually turn the power off
void
powerOff
();
void
powerOff
();
#endif
#endif
// get the latest value from the sensor
int
getValueInt
();
float
getValueFloat
();
char
*
getValueString
();
~~~
~~~
### Sensor's specific configuration
### Sensor's specific configuration
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment