You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/api/connectivity/networksocket/networkinterface.md
+16-5Lines changed: 16 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,6 @@ For example, when providing Wi-Fi SSID and password, you may use the following `
42
42
{
43
43
"target_overrides": {
44
44
"*": {
45
-
"target.network-default-interface-type": "WIFI",
46
45
"nsapi.default-wifi-security": "WPA_WPA2",
47
46
"nsapi.default-wifi-ssid": "\"ssid\"",
48
47
"nsapi.default-wifi-password": "\"password\""
@@ -53,7 +52,7 @@ For example, when providing Wi-Fi SSID and password, you may use the following `
53
52
54
53
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.
55
54
56
-
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.
55
+
Targets with connectivity set the `target.network-default-interface-type` configuration variable appropriately, either to their only interface or their most-commonly-used one. 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.
57
56
58
57
Applications may also ask for a specific type of connection, as the following table shows:
59
58
@@ -62,10 +61,22 @@ Applications may also ask for a specific type of connection, as the following ta
|`*EthInterface::get_default_instance()`| Wired Ethernet interface, not Wi-Fi | none |
64
63
|`*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 |
|`*NetworkInterface::get_default_instance()`|One of the above, depending on `target.network-default-interface-type`||
67
66
68
-
Please note that any of those functions may return `NULL` when the interface of this type or its configuration is not found.
67
+
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.
68
+
69
+
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.
70
+
71
+
An application may check the type of the interface returned by NetworkInterface::get_default_instance() by using the "dynamic downcast" methods:
72
+
```
73
+
// net set from NetworkInterface::get_default_instance() as above
0 commit comments