Skip to content

Commit c6b6efc

Browse files
committed
Added deativation of context associated with profile
Added emt method in At cellular context stub file
1 parent 03dab7f commit c6b6efc

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

UNITTESTS/stubs/AT_CellularContext_stub.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ void AT_CellularContext::do_connect()
199199
{
200200
}
201201

202+
void AT_CellularContext::do_disconnect()
203+
{
204+
}
205+
202206
#if NSAPI_PPP_AVAILABLE
203207
nsapi_error_t AT_CellularContext::open_data_channel()
204208
{

features/cellular/framework/AT/AT_CellularContext.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ class AT_CellularContext : public CellularContext {
8484
*/
8585
virtual void do_connect();
8686

87+
virtual void do_disconnect();
88+
8789
/** Get the operation specific timeout. Used in synchronous mode when setting the maximum
8890
* waiting time. Modem specific implementation can override this to provide different timeouts.
8991
*
@@ -121,7 +123,6 @@ class AT_CellularContext : public CellularContext {
121123
nsapi_error_t check_operation(nsapi_error_t err, ContextOperation op);
122124
void ciot_opt_cb(mbed::CellularNetwork::CIoT_Supported_Opt ciot_opt);
123125
virtual void do_connect_with_retry();
124-
void do_disconnect();
125126
void set_cid(int cid);
126127

127128
private:

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,29 +128,31 @@ CellularDevice *CellularDevice::get_default_instance()
128128
nsapi_error_t UBLOX_AT::init()
129129
{
130130
setup_at_handler();
131-
132131
_at.lock();
133132
_at.flush();
134133
_at.at_cmd_discard("", "");
135-
int value = -1;
136134

137-
#ifdef UBX_MDM_SARA_G3XX
138-
value = 0;
139-
#elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_R41XM)
140-
value = 4;
141-
#else
142-
_at.unlock();
143-
return NSAPI_ERROR_UNSUPPORTED;
144-
#endif
135+
#if defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX)
136+
nsapi_error_t err = _at.at_cmd_discard("E0", ""); // echo off
145137

146-
nsapi_error_t err = _at.at_cmd_discard("+CFUN", "=", "%d", value);
138+
if (err == NSAPI_ERROR_OK) {
139+
_at.at_cmd_discard("+CMEE", "=1"); // verbose responses
140+
err = _at.at_cmd_discard("+CFUN", "=1"); // set full functionality
141+
}
142+
#elif defined(UBX_MDM_SARA_R41XM)
143+
nsapi_error_t err = _at.at_cmd_discard("+CFUN", "=", "%d", 4);
147144

148145
if (err == NSAPI_ERROR_OK) {
149146
_at.at_cmd_discard("E0", ""); // echo off
150147
_at.at_cmd_discard("+CMEE", "=1"); // verbose responses
151148
config_authentication_parameters();
152149
err = _at.at_cmd_discard("+CFUN", "=1"); // set full functionality
153150
}
151+
#else
152+
_at.unlock();
153+
return NSAPI_ERROR_UNSUPPORTED;
154+
#endif
155+
154156
return _at.unlock_return_error();
155157
}
156158

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularContext.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ void UBLOX_AT_CellularContext::do_connect()
113113
_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, _connect_status);
114114
}
115115
}
116+
#ifndef UBX_MDM_SARA_R41XM
117+
void UBLOX_AT_CellularContext::do_disconnect()
118+
{
119+
disconnect_modem_stack();
120+
AT_CellularContext::do_disconnect();
121+
}
122+
#endif
116123

117124
#ifndef UBX_MDM_SARA_R41XM
118125
nsapi_error_t UBLOX_AT_CellularContext::define_context()

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularContext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ class UBLOX_AT_CellularContext: public AT_CellularContext {
2828
virtual ~UBLOX_AT_CellularContext();
2929

3030
virtual void do_connect();
31+
#ifndef UBX_MDM_SARA_R41XM
32+
virtual void do_disconnect();
33+
#endif
3134
virtual nsapi_error_t get_gateway(SocketAddress *addr);
3235

3336
const char *get_apn(void);

0 commit comments

Comments
 (0)