remoteVar Callbacks
This commit is contained in:
parent
becdf35a27
commit
57dfa30cf0
2 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <ESPMegaIoT.hpp>
|
||||
#include <map>
|
||||
/**
|
||||
* @brief A class that create a variable that exists on other devices and can be accessed remotely
|
||||
*
|
||||
|
@ -19,6 +20,9 @@ class RemoteVariable
|
|||
void subscribe();
|
||||
void requestValue();
|
||||
char* getValue();
|
||||
uint8_t registerCallback(std::function<void(char*)>);
|
||||
void unregisterCallback(uint8_t handler);
|
||||
|
||||
private:
|
||||
void mqtt_callback(char* topic, char* payload);
|
||||
ESPMegaIoT* iot;
|
||||
|
@ -29,4 +33,6 @@ class RemoteVariable
|
|||
const char* valueRequestTopic;
|
||||
bool useSetValue;
|
||||
const char* setValueTopic;
|
||||
uint8_t valueChangeCallbackCount;
|
||||
std::map<uint8_t,std::function<void(char*)>> valueChangeCallback;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue