@@ -117,7 +117,7 @@ char* _password = NULL;
117
117
/* \brief print_MAC - print_MAC - helper function to print out MAC address
118
118
* in: network_interface - pointer to network i/f
119
119
* bool log-messages print out logs or not
120
- * MAC address is print , if it can be acquired & log_messages is true.
120
+ * MAC address is printed , if it can be acquired & log_messages is true.
121
121
*
122
122
*/
123
123
void print_MAC (NetworkInterface* network_interface, bool log_messages) {
@@ -139,6 +139,7 @@ void print_MAC(NetworkInterface* network_interface, bool log_messages) {
139
139
140
140
/* \brief easy_connect easy_connect() function to connect the pre-defined network bearer,
141
141
* config done via mbed_app.json (see README.md for details).
142
+ *
142
143
* IN: bool log_messages print out diagnostics or not.
143
144
*/
144
145
NetworkInterface* easy_connect (bool log_messages) {
@@ -290,3 +291,55 @@ NetworkInterface* easy_connect(bool log_messages,
290
291
#endif // EASY_CONNECT_WIFI
291
292
return easy_connect (log_messages);
292
293
}
294
+
295
+ /* \brief easy_get_netif - easy_connect function to get pointer to network interface
296
+ * without connecting to it.
297
+ *
298
+ * IN: bool log_messages print out diagnostics or not.
299
+ */
300
+ NetworkInterface* easy_get_netif (bool log_messages) {
301
+ #if defined (EASY_CONNECT_WIFI)
302
+ if (log_messages) {
303
+ printf (" [EasyConnect] WiFi: %s\n " , EASY_CONNECT_WIFI_TYPE);
304
+ }
305
+ return &wifi;
306
+
307
+ #elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET
308
+ if (log_messages) {
309
+ printf (" [EasyConnect] Ethernet\n " );
310
+ }
311
+ return ð
312
+
313
+ #elif defined (EASY_CONNECT_MESH)
314
+ if (log_messages) {
315
+ printf (" [EasyConnect] Mesh : %s\n " , EASY_CONNECT_MESH_TYPE);
316
+ }
317
+ return &mesh;
318
+
319
+ #elif MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR_ONBOARD
320
+ if (log_messages) {
321
+ printf (" [EasyConnect] Cellular\n " );
322
+ }
323
+ return &cellular;
324
+ #endif
325
+ }
326
+
327
+ /* \brief easy_get_wifi - easy_connect function to get pointer to Wifi interface
328
+ * without connecting to it. You would want this 1st so that
329
+ * you can scan the APNs, choose the right one and then connect.
330
+ *
331
+ * IN: bool log_messages print out diagnostics or not.
332
+ */
333
+ WiFiInterface* easy_get_wifi (bool log_messages) {
334
+ #if defined (EASY_CONNECT_WIFI)
335
+ if (log_messages) {
336
+ printf (" [EasyConnect] WiFi: %s\n " , EASY_CONNECT_WIFI_TYPE);
337
+ }
338
+ return &wifi;
339
+ #else
340
+ if (log_messages) {
341
+ printf (" [EasyConnect] ERROR - Wifi not in use, can not return WifiInterface.\n " );
342
+ }
343
+ return NULL ;
344
+ #endif
345
+ }
0 commit comments