35 lines
564 B
C++
35 lines
564 B
C++
#ifndef WIFI_CONNECTION_H
|
|
#define WIFI_CONNECTION_H
|
|
|
|
#include <Arduino.h>
|
|
#include <IPAddress.h>
|
|
|
|
struct WifiConnectionInfo
|
|
{
|
|
bool shieldAvailable;
|
|
bool connected;
|
|
IPAddress ipAddress;
|
|
};
|
|
|
|
class WifiConnection
|
|
{
|
|
public:
|
|
WifiConnection();
|
|
void begin(unsigned long now);
|
|
void update(unsigned long now);
|
|
WifiConnectionInfo info() const;
|
|
bool consumeDirty();
|
|
|
|
private:
|
|
void connect(unsigned long now);
|
|
void recordStatus();
|
|
|
|
unsigned long nextAttempt_;
|
|
bool shieldAvailable_;
|
|
bool connected_;
|
|
IPAddress ipAddress_;
|
|
bool dirty_;
|
|
};
|
|
|
|
#endif
|