|
ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
|
Class prototype for modules. More...
#include <module_handler/include/template_module.hpp>
Public Member Functions | |
| Module (void) | |
| Construct a new Module object. | |
| ~Module (void) | |
| Destroy the Module object. | |
| virtual void | OnReceive (const Esp32Command &cmd)=0 |
| Arduino I2C onRecieve. | |
| virtual size_t | OnRequest (uint8_t *buffer)=0 |
| Arduino I2C onRequest. | |
| int | State (void) |
| Get the current state of the module. | |
| int | Type () |
| Get the message type associated with the module. | |
| void | Reset (void) |
| Resets the module to default state. | |
Protected Attributes | |
| int | state = 0 |
| int | type = 0 |
Class prototype for modules.
Provides a base class for modules to inherit from.
Definition at line 29 of file template_module.hpp.
| ModuleHandler::Module::Module | ( | void | ) |
Construct a new Module object.
Definition at line 3 of file template_module.cpp.
| ModuleHandler::Module::~Module | ( | void | ) |
Destroy the Module object.
Definition at line 5 of file template_module.cpp.
|
pure virtual |
Arduino I2C onRecieve.
| num_bytes | Number of bytes received from controller |
Implemented in ModuleIrrigation, ModuleMicroSD, ModuleHandler::ModulePower, ModuleWiFi, ModuleTest, and ModuleHandler::ModuleUserConfig.
|
pure virtual |
Arduino I2C onRequest.
| buffer | Pointer to store requested data |
Implemented in ModuleIrrigation, ModuleMicroSD, ModuleHandler::ModulePower, ModuleWiFi, ModuleTest, and ModuleHandler::ModuleUserConfig.
| void ModuleHandler::Module::Reset | ( | void | ) |
Resets the module to default state.
The default state is
Definition at line 7 of file template_module.cpp.
References state.
Referenced by ModuleHandler::ModuleHandler::ResetModules(), and setUp().
| int ModuleHandler::Module::State | ( | void | ) |
Get the current state of the module.
Definition at line 9 of file template_module.cpp.
References state.
Referenced by test_Connect(), TestOnReceive(), TestOnRequest(), and TestReset().
| int ModuleHandler::Module::Type | ( | ) |
Get the message type associated with the module.
Full list of message types are available in generated protobuf code under *_tag.
Definition at line 11 of file template_module.cpp.
|
protected |
Integer representing current state
Definition at line 85 of file template_module.hpp.
Referenced by ModuleHandler::ModuleUserConfig::ModuleUserConfig(), ModuleTest::OnReceive(), and ModuleTest::OnRequest().
|
protected |
Integer for message type
Definition at line 88 of file template_module.hpp.
Referenced by ModuleIrrigation::ModuleIrrigation(), ModuleMicroSD::ModuleMicroSD(), ModuleHandler::ModulePower::ModulePower(), ModuleHandler::ModuleUserConfig::ModuleUserConfig(), and ModuleWiFi::ModuleWiFi().