Resolve "OTA"

This commit is contained in:
Patrick Balsiger
2018-08-03 11:01:42 +00:00
parent 18ccf6a892
commit dbb4ce9de7
18 changed files with 895 additions and 17 deletions

View File

@@ -1,6 +1,12 @@
#ifndef __MESHNET_H__
#define __MESHNET_H__
#ifdef ESP32
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif // ESP32
#include <painlessMesh.h>
#include <WiFiClient.h>
#include "Network.h"
@@ -8,6 +14,7 @@
using namespace std;
using namespace std::placeholders;
// FIXME non-mesh config should have it's own struct
struct MeshConfig {
int stationMode;
int channel;
@@ -27,14 +34,18 @@ class MeshNet : public Network {
MeshNet(MeshConfig cfg);
Network* init();
void update(); // only needed when no scheduler was passed to mesh.init
Network* connectStation();
void update();
void newConnectionCallback(uint32_t nodeId);
void changedConnectionCallback();
void nodeTimeAdjustedCallback(int32_t offset);
void broadcast(String msg);
void sendTo(uint32_t target, String msg);
void onReceive(std::function<void(uint32_t from, String &msg)>);
int isConnected(){
return WiFi.status() == WL_CONNECTED;
}
};
#endif