-
Notifications
You must be signed in to change notification settings - Fork 178
Expand Ethernet interface intro #481
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,45 @@ | ||
## Ethernet | ||
|
||
The EthInterface provides a C++ API for connecting to the internet over Ethernet. | ||
The `EthInterface` provides a C++ API for connecting to the internet over Ethernet. By default, this class does not require any configuration. It is able to pick up the default Ethernet driver for the target and select the correct network stack. | ||
|
||
### EthInterface class reference | ||
### Usage | ||
|
||
[](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_eth_interface.html) | ||
To statically initialize the driver, create an object without passing any parameters: | ||
|
||
### Usage | ||
```cpp | ||
EthernetInterface eth; | ||
``` | ||
|
||
Then, if the default configuration is enough, bring up the interface: | ||
|
||
```cpp | ||
nsapi_error_t status = eth.connect(); | ||
``` | ||
|
||
Now, the interface is ready to be used for [network sockets](/docs/development/reference/network-socket.html). | ||
|
||
```cpp | ||
// Open a TCP socket | ||
TCPSocket socket; | ||
socket.open(ð); | ||
|
||
To bring up the network interface: | ||
// Open a UDP socket | ||
UDPSocket socket; | ||
socket.open(ð); | ||
``` | ||
|
||
1. Instantiate the `EthInterface` class. | ||
1. Call the `connect` function. | ||
1. Once you connect the EthInterface, you can use it as a | ||
target for opening [network sockets](/docs/development/reference/network-socket.html). | ||
### Configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should move the content from this section into the connectivity configuration section. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see that it fits there. This however, refers to the network configuration, how to get the IP address. It is just that you either call the Should I change the tittle? |
||
|
||
For EthernetInterface, there are two possible configurations: | ||
|
||
- Use DHCP for network addressing. This is the default. | ||
- Use statically configured IP addresses. | ||
|
||
Refer to the API below for how to set the IP addresses by calling the `set_network()` function. | ||
|
||
### EthInterface class reference | ||
|
||
[](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_eth_interface.html) | ||
|
||
### EthInterface examples | ||
|
||
|
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.
Is there anything else developers should know about what this API is and what it does? This section seems short.
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.
Its hard to see what should be inserted here.
Networking architecture in general is described in #470 and Ethernet MAC drivers will be explained on their own page (to be moved to Handbook later on).
This whole API usage is concised in the 2 line example below in the Usage section.