10 #include "sdkconfig.h"
17 #include "WiFiEventHandler.h"
82 wifi_auth_mode_t m_authMode;
113 static esp_err_t eventHandler(
void* ctx, system_event_t* event);
119 uint8_t m_dnsCount = 0;
120 bool m_eventLoopStarted;
122 uint8_t m_apConnectionStatus;
134 struct in_addr getHostByName(const std::string& hostName);
135 struct in_addr getHostByName(const char* hostName);
136 uint8_t
connectAP(const std::string& ssid, const std::string& password, bool waitForConnection = true, wifi_mode_t mode = WIFI_MODE_STA);
152 std::vector<WiFiAPRecord>
scan();
153 void
startAP(const std::string& ssid, const std::string& passwd, wifi_auth_mode_t auth = WIFI_AUTH_OPEN);
154 void
startAP(const std::string& ssid, const std::string& passwd, wifi_auth_mode_t auth, uint8_t channel, bool ssid_hidden, uint8_t max_connection);
155 void
setIPInfo(const std::string& ip, const std::string& gw, const std::string& netmask);
156 void
setIPInfo(const char* ip, const char* gw, const char* netmask);
157 void
setIPInfo(uint32_t ip, uint32_t gw, uint32_t netmask);
static std::string getApMac()
Get the MAC address of the AP interface.
Definition: WiFi.cpp:285
static std::string getApSSID()
Get the AP SSID.
Definition: WiFi.cpp:299
std::string toString()
Return a string representation of the WiFi access point record.
Definition: WiFi.cpp:732
static tcpip_adapter_ip_info_t getStaIpInfo()
Get the STA IP Info.
Definition: WiFi.cpp:392
static std::string getApNetmask()
Get the current AP netmask.
Definition: WiFi.cpp:322
void setWifiEventHandler(WiFiEventHandler *wifiEventHandler)
Set the event handler to use to process detected events.
Definition: WiFi.cpp:656
void addDNSServer(const std::string &ip)
Add a reference to a DNS server.
Definition: WiFi.cpp:90
static std::string getMode()
Get the WiFi Mode.
Definition: WiFi.cpp:370
static std::string getStaNetmask()
Get the current STA netmask.
Definition: WiFi.cpp:415
void setDNSServer(int numdns, const std::string &ip)
Set a reference to a DNS server.
Definition: WiFi.cpp:128
static std::string getApGateway()
Get the current AP Gateway IP.
Definition: WiFi.cpp:333
static std::string getApIp()
Get the current ESP32 IP form AP.
Definition: WiFi.cpp:311
WiFi driver.
Definition: WiFi.h:111
wifi_auth_mode_t getAuthMode()
Get the auth mode.
Definition: WiFi.h:56
void setIPInfo(const std::string &ip, const std::string &gw, const std::string &netmask)
Set the IP info and enable DHCP if ip != 0. If called with ip == 0 then DHCP is enabled. If called with bad values it will do nothing.
Definition: WiFi.cpp:680
void startAP(const std::string &ssid, const std::string &passwd, wifi_auth_mode_t auth=WIFI_AUTH_OPEN)
Start being an access point.
Definition: WiFi.cpp:587
static std::string getStaSSID()
Get the STA SSID.
Definition: WiFi.cpp:452
int8_t getRSSI()
Get the RSSI.
Definition: WiFi.h:64
static std::string getStaGateway()
Get the current STA Gateway IP.
Definition: WiFi.cpp:427
uint8_t connectAP(const std::string &ssid, const std::string &password, bool waitForConnection=true, wifi_mode_t mode=WIFI_MODE_STA)
Connect to an external access point.
Definition: WiFi.cpp:159
std::vector< WiFiAPRecord > scan()
Perform a WiFi scan looking for access points.
Definition: WiFi.cpp:508
WiFi()
Creates and uses a default event handler.
Definition: WiFi.cpp:49
~WiFi()
Deletes the event handler that was used by the class.
Definition: WiFi.cpp:65
Manage mDNS server.
Definition: WiFi.h:48
static std::string getStaIp()
Get the current ESP32 IP form STA.
Definition: WiFi.cpp:403
static std::string getStaMac()
Get the MAC address of the STA interface.
Definition: WiFi.cpp:439
bool isConnectedToAP()
Returns whether wifi is connected to an access point.
Definition: WiFi.cpp:230
Definition: FreeRTOS.h:31
WiFi state event handler.
Definition: WiFiEventHandler.h:98
static tcpip_adapter_ip_info_t getApIpInfo()
Get the AP IP Info.
Definition: WiFi.cpp:273
std::string getSSID()
Get the SSID.
Definition: WiFi.h:72
void dump()
Dump diagnostics to the log.
Definition: WiFi.cpp:217