Added deativation of context associated with profile

Added emt method in At cellular context stub file
pull/12589/head
Syed Fahimuddin Alavi 2020-03-06 15:48:44 +05:00
parent 03dab7f9a0
commit c6b6efc456
5 changed files with 29 additions and 12 deletions

View File

@ -199,6 +199,10 @@ void AT_CellularContext::do_connect()
{
}
void AT_CellularContext::do_disconnect()
{
}
#if NSAPI_PPP_AVAILABLE
nsapi_error_t AT_CellularContext::open_data_channel()
{

View File

@ -84,6 +84,8 @@ protected:
*/
virtual void do_connect();
virtual void do_disconnect();
/** Get the operation specific timeout. Used in synchronous mode when setting the maximum
* waiting time. Modem specific implementation can override this to provide different timeouts.
*
@ -121,7 +123,6 @@ private:
nsapi_error_t check_operation(nsapi_error_t err, ContextOperation op);
void ciot_opt_cb(mbed::CellularNetwork::CIoT_Supported_Opt ciot_opt);
virtual void do_connect_with_retry();
void do_disconnect();
void set_cid(int cid);
private:

View File

@ -128,22 +128,19 @@ CellularDevice *CellularDevice::get_default_instance()
nsapi_error_t UBLOX_AT::init()
{
setup_at_handler();
_at.lock();
_at.flush();
_at.at_cmd_discard("", "");
int value = -1;
#ifdef UBX_MDM_SARA_G3XX
value = 0;
#elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_R41XM)
value = 4;
#else
_at.unlock();
return NSAPI_ERROR_UNSUPPORTED;
#endif
#if defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX)
nsapi_error_t err = _at.at_cmd_discard("E0", ""); // echo off
nsapi_error_t err = _at.at_cmd_discard("+CFUN", "=", "%d", value);
if (err == NSAPI_ERROR_OK) {
_at.at_cmd_discard("+CMEE", "=1"); // verbose responses
err = _at.at_cmd_discard("+CFUN", "=1"); // set full functionality
}
#elif defined(UBX_MDM_SARA_R41XM)
nsapi_error_t err = _at.at_cmd_discard("+CFUN", "=", "%d", 4);
if (err == NSAPI_ERROR_OK) {
_at.at_cmd_discard("E0", ""); // echo off
@ -151,6 +148,11 @@ nsapi_error_t UBLOX_AT::init()
config_authentication_parameters();
err = _at.at_cmd_discard("+CFUN", "=1"); // set full functionality
}
#else
_at.unlock();
return NSAPI_ERROR_UNSUPPORTED;
#endif
return _at.unlock_return_error();
}

View File

@ -113,6 +113,13 @@ void UBLOX_AT_CellularContext::do_connect()
_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, _connect_status);
}
}
#ifndef UBX_MDM_SARA_R41XM
void UBLOX_AT_CellularContext::do_disconnect()
{
disconnect_modem_stack();
AT_CellularContext::do_disconnect();
}
#endif
#ifndef UBX_MDM_SARA_R41XM
nsapi_error_t UBLOX_AT_CellularContext::define_context()

View File

@ -28,6 +28,9 @@ public:
virtual ~UBLOX_AT_CellularContext();
virtual void do_connect();
#ifndef UBX_MDM_SARA_R41XM
virtual void do_disconnect();
#endif
virtual nsapi_error_t get_gateway(SocketAddress *addr);
const char *get_apn(void);