ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
template_module.hpp
Go to the documentation of this file.
1
12#ifndef LIB_MODULE_HANDLER_INCLUDE_TEMPLATE_MODULE_HPP_
13#define LIB_MODULE_HANDLER_INCLUDE_TEMPLATE_MODULE_HPP_
14
15#include <libents/proto/controller.pb.h>
16
17#include <cstddef>
18
19namespace ModuleHandler {
20
29class Module {
30 public:
35 Module(void);
36
41 ~Module(void);
42
48 virtual void OnReceive(const Esp32Command& cmd) = 0;
49
57 virtual size_t OnRequest(uint8_t* buffer) = 0;
58
64 int State(void);
65
74 int Type();
75
81 void Reset(void);
82
83 protected:
85 int state = 0;
86
88 int type = 0;
89};
90} // namespace ModuleHandler
91
96#endif // LIB_MODULE_HANDLER_INCLUDE_TEMPLATE_MODULE_HPP_
Class prototype for modules.
int Type()
Get the message type associated with the module.
~Module(void)
Destroy the Module object.
void Reset(void)
Resets the module to default state.
Module(void)
Construct a new Module object.
int State(void)
Get the current state of the module.
virtual void OnReceive(const Esp32Command &cmd)=0
Arduino I2C onRecieve.
virtual size_t OnRequest(uint8_t *buffer)=0
Arduino I2C onRequest.
uint8_t buffer[32]
Power module for the esp32.