Skip to content

Commit fac2771

Browse files
author
Mirela Chirica
committed
Cellular: Documenting the support for Non-IP data delivery feature
1 parent f1934a0 commit fac2771

File tree

4 files changed

+113
-2
lines changed

4 files changed

+113
-2
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
## Non-IP cellular socket
2+
3+
The CellularNonIPSocket class provides, through standard socket send and recv member functions, the ability to send and receive 3GPP Non-IP datagrams (NIDD) using Cellular IoT feature. This feature is implemented in [`ControlPlane_netif`](https://os.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_control_plane__netif.html) class.
4+
5+
The constructor takes no parameters. To initialize the socket on a specified NetworkInterface, you must call `open` method, which takes a CellularContext pointer.
6+
7+
[`CellularContext`](https://os.mbed.com/docs/development/mbed-os-api-doxy/_cellular_context_8h.html) is setting up the modem into the Control Plane optimisation mode of operation if it is requested and cellular network supports it.
8+
9+
Control plane optimisations is a new feature for Cellular IoT (CIoT), where the device can use cellular control channels for data communications, to save power and resources as there is less radio singling needed.
10+
11+
NOTE! Non-IP usage usually requires integration to cellular operator messaging service. The service supports a web API to send and receive to the non-IP using devices.
12+
13+
14+
Control Plane optimisation mode can be requested either on CellularDevice's [`create_context`](https://os.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_cellular_device.html#a43b9e992dff1cb5d880acec576e9d06f) or configured in cellular mbed_lib.json:
15+
16+
```json
17+
{
18+
"name": "cellular",
19+
"config": {
20+
"control-plane-opt": {
21+
"help": "Enables control plane CIoT EPS optimisation",
22+
"value": true
23+
}
24+
}
25+
}
26+
```
27+
ControlPlane
28+
### CellularNonIPSocket class reference
29+
30+
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_cellular_non_i_p_socket.html)
31+
32+
The following code demonstrates how to create and use a cellular Non-IP socket:
33+
```
34+
35+
#include "mbed.h"
36+
#include "CellularNonIPSocket.h"
37+
#include "CellularDevice.h"
38+
39+
// Network interface
40+
NetworkInterface *iface;
41+
42+
int main() {
43+
// Bring up the cellular interface
44+
iface = CellularContext::get_default_nonip_instance();
45+
MBED_ASSERT(iface);
46+
47+
// sim pin, apn, credentials and possible plmn are taken automatically from json when using NetworkInterface::set_default_parameters()
48+
iface->set_default_parameters();
49+
50+
printf("Cellular Non-IP Socket example\n");
51+
if(NSAPI_ERROR_OK != iface->connect() || NSAPI_STATUS_GLOBAL_UP != iface->get_connection_status()) {
52+
printf("Error connecting\n");
53+
return -1;
54+
}
55+
56+
CellularNonIPSocket sock;
57+
58+
nsapi_error_t retcode = sock.open((CellularContext*)iface);
59+
60+
if (retcode != NSAPI_ERROR_OK) {
61+
printf("CellularNonIPSocket.open() fails, code: %d\n", retcode);
62+
return -1;
63+
}
64+
65+
const char *send_string = "TEST";
66+
67+
if(0 > sock.send((void*) send_string, sizeof(send_string))) {
68+
printf("Error sending data\n");
69+
return -1;
70+
}
71+
72+
printf("Success sending data\n");
73+
74+
char recv_buf[4];
75+
if(0 > sock.recv((void *)recv_buf, sizeof(recv_buf))) {
76+
printf("Error receiving data\n");
77+
return -1;
78+
}
79+
80+
printf("Success receiving data\n");
81+
82+
// Close the socket and bring down the network interface
83+
sock.close();
84+
iface->disconnect();
85+
return 0;
86+
}
87+
88+
```

docs/api/networksocket/networksocket.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h2 id="network-socket">Network socket overview</h2>
22

3-
The application programming interface for IP networking is the Socket API. As described in the [IP networking](../reference/ip-networking.html) section, the Socket API relates to OSI layer 4, the Transport layer. In Mbed OS, the Socket API supports both TCP and UDP protocols.
3+
The application programming interface for IP networking is the Socket API. As described in the [IP networking](../reference/ip-networking.html) section, the Socket API relates to OSI layer 4, the Transport layer. In Mbed OS, the Socket API is abstract and supports various protocols such as TCP, UDP and Non-IP data delivery for NB-IoT cellular networks.
44

55
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/ip-networking.png)<span>Sockets</span></span>
66

@@ -97,6 +97,7 @@ The network socket API provides a common interface for using sockets on network
9797
- [UDPSocket](udpsocket.html): This class provides the ability to send packets of data over UDP.
9898
- [TCPSocket](tcpsocket.html): This class provides the ability to send a stream of data over TCP.
9999
- [SocketAddress](socketaddress.html): You can use this class to represent the IP address and port pair of a unique network endpoint.
100+
- [CellularNonIPSocket](cellularnonipsocket.html): This class provides the ability to send and receive 3GPP Non-IP datagrams (NIDD) using Cellular IoT feature.
100101
- [Network status](network-status.html): API for monitoring network status changes.
101102
- [DNS resolver](dns-resolver.html): API for resolving DNS names
102103

docs/reference/configuration/Connectivity.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,21 @@ Name: cellular.use-apn-lookup
157157
Defined by: library:cellular
158158
Macro name: MBED_CONF_CELLULAR_USE_APN_LOOKUP
159159
Value: 1 (set by library:cellular)
160+
Name: cellular.debug-at
161+
Description: Enable AT debug prints
162+
Defined by: library:cellular
163+
Macro name: MBED_CONF_CELLULAR_DEBUG_AT
164+
Value: 0 (set by library:cellular)
165+
Name: cellular.radio-access-technology
166+
Description: Radio access technology to use. Value in integer: GSM=0, GSM_COMPACT=1, UTRAN=2, EGPRS=3, HSDPA=4, HSUPA=5, HSDPA_HSUPA=6, E_UTRAN=7, CATM1=8 ,NB1=9
167+
Defined by: library:cellular
168+
Macro name: MBED_CONF_CELLULAR_RADIO_ACCESS_TECHNOLOGY
169+
Value: null (set by library:cellular)
170+
Name: cellular.control-plane-opt
171+
Description: Enables control plane CIoT EPS optimisation
172+
Defined by: library:cellular
173+
Macro name: MBED_CONF_CELLULAR_CONTROL_PLANE_OPT
174+
Value: 0 (set by library:cellular)
160175
Name: ppp-cell-iface.apn-lookup
161176
Defined by: library:ppp-cell-iface
162177
Macro name: MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP

docs/reference/technology/connectivity/connectivity.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ For IP devices:
1212
* NB-IoT.
1313
* Bluetooth Low Energy (BLE).
1414

15-
Non-IP devices require a gateway:
15+
Non-IP devices:
1616

1717
* LoRaWAN.
18+
* Cellular.
1819

1920
### Choosing your connectivity method
2021

@@ -101,6 +102,12 @@ Near-field communication (NFC) is a short range (few centimeters) wireless techn
101102

102103
To learn how to use NFC with Mbed OS, please refer to the [Mbed OS NFC overview](../apis/nfc.html).
103104

105+
#### NB-IoT Cellular
106+
107+
Non-IP Data Delivery(NIDD) is a new feature for communication over NB-IoT. It is enabled by Control Plane CIoT EPS optimization and meant to provide improved support of small data transfer. It does this by transporting user data over the control channel, thus reducing the total number of control plane messages when handling a short data transaction.
108+
109+
To learn how to use this feature with Mbed OS, please refer to [CellularNonIPSocket](../apis/cellularnonipsocket.html).
110+
104111
#### Memory needs for Pelion-connected devices
105112

106113
Mbed OS's baseline memory footprint, without Pelion connectivity, is 2.8kb of RAM and 8.2kb of flash. When you add connectivity and full functionality, the footprint grows:

0 commit comments

Comments
 (0)