The Breakout SDK for Massive IoT enables developers to exchange data between low-powered devices and their services running in the cloud. The SDK abstracts complex elements of Narrowband IoT (NB-IoT) deployment and removes development barriers by handling tasks such as network registration on your behalf.
The SDK is built to be cross-platform. It currently supports three modems: the u-blox SARA-R410 and SARA-N410 and the Quectel BG96 . The SDK supports sending data over TCP and UDP, and using the modems' internal MQTT and TLS implementations.
The SDK repository can be downloaded from GitHub.
First, a few platform-specific functions need to be implemented as is described in the porting section of the Read Me. After that you can write the code in either blocking or non-blocking style (see the example).
If you are working in multithreaded environment, please note that the Breakout SDK is not thread-safe, so it should either be owned by a single thread, or protected by a mutex.
1#include "modem/OwlModemBG96"23OwlModemBG96 *modem;4int socket;56void init(MySerialInterface* interface) {7modem = new OwlModemBG96(interface)l89modem->initModem();10modem->waitForNetworkRegistration();1112modem->mqtt.openConnection("my.mqtt.broker", 1883);13modem->mqtt.login("BG96 Device", nullptr, nullptr);14modem->mqtt.subscribe("some_topic", 1);15}1617void on_message(str topic, str message) {18// process incoming message19}2021void do_work() {22str buf;23buf.s = new char[512];24buf.len = 0;25for (;;) {26// publish data27if (should_send) {28modem->mqtt.publish("another_topic",29{.s = ..., .len = ...});30}31}32}
1#include "modem/OwlModemRN4"23OwlModemRN4 *modem;4int socket;56void init(MySerialInterface* interface) {7modem = new OwlModemRN4(interface)l89modem->initModem();10modem->waitForNetworkRegistration("test");1112modem->socket.open(AT_USO_Protocol__UDP, OUT_PORT, &socket);13}1415void do_work() {16str buf;17buf.s = new char[512];18buf.len = 0;19for (;;) {20// receive part21modem->socket.receiveUDP(socket, 512, &buf, 512);22if (buf.len != 0) {23// received data, process it24}2526// transmit part27if (should_send) {28int sent;29modem->socket.sendUDP(socket, {.s = ..., .len = ...}, &sent);30}31}32}33}