The easy-connect library for GR-LYCHEE.

Dependencies:   LWIPBP3595Interface_STA_for_mbed-os

Fork of easy-connect-gr-peach by Daiki Kato

Files at this revision

API Documentation at this revision

Comitter:
dkato
Date:
Tue Mar 14 05:41:15 2017 +0000
Parent:
0:77c289709567
Child:
2:34fe4f11941d
Commit message:
The security of wifi can be changed from mbed_app.json.

Changed in this revision

easy-connect.h Show annotated file Show diff for this revision Revisions of this file
--- a/easy-connect.h	Wed Mar 08 07:17:06 2017 +0000
+++ b/easy-connect.h	Tue Mar 14 05:41:15 2017 +0000
@@ -37,6 +37,9 @@
 #define MBED_CONF_APP_WIFI_PASSWORD MBED_CONF_APP_ESP8266_PASSWORD
 #endif
 
+#ifndef MBED_CONF_APP_WIFI_SECURITY
+#define MBED_CONF_APP_WIFI_SECURITY NSAPI_SECURITY_WPA_WPA2
+#endif
 
 NetworkInterface* easy_connect(bool log_messages = false) {
     NetworkInterface* network_interface = 0;
@@ -46,14 +49,14 @@
         printf("[EasyConnect] Using WiFi (ESP8266) \n");
         printf("[EasyConnect] Connecting to WiFi %s\n", MBED_CONF_APP_WIFI_SSID);
     }
-    connect_success = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
+    connect_success = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, MBED_CONF_APP_WIFI_SECURITY);
     network_interface = &wifi;
 #elif MBED_CONF_APP_NETWORK_INTERFACE == WIFI_BP3595
     if (log_messages) {
         printf("[EasyConnect] Using WiFi (BP3595) \n");
         printf("[EasyConnect] Connecting to WiFi %s\n", MBED_CONF_APP_WIFI_SSID);
     }
-    connect_success = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
+    connect_success = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, MBED_CONF_APP_WIFI_SECURITY);
     network_interface = &wifi;
 #elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET
     if (log_messages) {