-
Notifications
You must be signed in to change notification settings - Fork 178
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
Add information about default network interface #660
Conversation
@AnotherButler Please review |
Copy edit file, mostly for active voice and inclusion of articles.
@SeppoTakalo Whom should I tag for engineering review? |
@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 | | |
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.
One of the above, depending on target.network-default-interface-type
, (and preconfigured however is appropriate).
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.
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. |
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.
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 ontarget.default-network-interface-type
, and preconfigure the credentials. If credentials can't be preconfigured (for example becausensapi.default-wifi-ssid
isn't set), the call returnsNULL
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
}
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.
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) | |
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 line doesn't have the ()
of the others.
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
{ | ||
"target_overrides": { | ||
"*": { | ||
"target.network-default-interface-type": "WIFI", |
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 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.
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
|
||
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. |
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.
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.
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.
Clarified the documentation as Kevin suggested. |
@AnotherButler this is now reviewed from engineering point of view. Thanks. |
@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. |
@SeppoTakalo Is there a code dependency on 7814? |
Copy edit for code style and precise language.
@AnotherButler No code dependency. |
No description provided.