@@ -203,21 +203,39 @@ int8_t CWifi::scanNetworks() {
203
203
return (int8_t )access_points.size ();
204
204
}
205
205
206
- /* -------------------------------------------------------------------------- */
206
+ /* -------------------------------------------------------------------------- */
207
207
IPAddress CWifi::localIP () {
208
- /* -------------------------------------------------------------------------- */
209
- return IPAddress (0 ,0 ,0 ,0 );
208
+ /* -------------------------------------------------------------------------- */
209
+ string res = " " ;
210
+ if (modem.write (string (PROMPT (_IPSTA)),res, " %s%d\r\n " , CMD_WRITE (_IPSTA), IP_ADDR)) {
211
+ IPAddress local_IP;
212
+ local_IP.fromString (res.c_str ());
213
+ return local_IP;
214
+ }
215
+ return IPAddress (0 ,0 ,0 ,0 );
210
216
}
211
217
212
218
/* -------------------------------------------------------------------------- */
213
219
IPAddress CWifi::subnetMask () {
214
- /* -------------------------------------------------------------------------- */
215
- return IPAddress (0 ,0 ,0 ,0 );
220
+ /* -------------------------------------------------------------------------- */
221
+ string res = " " ;
222
+ if (modem.write (string (PROMPT (_IPSTA)),res, " %s%d\r\n " , CMD_WRITE (_IPSTA), NETMASK_ADDR)) {
223
+ IPAddress subnetMask;
224
+ subnetMask.fromString (res.c_str ());
225
+ return subnetMask;
226
+ }
227
+ return IPAddress (0 ,0 ,0 ,0 );
216
228
}
217
229
218
230
/* -------------------------------------------------------------------------- */
219
231
IPAddress CWifi::gatewayIP () {
220
- /* -------------------------------------------------------------------------- */
232
+ /* -------------------------------------------------------------------------- */
233
+ string res = " " ;
234
+ if (modem.write (string (PROMPT (_IPSTA)),res, " %s%d\r\n " , CMD_WRITE (_IPSTA), GATEWAY_ADDR)) {
235
+ IPAddress gateway_IP;
236
+ gateway_IP.fromString (res.c_str ());
237
+ return gateway_IP;
238
+ }
221
239
return IPAddress (0 ,0 ,0 ,0 );
222
240
}
223
241
0 commit comments