forked from Akcelerometry_drgania_WMT/PI_mikrokontroler
Wgranie zmian do repozytorium
This commit is contained in:
66
releases/v1.4.2/include/Network.h
Normal file
66
releases/v1.4.2/include/Network.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
#include "esp_log.h"
|
||||
#include <Arduino.h>
|
||||
#include <Config.h>
|
||||
|
||||
#ifdef ESP32
|
||||
#include <WiFi.h>
|
||||
#include <WebServer.h>
|
||||
#include <ESPmDNS.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
//#include <Pinout.h>
|
||||
//#include <IPAddress.h>
|
||||
//#include <WiFiUdp.h>
|
||||
|
||||
//#include <WiFiClientSecureBearSSL.h>
|
||||
|
||||
// OTA
|
||||
#include <HTTPUpdate.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <functional>
|
||||
// OTA
|
||||
|
||||
class WiFiManager {
|
||||
public:
|
||||
WiFiManager();
|
||||
void begin();
|
||||
void connectToWiFi();
|
||||
void setupAccessPoint(const char *newSSID, const char *newPassword);
|
||||
void checkWiFiConnection();
|
||||
void updateLED();
|
||||
void setupMDNS();
|
||||
void ReadConnection();
|
||||
bool isConnected(); // Zwraca stan połączenia
|
||||
bool convertCharToIPAddress(const char *str, IPAddress& ip);
|
||||
void ledBlink(); // Z innego projektu - niepotrzebne, bo nie ma LED WiFi...
|
||||
bool isWiFiOK(); // True, gdy WiFi połączone i false, gdy brak połączenia
|
||||
int rssiToPercent(int rssi); // rssi na procenty
|
||||
int8_t getRSSI();
|
||||
|
||||
/**
|
||||
* Aktualizacja systemu przez internet z adresu config.updateUrl.
|
||||
* @param allowInsecureTLS true => dla https wyłącz weryfikację certyfikatu.
|
||||
* @param progressCb callback progress (opcjonalnie) (bytes, total).
|
||||
* @return true, jeśli update zakończony sukcesem (urządzenie się zrestartuje).
|
||||
*/
|
||||
bool performOTAUpdate(bool allowInsecureTLS = true, std::function<void(int,int)> progressCb = nullptr);
|
||||
|
||||
int8_t rssi = 0;
|
||||
bool useDHCP = true;
|
||||
IPAddress local_IP;
|
||||
IPAddress gateway;
|
||||
IPAddress subnet;
|
||||
IPAddress dns;
|
||||
String ssidAP = "ACCEL666";
|
||||
String passwordAP = "12345678";
|
||||
|
||||
private:
|
||||
bool isAccessPoint = false;
|
||||
};
|
||||
|
||||
#endif // WIFIMANAGER_H
|
||||
Reference in New Issue
Block a user