-
Notifications
You must be signed in to change notification settings - Fork 3k
Major refactoring: changing Network inheritance from CellularNetwork to new class CellularContext #8579
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
How to migrate from 5.10 to 5.11 (if it includes this one) ? Is there a way to make this backward compatible or only one way forward (migration guide needed) ? |
https://github.com/ARMmbed/mbed-os-example-cellular will still work. It uses CellularBase interface and new class CellularContext is derived from CellulalBase. We also have an internal ticket to update handbook documentation. |
using namespace mbed; | ||
|
||
AT_CellularContext::AT_CellularContext(ATHandler &at, CellularDevice *device, const char *apn, nsapi_ip_stack_t stack) : | ||
AT_CellularBase(at), _ip_stack_type_requested(DEFAULT_STACK), _is_connected(false), _is_blocking(true), |
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.
_ip_stack_type_requested(DEFAULT_STACK) -> _ip_stack_type_requested(stack) ?
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, will fix
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.
Can we really make API to prefer some IP version? Could just use a flag to prefer non-IP and/or control plane?
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.
agreed with the team that we will remove nsapi_ip_stack_t stack from the constructor.
Are all the APIs mentioned here stay the same and all the example still work? https://os.mbed.com/docs/v5.10/apis/cellular-api.html |
02fbf22
to
b7b077e
Compare
Yes, example still works as now new class CellularContext is derived from CellularBase. |
features/netsocket/mbed_lib.json
Outdated
"default-cellular-apn": null, | ||
"default-cellular-username": null, | ||
"default-cellular-password": null, | ||
"default-cellular-plmn": 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.
Remove from here, can be changed via Device API.
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.
removed
CellularContext::AuthenticationType type) { | ||
} | ||
|
||
void AT_CellularContext::set_apn_credentials(const char* apn, const char *uname, const char *pwd, |
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.
Remove this, two times almost the same function.
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.
removed both set_apn_xxx methods as we changed to derive from CellularBase
|
||
uint32_t AT_CellularContext::get_timeout_for_operation(ContextOperation op) const | ||
{ | ||
uint32_t timeout = 10 * 60 * 1000; // default timeout is 10 minutes as registration and attach may take time |
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.
This should be more than 10 minutes, probably something like 30 minutes. Maybe could be defined as NETWORK_TIMEOUT.
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.
fixed
} else { | ||
MBED_ASSERT(_cid >= 0 && _cid <= 99); | ||
char cmd_buf[sizeof("ATD*99***xx#")]; | ||
std::sprintf(cmd_buf, "ATD*99***%d#", _cid); |
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.
This is missing one commit from master.
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 the missing fix
|
||
bool GEMALTO_CINTERION_CellularContext::stack_type_supported(nsapi_ip_stack_t requested_stack) | ||
{ | ||
#if NSAPI_PPP_AVAILABLE |
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.
Missing one commit, this function should be:
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelBGS2) {
return (requested_stack == IPV4_STACK);
}
return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
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.
fixed
|
||
bool TELIT_HE910_CellularContext::stack_type_supported(nsapi_ip_stack_t requested_stack) | ||
{ | ||
return requested_stack == IPV4_STACK || requested_stack == IPV6_STACK; |
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.
This is missing the same commit as in Gemalto drivers.
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.
fixed as in master
d902716
to
b46a66e
Compare
* | ||
* @return pointer to interface, if any. | ||
*/ | ||
static CellularBase *get_default_instance(); |
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.
This is CellularBase too.
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, moved under CellularBase
nsapi_error_t check_operation(nsapi_error_t err, ContextOperation op); | ||
|
||
private: | ||
nsapi_ip_stack_t _ip_stack_type_requested; |
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.
Since there is no more requested stack type(removed from constructor) it means this is not relevant anymore.
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, but we agreed that we are not remove this in this PR as it will change getting the context logic which will change anyway after this PR.
b46a66e
to
b891f5b
Compare
* CellularContext (might be many) and CellularStateMachine if available. | ||
* | ||
*/ | ||
void cellular_callback(nsapi_event_t ev, intptr_t ptr); |
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 this be rephrased more clear? It is not clear who is actually calling it and to which case PPP reffers to.
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.
fixed.
b891f5b
to
57126be
Compare
As long as the backward compatibility is not broken I'm ok with that. The code review will need to be performed by Cllular team. CC: @kjbracey-arm |
a093041
to
c0858b9
Compare
@jarvte Thanks for the heads up. Will start when able. |
/morph build |
Build : FAILUREBuild number : 3605 |
33dd456
to
132e94b
Compare
Please clean up these 12 files |
132e94b
to
7a64520
Compare
7a64520
to
14f3740
Compare
/morph build |
Build : SUCCESSBuild number : 3616 Triggering tests/morph test |
Test : SUCCESSBuild number : 3398 |
Exporter Build : SUCCESSBuild number : 3224 |
Has this been tested with MTS_DRAGONFLY_L471QG (the new Dragonfly Nano)? There is hardware in Oulu. |
No I don't think we tested with that. I didn't know that we have that here. |
Description
Major refactoring: changing NetworkInterface inheritance from CellularNetwork to new class CellularContext
and also moving overridden methods in target folder
@AriParkkila @mirelachirica please review
Pull request type