-
Notifications
You must be signed in to change notification settings - Fork 3k
Cellular: more gracefully disconnect. #8772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
320f41c
to
168b9ca
Compare
rebased as there was checkout failure in travis |
168b9ca
to
e0290cd
Compare
} | ||
|
||
_is_connected = false; | ||
call_network_cb(NSAPI_STATUS_DISCONNECTED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess disconnected event should be handled by +CGEV, when really disconnected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasons for sending NSAPI_STATUS_DISCONNECTED here:
- +CGEV is unreliable
- synchronous disconnect call in PPP mode will also send NSAPI_STATUS_DISCONNECTED before returning so it's on line with PPP now.
_at.cmd_stop_read_resp(); | ||
} | ||
_at.clear_error(); | ||
_at.cmd_start("AT+CGATT=0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess CellularNetwork::detach
should be updated to detach from network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added register to CellularNetwork::detach
_at.unlock(); | ||
#endif // NSAPI_PPP_AVAILABLE | ||
_at.lock(); | ||
|
||
// deactivate a context only if we have activated | ||
if (_is_context_activated) { | ||
// CGACT and CGATT commands might take up to 3 minutes to respond. | ||
_at.set_at_timeout(180 * 1000, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false is default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, removed extra false
@@ -150,7 +148,10 @@ FileHandle *ATHandler::get_file_handle() | |||
|
|||
void ATHandler::set_file_handle(FileHandle *fh) | |||
{ | |||
_fh_sigio_set = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why to protect setting fileHandle, maybe this flag could be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, removed.
@@ -659,17 +665,27 @@ nsapi_error_t AT_CellularContext::disconnect() | |||
// 3GPP TS 27.007: | |||
// For EPS, if an attempt is made to disconnect the last PDN connection, then the MT responds with ERROR | |||
if (_is_context_active && (rat < CellularNetwork::RAT_E_UTRAN || active_contexts_count > 1)) { | |||
_at.clear_error(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return value is actually meaningless due to clear_error
calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost, CGACT can still fail. CGACT is more powerful than commands above. So we try to do thing properly but the last CGACT will finally detach from the network and then it should not matter that the above commands have failed.
@@ -1207,3 +1208,26 @@ void ATHandler::debug_print(char *p, int len) | |||
} | |||
#endif // MBED_CONF_CELLULAR_DEBUG_AT | |||
} | |||
|
|||
bool ATHandler::sync() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could take time as parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added parameter
e0290cd
to
a655a53
Compare
Info: This PR has been re-bundled into a new rollup PR (#8862). No further work is needed here, as once that PR is merged, this PR will also be closed and marked as merged. |
Description
@mirelachirica @AriParkkila please review
Pull request type