Skip to content

Commit 2f03fa4

Browse files
author
Geoffroy Arenou
committed
Add function to get wifi connected and client connected
1 parent c99b6b8 commit 2f03fa4

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

include/Wifi_Helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace Wifi_Helper
2222
bool IsOTARunning();
2323
void EnableWifi(Enable enable);
2424
bool IsEnable();
25+
bool IsWifiConnected();
26+
bool IsClientConnected();
2527

2628
void Initialisation(void);
2729
void Update(void *pvParameters);

src/Wifi_Helper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ namespace Wifi_Helper
7575

7676
bool IsEnable() { return wifiEnable == Enable::ENABLE_TRUE; }
7777

78+
bool IsWifiConnected() { return WiFi.status() == WL_CONNECTED; }
79+
80+
bool IsClientConnected() { return wifiClient.connected(); }
81+
7882
void Initialisation()
7983
{
8084
wifiEnable = Enable::ENABLE_TRUE;

src/Wifi_No_Helper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ namespace Wifi_Helper
1818

1919
bool IsEnable() { return false; }
2020

21+
bool IsWifiConnected() { return false; }
22+
23+
bool IsClientConnected() { return false; }
24+
2125
void Initialisation()
2226
{
2327
Printer::println("-- NO Wifi initialisation --");

0 commit comments

Comments
 (0)