Update to current Sming master

master
informatic 2017-06-12 17:40:23 +02:00
parent 01a2857990
commit 281c071ba5
7 changed files with 9 additions and 21 deletions

View File

@ -33,7 +33,7 @@ public:
return 400;
}
void onConnected();
virtual void onConnected();
};
template <class T> class ValueEndpoint : public Endpoint {

View File

@ -18,14 +18,10 @@
class SpejsNode {
protected:
MqttClient mqtt;
HttpServer http;
Timer keepaliveTimer;
HashMap<String, Endpoint*> endpoints;
void onConnected();
void keepAliveHandler();
void initializeMDNS();
@ -37,6 +33,9 @@ protected:
void httpIndex(HttpRequest &request, HttpResponse &response);
void httpMetadata(HttpRequest &request, HttpResponse &response);
public:
MqttClient mqtt;
HttpServer http;
String deviceID;
String deviceType;
@ -46,6 +45,8 @@ public:
mqtt(MQTT_BROKER, MQTT_PORT, MqttStringSubscriptionCallback(&SpejsNode::mqttCallback, this)),
deviceType(_deviceType) {};
void onConnected();
void init();
bool notify(String key, String value);

View File

@ -20,10 +20,3 @@ void DHTEndpoint::sample() {
Serial.print(sensor.getLastError());
}
}
DECLARE_ENDPOINT(
kolejnypapiez,
*[]() {
return (Endpoint*) new DHTEndpoint(5);
}
);

View File

@ -41,7 +41,7 @@ void ImplementationEndpoint::startOTA() {
}
#endif
otaUpdater->setCallback(otaUpdateDelegate(&ImplementationEndpoint::otaUpdateCallback, this));
otaUpdater->setCallback(OtaUpdateDelegate(&ImplementationEndpoint::otaUpdateCallback, this));
otaUpdater->start();
notify("ota", "started");

View File

@ -13,10 +13,3 @@ EndpointResult OutputEndpoint::onValue(String property, String value) {
notify("on", currentValue ? "true" : "false");
return 200;
}
DECLARE_ENDPOINT(
papiezpedofilxD,
*[]() {
return (Endpoint*) new OutputEndpoint(5);
}
);

View File

@ -1,4 +1,4 @@
MODULES = app ../spejsiot
MODULES = app ../spejsiot ../spejsiot/endpoints
DISABLE_SPIFFS = 1
USER_CFLAGS = -I../common
#ENABLE_SSL = 1

View File

@ -1,4 +1,5 @@
#include <SpejsNode.h>
#include <endpoints/OutputEndpoint.h>
SpejsNode node("switch");