Update to current Sming master
parent
01a2857990
commit
281c071ba5
|
@ -33,7 +33,7 @@ public:
|
||||||
return 400;
|
return 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onConnected();
|
virtual void onConnected();
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T> class ValueEndpoint : public Endpoint {
|
template <class T> class ValueEndpoint : public Endpoint {
|
||||||
|
|
|
@ -18,14 +18,10 @@
|
||||||
|
|
||||||
class SpejsNode {
|
class SpejsNode {
|
||||||
protected:
|
protected:
|
||||||
MqttClient mqtt;
|
|
||||||
HttpServer http;
|
|
||||||
|
|
||||||
Timer keepaliveTimer;
|
Timer keepaliveTimer;
|
||||||
|
|
||||||
HashMap<String, Endpoint*> endpoints;
|
HashMap<String, Endpoint*> endpoints;
|
||||||
|
|
||||||
void onConnected();
|
|
||||||
void keepAliveHandler();
|
void keepAliveHandler();
|
||||||
void initializeMDNS();
|
void initializeMDNS();
|
||||||
|
|
||||||
|
@ -37,6 +33,9 @@ protected:
|
||||||
void httpIndex(HttpRequest &request, HttpResponse &response);
|
void httpIndex(HttpRequest &request, HttpResponse &response);
|
||||||
void httpMetadata(HttpRequest &request, HttpResponse &response);
|
void httpMetadata(HttpRequest &request, HttpResponse &response);
|
||||||
public:
|
public:
|
||||||
|
MqttClient mqtt;
|
||||||
|
HttpServer http;
|
||||||
|
|
||||||
String deviceID;
|
String deviceID;
|
||||||
String deviceType;
|
String deviceType;
|
||||||
|
|
||||||
|
@ -46,6 +45,8 @@ public:
|
||||||
mqtt(MQTT_BROKER, MQTT_PORT, MqttStringSubscriptionCallback(&SpejsNode::mqttCallback, this)),
|
mqtt(MQTT_BROKER, MQTT_PORT, MqttStringSubscriptionCallback(&SpejsNode::mqttCallback, this)),
|
||||||
deviceType(_deviceType) {};
|
deviceType(_deviceType) {};
|
||||||
|
|
||||||
|
void onConnected();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
bool notify(String key, String value);
|
bool notify(String key, String value);
|
||||||
|
|
|
@ -20,10 +20,3 @@ void DHTEndpoint::sample() {
|
||||||
Serial.print(sensor.getLastError());
|
Serial.print(sensor.getLastError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_ENDPOINT(
|
|
||||||
kolejnypapiez,
|
|
||||||
*[]() {
|
|
||||||
return (Endpoint*) new DHTEndpoint(5);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ void ImplementationEndpoint::startOTA() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
otaUpdater->setCallback(otaUpdateDelegate(&ImplementationEndpoint::otaUpdateCallback, this));
|
otaUpdater->setCallback(OtaUpdateDelegate(&ImplementationEndpoint::otaUpdateCallback, this));
|
||||||
otaUpdater->start();
|
otaUpdater->start();
|
||||||
|
|
||||||
notify("ota", "started");
|
notify("ota", "started");
|
||||||
|
|
|
@ -13,10 +13,3 @@ EndpointResult OutputEndpoint::onValue(String property, String value) {
|
||||||
notify("on", currentValue ? "true" : "false");
|
notify("on", currentValue ? "true" : "false");
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_ENDPOINT(
|
|
||||||
papiezpedofilxD,
|
|
||||||
*[]() {
|
|
||||||
return (Endpoint*) new OutputEndpoint(5);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
MODULES = app ../spejsiot
|
MODULES = app ../spejsiot ../spejsiot/endpoints
|
||||||
DISABLE_SPIFFS = 1
|
DISABLE_SPIFFS = 1
|
||||||
USER_CFLAGS = -I../common
|
USER_CFLAGS = -I../common
|
||||||
#ENABLE_SSL = 1
|
#ENABLE_SSL = 1
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <SpejsNode.h>
|
#include <SpejsNode.h>
|
||||||
|
#include <endpoints/OutputEndpoint.h>
|
||||||
|
|
||||||
SpejsNode node("switch");
|
SpejsNode node("switch");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue