Files
arduino/src/AgWiFiConnector.h

48 lines
942 B
C
Raw Normal View History

#ifdef ESP32
2024-04-03 11:40:46 +07:00
#ifndef _AG_WIFI_CONNECTOR_H_
#define _AG_WIFI_CONNECTOR_H_
#include "AgOledDisplay.h"
2024-04-03 21:26:04 +07:00
#include "AgStateMachine.h"
2024-04-04 10:36:59 +07:00
#include "AirGradient.h"
2024-04-03 21:26:04 +07:00
#include "Main/PrintLog.h"
2024-04-03 11:40:46 +07:00
2024-04-03 21:26:04 +07:00
#include <Arduino.h>
class AgWiFiConnector : public PrintLog {
2024-04-03 11:40:46 +07:00
private:
2024-04-04 10:36:59 +07:00
AirGradient *ag;
2024-04-03 21:26:04 +07:00
AgOledDisplay &disp;
AgStateMachine &sm;
String ssid;
void *wifi = NULL;
2024-04-04 10:36:59 +07:00
bool hasConfig;
uint32_t lastRetry;
2024-04-03 21:26:04 +07:00
bool wifiClientConnected(void);
2024-04-04 10:36:59 +07:00
2024-04-03 11:40:46 +07:00
public:
2024-04-04 10:36:59 +07:00
AgWiFiConnector(AgOledDisplay &disp, Stream &log, AgStateMachine &sm);
2024-04-03 11:40:46 +07:00
~AgWiFiConnector();
2024-04-04 10:36:59 +07:00
void setAirGradient(AirGradient *ag);
bool connect(void);
void disconnect(void);
2024-04-04 10:36:59 +07:00
void handle(void);
2024-04-03 21:26:04 +07:00
void _wifiApCallback(void);
void _wifiSaveConfig(void);
void _wifiSaveParamCallback(void);
bool _wifiConfigPortalActive(void);
void _wifiProcess();
2024-04-04 10:36:59 +07:00
bool isConnected(void);
void reset(void);
int RSSI(void);
String localIpStr(void);
2024-04-03 21:26:04 +07:00
};
2024-04-03 11:40:46 +07:00
#endif /** _AG_WIFI_CONNECTOR_H_ */
#endif