Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7a37684

Browse files
authored
Soft-AP: get subnet mask (espressif#8358)
In WiFiSTA you can ask for the subnet mask, but not in WiFiAP.Only the CIDR is reported.Therefor the missing method is added to have the same features in softAP as well.
1 parent289c2a1 commit7a37684

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

‎docs/source/api/wifi.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ Get the softAP subnet CIDR.
222222
223223
uint8_t softAPSubnetCIDR();
224224
225+
softAPSubnetMask
226+
****************
227+
228+
Get the softAP subnet mask.
229+
230+
..code-block::arduino
231+
232+
IPAddress softAPSubnetMask();
233+
225234
softAPenableIpV6
226235
****************
227236

‎libraries/WiFi/src/WiFiAP.cpp‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,20 +304,29 @@ IPAddress WiFiAPClass::softAPNetworkID()
304304
}
305305

306306
/**
307-
* Get the softAP subnetCIDR.
308-
* @returnuint8_t softAP subnetCIDR
307+
* Get the softAP subnetmask.
308+
* @returnIPAddress subnetMask
309309
*/
310-
uint8_tWiFiAPClass::softAPSubnetCIDR()
310+
IPAddressWiFiAPClass::softAPSubnetMask()
311311
{
312-
esp_netif_ip_info_t ip;
312+
esp_netif_ip_info_t ip;
313313
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
314314
returnIPAddress();
315315
}
316316
if(esp_netif_get_ip_info(get_esp_interface_netif(ESP_IF_WIFI_AP), &ip) != ESP_OK){
317-
log_e("Netif Get IP Failed!");
318-
returnIPAddress();
317+
log_e("Netif Get IP Failed!");
318+
returnIPAddress();
319319
}
320-
returnWiFiGenericClass::calculateSubnetCIDR(IPAddress(ip.netmask.addr));
320+
returnIPAddress(ip.netmask.addr);
321+
}
322+
323+
/**
324+
* Get the softAP subnet CIDR.
325+
* @return uint8_t softAP subnetCIDR
326+
*/
327+
uint8_tWiFiAPClass::softAPSubnetCIDR()
328+
{
329+
returnWiFiGenericClass::calculateSubnetCIDR(softAPSubnetMask());
321330
}
322331

323332
/**

‎libraries/WiFi/src/WiFiAP.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class WiFiAPClass
5151

5252
IPAddresssoftAPBroadcastIP();
5353
IPAddresssoftAPNetworkID();
54+
IPAddresssoftAPSubnetMask();
5455
uint8_tsoftAPSubnetCIDR();
5556

5657
boolsoftAPenableIpV6();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp