Skip to content

Add information about default network interface #660

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

Merged
merged 4 commits into from
Aug 23, 2018
Merged

Add information about default network interface #660

merged 4 commits into from
Aug 23, 2018

Conversation

SeppoTakalo
Copy link
Contributor

No description provided.

@SeppoTakalo
Copy link
Contributor Author

@AnotherButler Please review

Copy edit file, mostly for active voice and inclusion of articles.
@AnotherButler AnotherButler self-requested a review August 14, 2018 20:21
@AnotherButler
Copy link
Contributor

@SeppoTakalo Whom should I tag for engineering review?

@SeppoTakalo
Copy link
Contributor Author

@mikaleppanen or @kjbracey-arm Please review

|`*EthInterface::get_default_instance()` | Wired Ethernet interface, not Wi-Fi | none |
|`*MeshInterface::get_default_instance()` | Returns either `LoWPANNDInterface` or `ThreadInterface`, depending on which is set to default | Target provides a driver or macro `DEVICE_802_15_4_PHY` is enabled |
| `*CellularBase::get_default_instance` | Return cellular connectivity | Requires network parameters (pin, APN, username, password) |
| `*NetworkInterface::get_default_instance()` | First one from above that is found | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the above, depending on target.network-default-interface-type, (and preconfigured however is appropriate).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified.

| `*CellularBase::get_default_instance` | Return cellular connectivity | Requires network parameters (pin, APN, username, password) |
| `*NetworkInterface::get_default_instance()` | First one from above that is found | |

Please note that any of those functions may return `NULL` when the interface of this type or its configuration is not found.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to suggest a bit of a rewrite

Note that the calls for a specific interface type do not preconfigure credentials such as SSID, as an interface-type-specific application is expected to configure these in code. NULL will be returned if no interface of that type is available.

Calls for a NetworkInterface will request one of the interface types depending on target.default-network-interface-type, and preconfigure the credentials. If credentials can't be preconfigured (for example because nsapi.default-wifi-ssid isn't set), the call returns NULL rather than an unconfigured interface.

Maybe add the last part of the system:

An application may check the type of the interface returned by NetworkInterface::get_default_instance() by using the "dynamic downcast" methods:

 // net set from NetworkInterface::get_default_instance() as above
 WiFiInterface *wifi = net->wifiInterface();
 if (wifi) {
    printf("This is a Wi-Fi board.")
    // call WiFi-specific methods
 }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added clarification.

|`*WiFiInterface::get_default_instance()`| Wi-Fi interface | Requires security parameters (mode, SSID, password) |
|`*EthInterface::get_default_instance()` | Wired Ethernet interface, not Wi-Fi | none |
|`*MeshInterface::get_default_instance()` | Returns either `LoWPANNDInterface` or `ThreadInterface`, depending on which is set to default | Target provides a driver or macro `DEVICE_802_15_4_PHY` is enabled |
| `*CellularBase::get_default_instance` | Return cellular connectivity | Requires network parameters (pin, APN, username, password) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line doesn't have the () of the others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

{
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This forces Wifi. Not sure you want to do that.

If this is just "use these credentials if running on a Wifi board", leave out this line, but have the next 3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


Please see [Selecting the default network interface](configuration-connectivity.html#selecting-the-default-network-interface) for information about how to supply required configuration parameters on different connections.

For targets that provide more than one type of connectivity, you may choose the default by overriding the `target.network-default-interface-type` configuration variable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert before this:

Targets with connectivity set the target.network-default-interface-type configuration variable appropriately, either to their only interface or their most-commonly-used one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@SeppoTakalo
Copy link
Contributor Author

Clarified the documentation as Kevin suggested.

@SeppoTakalo
Copy link
Contributor Author

@AnotherButler this is now reviewed from engineering point of view. Thanks.

@SeppoTakalo
Copy link
Contributor Author

@AnotherButler Please work with this one. I'm working on delivering changes to external applications regarding default network interface, and I'l like to point users to correct documentation, so I wan't this to be merged.

Also, note that this is OK to be merged into 5.9 branch as well. The API exist there as well. so this can go public.

Thanks.

@AnotherButler
Copy link
Contributor

@SeppoTakalo Is there a code dependency on 7814?

Copy edit for code style and precise language.
@SeppoTakalo
Copy link
Contributor Author

@AnotherButler No code dependency.
7814 just adds more drivers, but the functionality itself is already supported in Mbed OS.

@AnotherButler AnotherButler merged commit 295302e into ARMmbed:development Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants