Skip to content

Commit a95d376

Browse files
Teppo JärvelinAri Parkkila
authored andcommitted
review changes: take define MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP in to use.
1 parent 1fd9ba6 commit a95d376

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

features/cellular/easy_cellular/EasyCellularConnection.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#include "EasyCellularConnection.h"
2929
#include "CellularLog.h"
3030

31-
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP
31+
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
3232
#include "APN_db.h"
33-
#endif //MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP
33+
#endif //MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
3434

3535
namespace mbed {
3636

@@ -53,10 +53,13 @@ bool EasyCellularConnection::cellular_status(int state, int next_state)
5353
}
5454

5555
EasyCellularConnection::EasyCellularConnection() : _is_connected(false), _is_initialized(false),
56-
_credentials_set(false), _target_state(CellularConnectionUtil::STATE_POWER_ON),
56+
_target_state(CellularConnectionUtil::STATE_POWER_ON),
5757
_cellularSerial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE),
5858
_cellularSemaphore(0), _cellularConnectionUtil(), _credentials_err(NSAPI_ERROR_OK)
5959
{
60+
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
61+
_credentials_set = false;
62+
#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
6063
tr_info("EasyCellularConnection()");
6164
}
6265

@@ -97,9 +100,11 @@ void EasyCellularConnection::set_credentials(const char *apn, const char *uname,
97100
CellularNetwork * network = _cellularConnectionUtil.get_network();
98101
if (network) {
99102
_credentials_err = network->set_credentials(apn, uname, pwd);
103+
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
100104
if (_credentials_err == NSAPI_ERROR_OK) {
101105
_credentials_set = true;
102106
}
107+
#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
103108
} else {
104109
tr_error("NO Network...");
105110
}
@@ -156,7 +161,7 @@ nsapi_error_t EasyCellularConnection::connect()
156161
if (err) {
157162
return err;
158163
}
159-
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP
164+
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
160165
if (!_credentials_set) {
161166
_target_state = CellularConnectionUtil::STATE_SIM_PIN;
162167
err = _cellularConnectionUtil.continue_to_state(_target_state);
@@ -184,7 +189,7 @@ nsapi_error_t EasyCellularConnection::connect()
184189
return err;
185190
}
186191
}
187-
#endif // MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP
192+
#endif // MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
188193

189194
_target_state = CellularConnectionUtil::STATE_CONNECTED;
190195
err = _cellularConnectionUtil.continue_to_state(_target_state);
@@ -203,7 +208,9 @@ nsapi_error_t EasyCellularConnection::disconnect()
203208
{
204209
_credentials_err = NSAPI_ERROR_OK;
205210
_is_connected = false;
211+
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
206212
_credentials_set = false;
213+
#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
207214
if (!_cellularConnectionUtil.get_network()) {
208215
return NSAPI_ERROR_NO_CONNECTION;
209216
}

features/cellular/easy_cellular/EasyCellularConnection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ class EasyCellularConnection: public CellularBase {
136136

137137
bool _is_connected;
138138
bool _is_initialized;
139+
#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
139140
bool _credentials_set;
141+
#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
140142
CellularConnectionUtil::CellularState _target_state;
141143

142144
UARTSerial _cellularSerial;

0 commit comments

Comments
 (0)