Skip to content

Commit 9f8fe89

Browse files
author
Seppo Takalo
committed
Add documentation for NanostackEthernetInterface.
1 parent ae885ca commit 9f8fe89

File tree

1 file changed

+38
-7
lines changed
  • features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api

1 file changed

+38
-7
lines changed

features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ ARM mbed mesh API allows the client to use the IPv6 mesh network.
44

55
The client can use the `LoWPANNDInterface` or `ThreadInterface` object for connecting to the mesh network and when successfully connected, the client can create a socket by using the [mbed C++ socket API](https://developer.mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/docs/tip/) to start communication with a remote peer.
66

7+
For ethernet `NanostackEthernetInterface` is provided.
8+
79
## Supported mesh networking modes
810

911
Currently, 6LoWPAN-ND (neighbour discovery) and Thread bootstrap modes are supported.
@@ -27,18 +29,18 @@ An example of the configuration file:
2729
}
2830
```
2931

30-
**Configurable parameters in section `mbed-mesh-api`:**
32+
### Configurable parameters in section mbed-mesh-api
3133

3234
| Parameter name | Value | Description |
3335
| --------------- | ------------- | ----------- |
3436
| heap-size | number [0-0xfffe] | Nanostack's internal heap size |
3537

36-
**Thread related configuration parameters:**
38+
### Thread related configuration parameters
3739

3840
| Parameter name | Value | Description |
3941
| --------------- | ------------- | ----------- |
4042
| thread-pskd | string [6-255 chars] | Human-scaled commissioning credentials. |
41-
| hread-device-type | enum from mesh_device_type_t | Set device operating mode. |
43+
| thread-device-type | enum from mesh_device_type_t | Set device operating mode. |
4244
| thread-config-channel-mask | number [0-0x07fff800] | Channel mask, 0x07fff800 scans all channels. |
4345
| thread-config-channel-page | number [0, 2]| Channel page, 0 for 2,4 GHz and 2 for sub-GHz radios. |
4446
| thread-config-channel | number [0-27] | RF channel to use. |
@@ -47,7 +49,7 @@ An example of the configuration file:
4749
| thread-config-ml-prefix | byte array [8] | Mesh local prefix. |
4850
| thread-config-pskc | byte array [16] | Pre-Shared Key for the Commissioner. |
4951

50-
**6LoWPAN related configuration parameters:**
52+
### 6LoWPAN related configuration parameters
5153

5254
| Parameter name | Type | Description |
5355
| --------------- | ---------| ----------- |
@@ -63,7 +65,9 @@ An example of the configuration file:
6365

6466
## Usage notes
6567

66-
This module should not be used directly by the applications. The applications should use the `LoWPANNDInterface` or `ThreadInterface` directly.
68+
This module should not be used directly by the applications. The applications should use the `LoWPANNDInterface`, `ThreadInterface` or `NanostackEthernetInterface` directly.
69+
70+
When using Ethernet interface, there is no configuration options available. It is using dynamic mode to learn the IPv6 prefix from the network. No static configuration is supported.
6771

6872
### Network connection states
6973

@@ -77,13 +81,20 @@ See the example application [mbed-os-example-mesh-minimal](https://github.com/AR
7781

7882
## Usage example for 6LoWPAN ND mode
7983

80-
**Create a network interface:**
84+
Create a network interface and driver objects.
8185

8286
```
8387
LoWPANNDInterface mesh;
88+
NanostackRfPhyNcs36510 rf_phy;
8489
```
8590

86-
**Connect:**
91+
Initialize interface with given PHY driver.
92+
93+
```
94+
mesh.initialize(&rf_phy);
95+
```
96+
97+
Then connect to network:
8798

8899
```
89100
if (mesh.connect()) {
@@ -102,3 +113,23 @@ Basically the same as for ND, but the network interface uses different class:
102113
ThreadInterface mesh;
103114
mesh.connect();
104115
```
116+
117+
## Usage example with Ethernet
118+
119+
API is still the same, you just need to provide a driver that implements `NanostackEthernetPhy` API.
120+
121+
```
122+
NanostackEthernetInterface eth;
123+
NanostackEthernetPhyK64F phy;
124+
125+
int main() {
126+
eth.initialize(&phy);
127+
128+
if (eth.connect()) {
129+
printf("Connection failed!\r\n");
130+
return -1;
131+
}
132+
133+
printf("connected. IP = %s\r\n", eth.get_ip_address());
134+
}
135+
```

0 commit comments

Comments
 (0)