File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,48 @@ IPAddress WiFiSTAClass::dnsIP(uint8_t dns_no)
492
492
return IPAddress (dns_ip.u_addr .ip4 .addr );
493
493
}
494
494
495
+ /* *
496
+ * Get the broadcast ip address.
497
+ * @return IPAddress broadcastIP
498
+ */
499
+ IPAddress WiFiSTAClass::broadcastIP ()
500
+ {
501
+ if (WiFiGenericClass::getMode () == WIFI_MODE_NULL){
502
+ return IPAddress ();
503
+ }
504
+ tcpip_adapter_ip_info_t ip;
505
+ tcpip_adapter_get_ip_info (TCPIP_ADAPTER_IF_STA, &ip);
506
+ return WiFiGenericClass::calculateBroadcast (IPAddress (ip.gw .addr ), IPAddress (ip.netmask .addr ));
507
+ }
508
+
509
+ /* *
510
+ * Get the network id.
511
+ * @return IPAddress netwrokID
512
+ */
513
+ IPAddress WiFiSTAClass::netwrokID ()
514
+ {
515
+ if (WiFiGenericClass::getMode () == WIFI_MODE_NULL){
516
+ return IPAddress ();
517
+ }
518
+ tcpip_adapter_ip_info_t ip;
519
+ tcpip_adapter_get_ip_info (TCPIP_ADAPTER_IF_STA, &ip);
520
+ return WiFiGenericClass::calculateNetworkID (IPAddress (ip.gw .addr ), IPAddress (ip.netmask .addr ));
521
+ }
522
+
523
+ /* *
524
+ * Get the network id.
525
+ * @return uint8_t netwrokID
526
+ */
527
+ uint8_t WiFiSTAClass::subnetCIDR ()
528
+ {
529
+ if (WiFiGenericClass::getMode () == WIFI_MODE_NULL){
530
+ return (uint8_t )0 ;
531
+ }
532
+ tcpip_adapter_ip_info_t ip;
533
+ tcpip_adapter_get_ip_info (TCPIP_ADAPTER_IF_STA, &ip);
534
+ return WiFiGenericClass::calculateSubnetCIDR (IPAddress (ip.netmask .addr ));
535
+ }
536
+
495
537
/* *
496
538
* Return the current SSID associated with the network
497
539
* @return SSID
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ class WiFiSTAClass
64
64
IPAddress subnetMask ();
65
65
IPAddress gatewayIP ();
66
66
IPAddress dnsIP (uint8_t dns_no = 0 );
67
+
68
+ IPAddress broadcastIP ();
69
+ IPAddress netwrokID ();
70
+ uint8_t subnetCIDR ();
67
71
68
72
bool enableIpV6 ();
69
73
IPv6Address localIPv6 ();
You can’t perform that action at this time.
0 commit comments