mirror of https://github.com/ARMmbed/mbed-os.git
review changes: take define MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP in to use.
parent
1fd9ba6caa
commit
a95d376820
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue