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.
_32#include "modem/OwlModemBG96"_32_32OwlModemBG96 *modem;_32int socket;_32_32void init(MySerialInterface* interface) {_32 modem = new OwlModemBG96(interface)l_32_32 modem->initModem();_32 modem->waitForNetworkRegistration();_32_32 modem->mqtt.openConnection("my.mqtt.broker", 1883);_32 modem->mqtt.login("BG96 Device", nullptr, nullptr);_32 modem->mqtt.subscribe("some_topic", 1);_32}_32_32void on_message(str topic, str message) {_32 // process incoming message_32}_32_32void do_work() {_32 str buf;_32 buf.s = new char[512];_32 buf.len = 0;_32 for (;;) {_32 // publish data_32 if (should_send) {_32 modem->mqtt.publish("another_topic",_32 {.s = ..., .len = ...});_32 }_32 }_32}
_33#include "modem/OwlModemRN4"_33_33OwlModemRN4 *modem;_33int socket;_33_33void init(MySerialInterface* interface) {_33 modem = new OwlModemRN4(interface)l_33_33 modem->initModem();_33 modem->waitForNetworkRegistration("test");_33_33 modem->socket.open(AT_USO_Protocol__UDP, OUT_PORT, &socket);_33}_33_33void do_work() {_33 str buf;_33 buf.s = new char[512];_33 buf.len = 0;_33 for (;;) {_33 // receive part_33 modem->socket.receiveUDP(socket, 512, &buf, 512);_33 if (buf.len != 0) {_33 // received data, process it_33 }_33_33 // transmit part_33 if (should_send) {_33 int sent;_33 modem->socket.sendUDP(socket, {.s = ..., .len = ...}, &sent);_33 }_33 }_33 }_33}