Skip to content

Cellular: Documenting the support for Non-IP data delivery feature #928

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 6 commits into from
Feb 20, 2019
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
88 changes: 88 additions & 0 deletions docs/api/networksocket/CellularNonIPSocket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
## Non-IP cellular socket

The CellularNonIPSocket class provides, through standard socket `send` and `recv` member functions, the ability to send and receive 3GPP non-IP datagrams (NIDD) using our cellular IoT feature. This feature is implemented in the [`ControlPlane_netif`](https://os.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_control_plane__netif.html) class.

The constructor takes no parameters. To initialize the socket on a specified NetworkInterface, you must call the `open` method, which takes a CellularContext pointer.

[`CellularContext`](https://os.mbed.com/docs/development/mbed-os-api-doxy/_cellular_context_8h.html) sets up the modem into the Control Plane optimization mode of operation if it is requested and if the cellular network supports it.

Control plane optimization is a new feature for cellular IoT (CIoT). With it, the device can use cellular control channels for data communications, to save power and resources by using less radio signaling.

Note: <span class="notes">**Note:** Non-IP use usually requires integration to a cellular operator messaging service. The service supports a web API to send to and receive the non-IP using devices.</span>

You can request Control Plane optimization mode either with CellularDevice's [`create_context`](https://os.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_cellular_device.html#a43b9e992dff1cb5d880acec576e9d06f) or by configuring it in the cellular `mbed_lib.json`:

```json
{
"name": "cellular",
"config": {
"control-plane-opt": {
"help": "Enables control plane CIoT EPS optimisation",
"value": true
}
}
}
```

### CellularNonIPSocket class reference

[![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)

The following code demonstrates how to create and use a cellular non-IP socket:

```

#include "mbed.h"
#include "CellularNonIPSocket.h"
#include "CellularDevice.h"

// Network interface
NetworkInterface *iface;

int main() {
// Bring up the cellular interface
iface = CellularContext::get_default_nonip_instance();
MBED_ASSERT(iface);

// sim pin, apn, credentials and possible plmn are taken automatically from json when using NetworkInterface::set_default_parameters()
iface->set_default_parameters();

printf("Cellular Non-IP Socket example\n");
if(NSAPI_ERROR_OK != iface->connect() || NSAPI_STATUS_GLOBAL_UP != iface->get_connection_status()) {
printf("Error connecting\n");
return -1;
}

CellularNonIPSocket sock;

nsapi_error_t retcode = sock.open((CellularContext*)iface);

if (retcode != NSAPI_ERROR_OK) {
printf("CellularNonIPSocket.open() fails, code: %d\n", retcode);
return -1;
}

const char *send_string = "TEST";

if(0 > sock.send((void*) send_string, sizeof(send_string))) {
printf("Error sending data\n");
return -1;
}

printf("Success sending data\n");

char recv_buf[4];
if(0 > sock.recv((void *)recv_buf, sizeof(recv_buf))) {
printf("Error receiving data\n");
return -1;
}

printf("Success receiving data\n");

// Close the socket and bring down the network interface
sock.close();
iface->disconnect();
return 0;
}

```
3 changes: 2 additions & 1 deletion docs/api/networksocket/networksocket.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2 id="network-socket">Network socket overview</h2>

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.
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.

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

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

Expand Down
15 changes: 15 additions & 0 deletions docs/reference/configuration/Connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ Name: cellular.use-apn-lookup
Defined by: library:cellular
Macro name: MBED_CONF_CELLULAR_USE_APN_LOOKUP
Value: 1 (set by library:cellular)
Name: cellular.debug-at
Description: Enable AT debug prints
Defined by: library:cellular
Macro name: MBED_CONF_CELLULAR_DEBUG_AT
Value: 0 (set by library:cellular)
Name: cellular.radio-access-technology
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
Defined by: library:cellular
Macro name: MBED_CONF_CELLULAR_RADIO_ACCESS_TECHNOLOGY
Value: null (set by library:cellular)
Name: cellular.control-plane-opt
Description: Enables control plane CIoT EPS optimisation
Defined by: library:cellular
Macro name: MBED_CONF_CELLULAR_CONTROL_PLANE_OPT
Value: 0 (set by library:cellular)
Name: ppp-cell-iface.apn-lookup
Defined by: library:ppp-cell-iface
Macro name: MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP
Expand Down
10 changes: 8 additions & 2 deletions docs/reference/technology/connectivity/connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ For IP devices:
* NB-IoT.
* Bluetooth Low Energy (BLE).

Non-IP devices require a gateway:
Non-IP devices:

* LoRaWAN.
* Cellular.

### Choosing your connectivity method

Expand Down Expand Up @@ -92,7 +93,6 @@ Because of its long range (up to 20 km) and low power, it is suitable for low da

The [LoRa](lora-tech.html) section and [LoRa tutorial](../tutorials/LoRa-tutorial.html) describe LoRA networking.


#### NFC

<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/n_mark.png)<span>NFC</span></span>
Expand All @@ -101,6 +101,12 @@ Near-field communication (NFC) is a short range (few centimeters) wireless techn

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

#### NB-IoT cellular

Non-IP Data Delivery (NIDD) is a new feature for communication over NB-IoT. It is enabled by Control Plane cellular IoT 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.

To learn how to use this feature with Mbed OS, please refer to [CellularNonIPSocket](../apis/cellularnonipsocket.html).

#### Memory needs for Pelion-connected devices

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:
Expand Down