Skip to content

Commit db3eb69

Browse files
author
Amanda Butler
authored
Merge pull request #470 from SeppoTakalo/new_engine
Technology/Connectivity refactoring
2 parents 1558d48 + 08d3f9b commit db3eb69

23 files changed

+391
-189
lines changed

docs.json

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,19 @@
8989
},
9090
{
9191
"title": "Technology",
92+
"intro": {
93+
"type": "markdown",
94+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/technology/technology.md"
95+
},
9296
"sources": [{
97+
"type": "markdown",
98+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/technology/connectivity/connectivity.md"
99+
},
100+
{
101+
"type": "markdown",
102+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/technology/connectivity/networking.md"
103+
},
104+
{
93105
"type": "markdown",
94106
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/technology/mesh/quick_start_intro.md"
95107
},
@@ -120,6 +132,10 @@
120132
{
121133
"type": "markdown",
122134
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/technology/mesh/04_N_networking.md"
135+
},
136+
{
137+
"type": "markdown",
138+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/technology/connectivity/intro-to-lora.md"
123139
}
124140
]
125141
},
@@ -370,35 +386,43 @@
370386
},
371387
"sources": [{
372388
"type": "markdown",
373-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/EthInterface.md"
389+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/UDPSocket.md"
374390
},
375391
{
376392
"type": "markdown",
377-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/WifiInterface.md"
393+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/TCPSocket.md"
378394
},
379395
{
380396
"type": "markdown",
381-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/CellularInterface.md"
397+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/TCPServer.md"
382398
},
383399
{
384400
"type": "markdown",
385-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/MeshInterface.md"
386-
},
387-
{
401+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/SocketAddress.md"
402+
}
403+
]
404+
},
405+
{
406+
"title": "Network Interfaces",
407+
"intro": {
408+
"type": "markdown",
409+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/networkinterface.md"
410+
},
411+
"sources": [{
388412
"type": "markdown",
389-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/UDPSocket.md"
413+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/EthInterface.md"
390414
},
391415
{
392416
"type": "markdown",
393-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/TCPSocket.md"
417+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/WifiInterface.md"
394418
},
395419
{
396420
"type": "markdown",
397-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/TCPServer.md"
421+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/CellularInterface.md"
398422
},
399423
{
400424
"type": "markdown",
401-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/SocketAddress.md"
425+
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/networksocket/MeshInterface.md"
402426
}
403427
]
404428
},
@@ -436,15 +460,7 @@
436460
},
437461
{
438462
"title": "LoRaWAN",
439-
"intro": {
440-
"type": "markdown",
441-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/lorawan/lora.md"
442-
},
443463
"sources": [{
444-
"type": "markdown",
445-
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/lorawan/intro-to-lora.md"
446-
},
447-
{
448464
"type": "markdown",
449465
"url": "https://github.com/ARMmbed/Handbook/blob/new_engine/docs/reference/api/connectivity/lorawan/lorawanevents.md"
450466
},

docs/reference/api/connectivity/lorawan/lora.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/reference/api/connectivity/networksocket/CellularInterface.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,54 @@ The CellularBase provides a C++ API for connecting to the internet over a Cellul
66

77
Arm Mbed OS provides a [reference implementation of CellularBase](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html), which has more information.
88

9+
#### Cellular
10+
11+
The [CellularBase](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_base_8h_source.html) provides a C++ API for connecting to the internet over a Cellular device.
12+
13+
Arm Mbed OS provides a [reference implementation of CellularBase](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html).
14+
15+
##### Getting started
16+
17+
1. Choose an [Mbed board that supports cellular](https://os.mbed.com/platforms/?mbed-enabled=15&connectivity=1), such as the [UBLOX-C027](https://os.mbed.com/platforms/u-blox-C027/) or [MTS-DRAGONFLY](https://os.mbed.com/platforms/MTS-Dragonfly/).
18+
19+
1. Clone [`mbed-os-example-cellular`](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/). Follow the instructions in the repository.
20+
21+
1. Compile the code.
22+
1. Flash the board.
23+
24+
You see output similar to the excerpt below:
25+
26+
```
27+
mbed-os-example-cellular
28+
Establishing connection ......
29+
30+
Connection Established.
31+
TCP: connected with echo.mbedcloudtesting.com server
32+
TCP: Sent 4 Bytes to echo.mbedcloudtesting.com
33+
Received from echo server 4 Bytes
34+
35+
36+
Success. Exiting
37+
```
38+
39+
##### Basic working principles
40+
41+
You can use and extend a cellular interface in various different ways. For example,
42+
43+
- Using AT commands to control sockets in an existing IP stack built into the cellular modem.
44+
45+
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/Cell_AT.png)</span>
46+
47+
- Using a PPP (Point-to-Point Protocol) pipe to pass IP packets between an Mbed OS supported IP stack and cellular modem device.
48+
49+
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/Cell_PPP.png)</span>
50+
51+
[`mbed-os-example-cellular`](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/) uses [an easy cellular connection](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html). It depends on the modem whether the application uses PPP or AT mode. We can summarize this particular design as follows:
52+
53+
- It uses an external IP stack, such as LWIP, or on-chip network stacks such as when the modem does not support PPP.
54+
- The easy cellular connection uses standard 3GPP AT 27.007 AT commands to set up the cellular modem and to register to the network.
55+
- After registration, the driver opens a PPP pipe using LWIP with the cellular modem and connects to the internet. If AT only mode is in use, then modem-specific AT commands are used for socket data control.
56+
957
### CellularBase class reference
1058

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

docs/reference/api/connectivity/networksocket/EthInterface.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,55 @@
22

33
<span class="images">![](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_eth_interface.png)<span>EthInterface class hierarchy</span></span>
44

5-
The EthInterface provides a C++ API for connecting to the internet over Ethernet.
5+
The `EthInterface` provides a C++ API for connecting to the internet over Ethernet.
6+
By default, this class does not require any configuration. It is able to pick up the default
7+
Ethernet driver for the target and select correct network stack.
68

7-
### EthInterface class reference
8-
9-
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_eth_interface.html)
109

1110
### Usage
1211

13-
To bring up the network interface:
12+
To statically initialize the driver, create an object without passing any parameters:
13+
14+
```cpp
15+
EthernetInterface eth;
16+
```
17+
18+
Then, if the default configuration is enough, bring up the interface:
19+
20+
```cpp
21+
nsapi_error_t status = eth.connect();
22+
```
23+
24+
Now, the interface is ready to be used for [network sockets](/docs/development/reference/network-socket.html).
25+
26+
```cpp
27+
// Open a TCP socket
28+
TCPSocket socket;
29+
socket.open(&eth);
30+
31+
// Open a UDP socket
32+
UDPSocket socket;
33+
socket.open(&eth);
34+
```
1435

15-
1. Instantiate the `EthInterface` class.
16-
1. Call the `connect` function.
17-
1. Once you connect the EthInterface, you can use it as a
18-
target for opening [network sockets](/docs/development/reference/network-socket.html).
36+
### Configuration
37+
38+
For EthernetInterface, there are two possible configurations:
39+
40+
- Use DHCP for network addressing. This is the default.
41+
- Use statically configured IP addresses.
42+
43+
Refer to the API below for how to set the IP addresses by calling the `set_network()` function.
44+
45+
### Troubleshooting information
46+
47+
Network interface `connect` failure causes:
48+
1. `NSAPI_ERROR_NO_CONNECTION` indicates that Ethernet link up has failed. Check that the Ethernet connection is working.
49+
1. `NSAPI_ERROR_DHCP_FAILURE` indicates that acquiring IP address has failed. Check that the IP address configuration service is working.
50+
51+
### EthInterface class reference
52+
53+
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_eth_interface.html)
1954

2055
### EthInterface examples
2156

docs/reference/api/connectivity/networksocket/MeshInterface.md

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,92 @@
1-
<h2 id="mesh-api">Mesh</h2>
1+
<h2 id="mesh-api">6LoWPAN Mesh</h2>
22

33
<span class="images">![](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_mesh_interface.png)<span>MeshInterface class hierarchy</span></span>
44

5-
The Arm Mbed mesh API allows the application to use the IPv6 mesh network topologies through the [nanostack](/docs/development/reference/technology.html#nanostack) networking stack.
5+
#### 6LoWPAN Mesh Interfaces
6+
7+
The Arm Mbed Mesh API allows the application to use the IPv6 mesh network topologies through the [Nanostack](/docs/v5.7/tutorials/mesh.html#nanostack) networking stack.
8+
9+
Mbed OS provides two types of IPv6 based mesh networks:
10+
11+
- 6LoWPAN_ND, loosely following the Zigbee-IP specification.
12+
- Thread, following the specification from Thread Group.
13+
14+
Nanostack is the networking stack that provides both of these protocols. For more information on the stack internals, please refer to the [Nanostack documentation](/docs/v5.7/tutorials/mesh.html#nanostack). Application developers use Nanostack through the Mbed Mesh API.
15+
16+
The application can use the `LoWPANNDInterface` or `ThreadInterface` object for connecting to the mesh network. When successfully connected, the application can use the Mbed C++ socket APIs to create a socket to start communication with a remote peer.
17+
18+
##### Supported mesh networking modes
19+
20+
Currently, 6LoWPAN-ND (neighbor discovery) and Thread bootstrap modes are supported.
21+
22+
##### Module configuration
23+
24+
This module supports static configuration via the **Mbed configuration system**. The application needs to create an `mbed_app.json` configuration file if you want to use other than default settings.
25+
26+
An example of the configuration file:
27+
28+
```
29+
{
30+
"target_overrides": {
31+
"*": {
32+
"target.features_add": ["IPV6"],
33+
"mbed-mesh-api.6lowpan-nd-channel": 12,
34+
"mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<12)",
35+
"mbed-mesh-api.heap-size": 10000
36+
}
37+
}
38+
}
39+
```
40+
41+
**Configurable parameters in the `mbed-mesh-api` section**
42+
43+
| Parameter name | Value | Description |
44+
| --------------- | ------------- | ----------- |
45+
| `heap-size` | number [0-0xfffe] | Nanostack's internal heap size |
46+
47+
**Thread related configuration parameters**
48+
49+
| Parameter name | Value | Description |
50+
| --------------- | ------------- | ----------- |
51+
| `thread-pskd` | string [6-255 chars] | Human-scaled commissioning credentials. |
52+
| `thread-use-static-link-config` | boolean | True: Use the below link config, False: Use commissioning, ignore the below link config. |
53+
| `thread-device-type` | enum from `mesh_device_type_t` | Supported device operating modes:<br> `MESH_DEVICE_TYPE_THREAD_ROUTER`<br> `MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE`<br> `MESH_DEVICE_TYPE_THREAD_MINIMAL_END_DEVICE` |
54+
| `thread-config-channel-mask` | number [0-0x07fff800] | Channel mask, 0x07fff800 scans all channels. |
55+
| `thread-config-channel-page` | number [0]| Channel page, 0 for 2,4 GHz radio. |
56+
| `thread-config-channel` | number [11-26] | RF channel to use. |
57+
| `thread-config-panid` | number [0-0xFFFF] | Network identifier. |
58+
| `thread-config-network-name` | string [1-16] |
59+
| `thread-config-commissioning-dataset-timestamp` | [0-0xFFFFFFFFFFFFFFFF] | [48 bit timestamp seconds]-[15 bit timestamp ticks]-[U bit] |
60+
| `thread-config-extended-panid` | byte array [8] | Extended PAN ID. |
61+
| `thread-master-key` | byte array [16]| Network master key. |
62+
| `thread-config-ml-prefix` | byte array [8] | Mesh local prefix. |
63+
| `thread-config-pskc` | byte array [16] | Pre-Shared Key for the Commissioner. |
64+
| `thread-security-policy` | number [0-0xFF] | Commissioning security policy bits. |
65+
66+
**6LoWPAN related configuration parameters**
67+
68+
| Parameter name | Type | Description |
69+
| --------------- | ---------| ----------- |
70+
| `6lowpan-nd-channel-mask` | number [0-0x07fff800] | Channel mask, bit-mask of channels to use. |
71+
| `6lowpan-nd-channel-page` | number [0, 2] | 0 for 2,4 GHz and 2 for sub-GHz radios. |
72+
| `6lowpan-nd-channel` | number [0-26] | RF channel to use when `channel_mask` is not defined. |
73+
| `6lowpan-nd-panid-filter` | number [0-0xffff] | Beacon PAN ID filter, 0xffff means no filtering. |
74+
| `6lowpan-nd-security-mode` | "NONE" or "PSK" | To use either no security, or Pre shared network key. |
75+
| `6lowpan-nd-psk-key-id` | number | PSK key ID when PSK is enabled. |
76+
| `6lowpan-nd-psk-key` | byte array [16] | Pre-Shared network key. |
77+
| `6lowpan-nd-sec-level` | number [1-7] | Network security level. Use default `5`. |
78+
| `6lowpan-nd-device-type` | "NET_6LOWPAN_ROUTER" or "NET_6LOWPAN_HOST" | Device mode. Router is routing packets from other device, creating a mesh network. |
79+
80+
**Network connection states**
81+
82+
After the initialization, the network state is `MESH_DISCONNECTED`. After a successful connection, the state changes to `MESH_CONNECTED` and when disconnected from the network the state is changed back to `MESH_DISCONNECTED`.
83+
84+
In case of connection errors, the state is changed to some of the connection error states. In an error state, there is no need to make a `disconnect` request and the application is allowed to attempt connecting again.
85+
86+
##### Getting started
87+
88+
See the example application [mbed-os-example-mesh-minimal](https://github.com/ARMmbed/mbed-os-example-mesh-minimal) for usage.
689

7-
**Tips:**
8-
- The mesh API supports 6LoWPAN-ND (neighbor discovery) and Thread bootstrap modes.
9-
- The applications do not use this module directly. The applications use `LoWPANNDInterface`, `ThreadInterface` or `NanostackEthernetInterface` directly.
10-
- When using an Ethernet interface, there are no configuration options available. It is using the dynamic mode to learn the IPv6 prefix from the network.
1190

1291
### Mesh class reference
1392

0 commit comments

Comments
 (0)