Skip to content

Updated ethernet and wifi interface description #472

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 2 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/reference/api/connectivity/networksocket/EthInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ Refer to the API below for how to set the IP addresses by calling the `set_netwo
### Troubleshooting information

Network interface `connect` failure causes:
1. `NSAPI_ERROR_NO_CONNECTION` indicates that Ethernet link up has failed. Check that the Ethernet connection is working.
1. `NSAPI_ERROR_DHCP_FAILURE` indicates that acquiring IP address has failed. Check that the IP address configuration service is working.

- `NSAPI_ERROR_NO_CONNECTION` indicates that the Ethernet link up has failed. Check that the Ethernet connection is working.
- `NSAPI_ERROR_DHCP_FAILURE` indicates that acquiring the IP address has failed. Check that the IP address configuration service is working.

### EthInterface class reference

Expand Down
33 changes: 15 additions & 18 deletions docs/reference/api/connectivity/networksocket/WifiInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,42 @@

The WifiInterface provides a simple C++ API for connecting to the internet over a Wi-Fi device.

There are multiple [Wi-Fi components](https://os.mbed.com/components/cat/wifi/) that implement the WiFiInterface class. The example below uses the [ESP8266Interface](https://github.com/armmbed/esp8266-driver) and
[OdinWiFiInterface](https://github.com/u-blox/ublox-odin-w2-drivers-docs-mbed-5).

ESP8266Interface uses AT commands over serial interface to connect to external Wi-Fi device. OdinWiFiInterface provides Ethernet like driver to Mbed OS network stack. Network stack uses the driver to connect to Wi-Fi.

### Wi-Fi class reference

[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_wi_fi_interface.html)

### Usage

To bring up the network interface of external Wi-Fi device (for example, the ESP8266Interface):
To bring up the network interface of an external Wi-Fi device (for example, the ESP8266Interface):

1. Instantiate an implementation of the WiFiInterface class.
1. Initialises AT command parser.
1. Initialize the AT command parser.
1. Call the `connect` function with an SSID and password for the Wi-Fi network.
1. Commands Wi-Fi device to connect to network.
1. Once connected, the WiFiInterface can be used as a target for opening [network sockets](/docs/development/reference/network-socket.html).
1. Command the Wi-Fi device to connect to network.
1. Once connected, you can use the WiFiInterface as a target for opening [network sockets](/docs/development/reference/network-socket.html).

To bring up the network interface of Ethernet like driver (for example, the OdinWiFiInterface):
To bring up the network interface of an Ethernet-like driver (for example, the OdinWiFiInterface):

1. Instantiate an implementation of the WiFiInterface class.
1. Initialises Wifi driver for the target.
1. Initialises network stack (LWIP).
1. Initialize the Wi-Fi driver for the target.
1. Initialize network stack (LWIP).
1. Call the `connect` function with an SSID and password for the Wi-Fi network.
1. Wi-Fi driver connects to Wi-Fi network.
2. Network stack accuires IP address and DNS server address.

1. Once connected, the WiFiInterface can be used as a target for opening [network sockets](/docs/development/reference/network-socket.html).
1. Connect the Wi-Fi driver to the Wi-Fi network.
2. Ensure the network stack acquires the IP address and DNS server address.
1. Once connected, you can use the WiFiInterface as a target for opening [network sockets](/docs/development/reference/network-socket.html).

### Troubleshooting information

Network interface `connect` failure reasons:
1. Check that SSID and password are correct.

1. Check that the SSID and password are correct.
1. Check that the IP address configuration service is working.

### Wi-Fi example

Here is an example of an HTTP client program. The program brings up an ESP8266 as the underlying network interface, and uses it to perform an HTTP transaction over a TCPSocket:
Here is an example of an HTTP client program. The program brings up an ESP8266 as the underlying network interface, and uses it to perform an HTTP transaction over a TCPSocket. There are multiple [Wi-Fi components](https://os.mbed.com/components/cat/wifi/) that implement the WiFiInterface class. The example below uses the [ESP8266Interface](https://github.com/armmbed/esp8266-driver) and [OdinWiFiInterface](https://github.com/u-blox/ublox-odin-w2-drivers-docs-mbed-5).

The ESP8266Interface uses AT commands over serial interface to connect to an external Wi-Fi device. The OdinWiFiInterface provides an Ethernet-like driver to the Mbed OS network stack. The network stack uses the driver to connect to Wi-Fi:

[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/TCPSocketWiFi_Example/)](https://os.mbed.com/teams/mbed_example/code/TCPSocketWiFi_Example/file/6a4e57edc2b2/main.cpp)

Expand Down