Sensor nodes can now report their sketch name and version to the gateway for informational purposes. Added class methods sendSketchName(), sendSketchVersion() and sendSketchInfo() that invokes the aforementioned as a convenience method. Sensor nodes report their sketch information to the gateway by calling sendSketchInfo(const char *name, const char *version) in the Arduino sketch setup() method after initializing the radio by invoking the Sensor::begin() method.

This commit is contained in:
Bruce Lacey
2014-03-07 09:05:25 -08:00
parent 8681e37f48
commit 89e3c4f0ef
4 changed files with 42 additions and 3 deletions
+16 -1
View File
@@ -1,4 +1,4 @@
/*
/*
The Sensor Net Arduino library adds a new layer on top of the RF24 library.
It handles radio network routing, relaying and ids.
@@ -335,6 +335,21 @@ void Sensor::requestStatus(uint8_t nodeId, int8_t childId, uint8_t variableType)
sendData(radioId, nodeId, childId, M_REQ_VARIABLE, variableType, "", 0, false);
}
void Sensor::sendSketchInfo(const char *name, const char *version) {
sendSketchName(name);
sendSketchVersion(version);
}
void Sensor::sendSketchName(const char *name) {
if (name != NULL)
sendInternal(I_SKETCH_NAME, name);
}
void Sensor::sendSketchVersion(const char *version) {
if (version != NULL)
sendInternal(I_SKETCH_VERSION, version);
}
void Sensor::sendBatteryLevel(int value) {
sendInternal(I_BATTERY_LEVEL, ltoa(value, convBuffer, 10));
}