File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -219,17 +219,25 @@ uint8_t* arduino::WiFiClass::macAddress(uint8_t* mac) {
219219 return mac;
220220}
221221
222- arduino::IPAddress arduino::WiFiClass::localIP () {
223- arduino::IPAddress addr;
222+ arduino::IPAddress arduino::WiFiClass::localIP () {
223+ SocketAddress ip;
224+ NetworkInterface *interface = getNetwork ();
225+ interface->get_ip_address (&ip);
226+ return ipAddressFromSocketAddress (ip);
227+ }
224228
229+ arduino::IPAddress arduino::WiFiClass::subnetMask () {
225230 SocketAddress ip;
226- if (softap != NULL ) {
227- softap->get_ip_address (&ip);
228- } else {
229- wifi_if->get_ip_address (&ip);
230- }
231- addr.fromString (ip.get_ip_address ()); // @todo: the IP we get from Mbed is correct, but is parsed incorrectly by Arduino
232- return addr;
231+ NetworkInterface *interface = getNetwork ();
232+ interface->get_netmask (&ip);
233+ return ipAddressFromSocketAddress (ip);
234+ }
235+
236+ arduino::IPAddress arduino::WiFiClass::gatewayIP () {
237+ SocketAddress ip;
238+ NetworkInterface *interface = getNetwork ();
239+ interface->get_gateway (&ip);
240+ return ipAddressFromSocketAddress (ip);
233241}
234242
235243NetworkInterface *arduino::WiFiClass::getNetwork () {
You can’t perform that action at this time.
0 commit comments