ESPMegaPRO-v3-SDK/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/RemoteVariable.hpp

25 lines
744 B
C++
Raw Normal View History

2024-01-16 04:22:41 +00:00
#pragma once
#include <ESPMegaIoT.hpp>
class RemoteVariable
{
public:
RemoteVariable();
~RemoteVariable();
void begin(size_t size, char* topic, ESPMegaIoT* iot);
2024-01-16 05:48:06 +00:00
void begin(size_t size, char* topic, ESPMegaIoT* iot, bool useValueRequest, char* valueRequestTopic);
void setValue(char* value);
void enableSetValue(char* setValueTopic);
2024-01-16 04:22:41 +00:00
void subscribe();
2024-01-16 05:48:06 +00:00
void requestValue();
2024-01-16 04:22:41 +00:00
char* getValue();
private:
2024-01-16 05:48:06 +00:00
void mqtt_callback(char* topic, char* payload);
2024-01-16 04:22:41 +00:00
ESPMegaIoT* iot;
char* topic;
char* value;
size_t size;
2024-01-16 05:48:06 +00:00
bool useValueRequest;
char* valueRequestTopic;
bool useSetValue;
char* setValueTopic;
2024-01-16 04:22:41 +00:00
};