-
Notifications
You must be signed in to change notification settings - Fork 178
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fac2771
Cellular: Documenting the support for Non-IP data delivery feature
38ecd70
Edit CellularNonIPSocket.md
3ec8229
Edit networksocket.md
56ef0f2
Edit connectivity.md
b678536
Update CellularNonIPSocket.md
303292f
Update networksocket.md
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
lauri-piikivi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
|
||
[](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; | ||
} | ||
|
||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.