Skip to content

Commit 8a76b20

Browse files
committed
...move things back, still expose as WiFi method
1 parent 955c19a commit 8a76b20

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiAP-DhcpServer.cpp renamed to cores/esp8266/LwipDhcpServer-NonOS.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#include "ESP8266WiFi.h"
20-
#include "ESP8266WiFiAP.h"
19+
#include "LwipDhcpServer-NonOS.h"
2120

2221
#include <lwip/init.h>
2322
#include <lwip/netif.h>
@@ -26,18 +25,13 @@
2625
// (since the netif object never goes away, even when AP is disabled)
2726
// Initial version fully emulates nonos-sdk api in DhcpServer class,
2827
// before trying to further change it and possibly break legacy behaviour
29-
static DhcpServer& getNonOSDhcpServer()
28+
DhcpServer& getNonOSDhcpServer()
3029
{
3130
extern netif netif_git[2];
3231
static DhcpServer server(&netif_git[SOFTAP_IF]);
3332
return server;
3433
}
3534

36-
DhcpServer& ESP8266WiFiAPClass::softAPDhcpServer()
37-
{
38-
return getNonOSDhcpServer();
39-
}
40-
4135
extern "C"
4236
{
4337
// `ip_info` is useless, since we get the information from the netif directly
@@ -98,5 +92,3 @@ extern "C"
9892
}
9993

10094
} // extern "C"
101-
102-

cores/esp8266/LwipDhcpServer-NonOS.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
NonOS DHCP server helpers
3+
4+
Copyright (c) 2020-2022 esp8266 arduino. All rights reserved.
5+
This file is part of the esp8266 core for Arduino environment.
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#pragma once
20+
21+
#include "LwipDhcpServer.h"
22+
23+
// Global static DHCP instance for softAP interface
24+
DhcpServer& getNonOSDhcpServer();

libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,11 @@ String ESP8266WiFiAPClass::softAPPSK() const {
391391

392392
return psk;
393393
}
394+
395+
/**
396+
* Get the static DHCP server instance attached to the softAP interface
397+
* @return DhcpServer instance.
398+
*/
399+
DhcpServer& ESP8266WiFiAPClass::softAPDhcpServer() {
400+
return getNonOSDhcpServer();
401+
}

0 commit comments

Comments
 (0)