diff --git a/examples/EnigmaIOT-Button-Controller/ButtonController.h b/examples/EnigmaIOT-Button-Controller/ButtonController.h index 4e69300c..88aa07e2 100644 --- a/examples/EnigmaIOT-Button-Controller/ButtonController.h +++ b/examples/EnigmaIOT-Button-Controller/ButtonController.h @@ -42,7 +42,6 @@ class CONTROLLER_CLASS_NAME : EnigmaIOTjsonController { /** * @brief Called when wifi manager starts config portal - * @param node Pointer to EnigmaIOT gateway instance */ void configManagerStart (); diff --git a/examples/EnigmaIOT-Json-Controller-Template/BasicController.cpp b/examples/EnigmaIOT-Json-Controller-Template/BasicController.cpp index 682cf1d1..57c4a840 100644 --- a/examples/EnigmaIOT-Json-Controller-Template/BasicController.cpp +++ b/examples/EnigmaIOT-Json-Controller-Template/BasicController.cpp @@ -32,7 +32,8 @@ void CONTROLLER_CLASS_NAME::setup (EnigmaIOTNodeClass* node, void* data) { // You do node setup here. Use it as it was the normal setup() Arduino function - + // Send a 'hello' message when initalizing is finished + sendStartAnouncement (); // Disable this if node is sleepy DEBUG_DBG ("Finish begin"); // If your node should sleep after sending data do all remaining tasks here diff --git a/examples/EnigmaIOT-Json-Controller-Template/BasicController.h b/examples/EnigmaIOT-Json-Controller-Template/BasicController.h index 8660fd13..c3b66666 100644 --- a/examples/EnigmaIOT-Json-Controller-Template/BasicController.h +++ b/examples/EnigmaIOT-Json-Controller-Template/BasicController.h @@ -30,17 +30,32 @@ class CONTROLLER_CLASS_NAME : EnigmaIOTjsonController { // -------------------------------------------------- public: + /** + * @brief Initializes controller structures + * @param node Pointer to EnigmaIOT gateway instance + * @param data Parameter data for controller + */ void setup (EnigmaIOTNodeClass* node, void* data = NULL); + /** + * @brief Processes received GET or SET commands + * @param address Origin MAC address + * @param buffer Command payload + * @param length Payload length in bytes + * @param command Command type. nodeMessageType_t::DOWNSTREAM_DATA_GET or nodeMessageType_t::DOWNSTREAM_DATA_SET + * @param payloadEncoding Payload encoding. MSG_PACK is recommended + */ bool processRxCommand (const uint8_t* address, const uint8_t* buffer, uint8_t length, nodeMessageType_t command, nodePayloadEncoding_t payloadEncoding); + /** + * @brief Executes repetitive tasks on controller + */ void loop (); ~CONTROLLER_CLASS_NAME (); /** * @brief Called when wifi manager starts config portal - * @param node Pointer to EnigmaIOT gateway instance */ void configManagerStart (); @@ -56,7 +71,10 @@ class CONTROLLER_CLASS_NAME : EnigmaIOTjsonController { */ bool loadConfig (); - void connectInform () { + /** + * @brief Executed as soon as node is registered on EnigmaIOT network + */ + void connectInform () { sendStartAnouncement (); } @@ -67,8 +85,16 @@ class CONTROLLER_CLASS_NAME : EnigmaIOTjsonController { */ bool saveConfig (); + /** + * @brief Send response to commands to gateway + * @param command Refered command + * @param result `true` if command was correctly executed, `false` otherwise + */ bool sendCommandResp (const char* command, bool result); + /** + * @brief Sends a notification message including configurable controller name and protocol version + */ bool sendStartAnouncement () { // You can send a 'hello' message when your node starts. Useful to detect unexpected reboot const size_t capacity = JSON_OBJECT_SIZE (10); diff --git a/examples/EnigmaIOT-Sensor-Controller/ds18b20Controller.cpp b/examples/EnigmaIOT-Sensor-Controller/ds18b20Controller.cpp index fff3cee3..b03a734b 100644 --- a/examples/EnigmaIOT-Sensor-Controller/ds18b20Controller.cpp +++ b/examples/EnigmaIOT-Sensor-Controller/ds18b20Controller.cpp @@ -62,6 +62,9 @@ void CONTROLLER_CLASS_NAME::setup (EnigmaIOTNodeClass* node, void* data) { sendTemperature (tempC); + // Send a 'hello' message when initalizing is finished + //sendStartAnouncement (); + DEBUG_DBG ("Finish begin"); // If your node should sleep after sending data do all remaining tasks here