Skip to content
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

Cellular: CellularContext must provide access to CellularDevice #10210

Merged
merged 1 commit into from Mar 28, 2019

Conversation

Projects
None yet
10 participants
@jarvte
Copy link
Contributor

commented Mar 25, 2019

Description

When using NetworkInterface::get_default_instance() application gets handle
to CellularInterface which is actually CellularContext derived from CellularInterface.
Application needs also handle to CellularDevice to open other interfaces.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@AnttiKauppila @kivaisan

Release Notes

When using NetworkInterface::get_default_instance() application gets handle
to CellularInterface which is actually CellularContext derived from CellularInterface.
Application needs also handle to CellularDevice to open other interfaces.

@ciarmcom ciarmcom requested review from AnttiKauppila, kivaisan and ARMmbed/mbed-os-maintainers Mar 25, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

commented Mar 25, 2019

@jarvte jarvte force-pushed the jarvte:cellulardevice_from_context branch from ebb65ed to c0151b1 Mar 25, 2019

@jarvte

This comment has been minimized.

Copy link
Contributor Author

commented Mar 25, 2019

Force pushed review fixes:

  • removed virtual from Cellularcontext
  • removed inherited methods from AT_CellularContext
@trowbridgec

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

This is a great feature to add! Whenever working with the cell infrastructure, I always find it cumbersome to work between CellularContext and CellularDevice.

Cellular: CellularContext must provide access to CellularDevice
When using NetworkInterface::get_default_instance() application gets handle
to CellularInterface which is actually CellularContext derived from CellularInterface.
Application needs also handle to CellularDevice to open other interfaces.

@jarvte jarvte force-pushed the jarvte:cellulardevice_from_context branch from c0151b1 to b0ee22c Mar 26, 2019

@jarvte

This comment has been minimized.

Copy link
Contributor Author

commented Mar 26, 2019

pushed AT-specific device getter to AT_CellularContext as @kjbracey-arm suggested.

@AriParkkila

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

Should getter be virtual so that an application doesn't need to know exact type?

@kjbracey-arm

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2019

Should getter be virtual so that an application doesn't need to know exact type?

(I don't think I'm talking nonsense here, but it's possible...)

The application doesn't need to know the type - if it is using CellularContext as its local static type, it will non-virtually call CellularContext::get_device and get a CellularDevice *.

If it's using AT_CellularContext as its local static type, it will non-virtually call AT_CellularContext::get_device and get an AT_CellularDevice *.

So we're just using whatever static type information we have at the call-site, and maintaining that static type information in the output.

The actual dynamic type we don't know, and can't determine anyway as RTTI is turned off, and either way you're getting a pointer to the same object - the two implementations do the same thing, so it doesn't matter which one you call.

An application using CellularContext * doesn't need to polymorphically invoke AT_CellularContext::get_device to get the correct result.

It's just a bit like the overloads:

  • const char *strstr(const char *str, const char *target) and
  • char *strstr(char *str, const char *target).

Both do the same thing, so it doesn't really matter which you call, but the static type of the output depends on the static type of the input.

@cmonr cmonr requested a review from AnttiKauppila Mar 27, 2019

@cmonr cmonr added needs: CI and removed needs: review labels Mar 27, 2019

@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2019

CI started

@mbed-ci

This comment has been minimized.

Copy link

commented Mar 28, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 1
Build artifacts

@cmonr cmonr added ready for merge and removed needs: CI labels Mar 28, 2019

cmonr added a commit to cmonr/mbed-os that referenced this pull request Mar 28, 2019

Merge pull request ARMmbed#10210 from jarvte/cellulardevice_from_context
Cellular: CellularContext must provide access to CellularDevice

@cmonr cmonr merged commit 4af3c38 into ARMmbed:master Mar 28, 2019

28 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARMC5 Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR8 Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARMC5 Success
Details
jenkins-ci/mbed2-build-ARMC6 Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR8 Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 10275 cycles (-40 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B (+0.00%)
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details

@cmonr cmonr removed the ready for merge label Mar 28, 2019

@jarvte jarvte deleted the jarvte:cellulardevice_from_context branch Mar 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.