Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmag11 committed Dec 13, 2020
1 parent 05a66db commit c89124c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
1 change: 0 additions & 1 deletion examples/EnigmaIOT-Button-Controller/ButtonController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 28 additions & 2 deletions examples/EnigmaIOT-Json-Controller-Template/BasicController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();

Expand All @@ -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 ();
}

Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions examples/EnigmaIOT-Sensor-Controller/ds18b20Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c89124c

Please sign in to comment.