From a95d376820196deba5f5431ee3910b46a5bc36ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teppo=20J=C3=A4rvelin?= Date: Mon, 26 Feb 2018 12:33:35 +0200 Subject: [PATCH] review changes: take define MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP in to use. --- .../easy_cellular/EasyCellularConnection.cpp | 17 ++++++++++++----- .../easy_cellular/EasyCellularConnection.h | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/features/cellular/easy_cellular/EasyCellularConnection.cpp b/features/cellular/easy_cellular/EasyCellularConnection.cpp index 5f0c3de514..074a3b7b88 100644 --- a/features/cellular/easy_cellular/EasyCellularConnection.cpp +++ b/features/cellular/easy_cellular/EasyCellularConnection.cpp @@ -28,9 +28,9 @@ #include "EasyCellularConnection.h" #include "CellularLog.h" -#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP +#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP #include "APN_db.h" -#endif //MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP +#endif //MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP namespace mbed { @@ -53,10 +53,13 @@ bool EasyCellularConnection::cellular_status(int state, int next_state) } EasyCellularConnection::EasyCellularConnection() : _is_connected(false), _is_initialized(false), - _credentials_set(false), _target_state(CellularConnectionUtil::STATE_POWER_ON), + _target_state(CellularConnectionUtil::STATE_POWER_ON), _cellularSerial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE), _cellularSemaphore(0), _cellularConnectionUtil(), _credentials_err(NSAPI_ERROR_OK) { +#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP + _credentials_set = false; +#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP tr_info("EasyCellularConnection()"); } @@ -97,9 +100,11 @@ void EasyCellularConnection::set_credentials(const char *apn, const char *uname, CellularNetwork * network = _cellularConnectionUtil.get_network(); if (network) { _credentials_err = network->set_credentials(apn, uname, pwd); +#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP if (_credentials_err == NSAPI_ERROR_OK) { _credentials_set = true; } +#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP } else { tr_error("NO Network..."); } @@ -156,7 +161,7 @@ nsapi_error_t EasyCellularConnection::connect() if (err) { return err; } -#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP +#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP if (!_credentials_set) { _target_state = CellularConnectionUtil::STATE_SIM_PIN; err = _cellularConnectionUtil.continue_to_state(_target_state); @@ -184,7 +189,7 @@ nsapi_error_t EasyCellularConnection::connect() return err; } } -#endif // MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP +#endif // MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP _target_state = CellularConnectionUtil::STATE_CONNECTED; err = _cellularConnectionUtil.continue_to_state(_target_state); @@ -203,7 +208,9 @@ nsapi_error_t EasyCellularConnection::disconnect() { _credentials_err = NSAPI_ERROR_OK; _is_connected = false; +#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP _credentials_set = false; +#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP if (!_cellularConnectionUtil.get_network()) { return NSAPI_ERROR_NO_CONNECTION; } diff --git a/features/cellular/easy_cellular/EasyCellularConnection.h b/features/cellular/easy_cellular/EasyCellularConnection.h index a041e89765..a4c3bc62b2 100644 --- a/features/cellular/easy_cellular/EasyCellularConnection.h +++ b/features/cellular/easy_cellular/EasyCellularConnection.h @@ -136,7 +136,9 @@ private: bool _is_connected; bool _is_initialized; +#if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP bool _credentials_set; +#endif // #if MBED_CONF_APP_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP CellularConnectionUtil::CellularState _target_state; UARTSerial _cellularSerial;