Skip to content
This repository was archived by the owner on May 24, 2019. It is now read-only.

Commit 4f36e8d

Browse files
author
Ari Parkkila
committed
Updated cellular connection
1 parent 4e60830 commit 4f36e8d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

easy-connect.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ ThreadInterface mesh;
7272
#elif MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR_ONBOARD
7373
#include "OnboardCellularInterface.h"
7474
OnboardCellularInterface cellular;
75+
#elif MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR
76+
#include "EasyCellularConnection.h"
77+
EasyCellularConnection cellular;
7578

7679
#elif MBED_CONF_APP_NETWORK_INTERFACE == WIFI_WIZFI310
7780
#include "WizFi310Interface.h"
@@ -132,7 +135,7 @@ char* _password = NULL;
132135
*
133136
*/
134137
void print_MAC(NetworkInterface* network_interface, bool log_messages) {
135-
#if MBED_CONF_APP_NETWORK_INTERFACE != CELLULAR_ONBOARD
138+
#if MBED_CONF_APP_NETWORK_INTERFACE != CELLULAR_ONBOARD && MBED_CONF_APP_NETWORK_INTERFACE != CELLULAR
136139
const char *mac_addr = network_interface->get_mac_address();
137140
if (mac_addr == NULL) {
138141
if (log_messages) {
@@ -201,7 +204,12 @@ NetworkInterface* easy_connect(bool log_messages) {
201204
else {
202205
connect_success = wifi.connect(_ssid, _password, (strlen(_password) > 1) ? NSAPI_SECURITY_WPA_WPA2 : NSAPI_SECURITY_NONE);
203206
}
204-
#elif MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR_ONBOARD
207+
#elif MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR_ONBOARD || MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR
208+
#if MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR
209+
if (cellular.init() != NSAPI_ERROR_OK) {
210+
printf("Cellular init failed!");
211+
}
212+
#endif
205213
# ifdef MBED_CONF_APP_CELLULAR_SIM_PIN
206214
cellular.set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN);
207215
# endif
@@ -332,6 +340,11 @@ NetworkInterface* easy_get_netif(bool log_messages) {
332340
printf("[EasyConnect] Cellular\n");
333341
}
334342
return &cellular;
343+
#elif MBED_CONF_APP_NETWORK_INTERFACE == CELLULAR
344+
if (log_messages) {
345+
printf("[EasyConnect] Cellular\n");
346+
}
347+
return &cellular;
335348
#endif
336349
}
337350

easy-connect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define MESH_LOWPAN_ND 101
3030
#define MESH_THREAD 102
3131
#define CELLULAR_ONBOARD 201
32-
32+
#define CELLULAR 202
3333

3434
/* Define supersets for WiFi and Mesh */
3535

0 commit comments

Comments
 (0)