Work with the Breakout SDK for Narrowband


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.


Download the SDK

The SDK repository can be downloaded from GitHub.


Using the Massive IoT SDK on your device

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.

Working with Massive SDK - BG96

#include "modem/OwlModemBG96"

OwlModemBG96 *modem;
int socket;

void init(MySerialInterface* interface) {
  modem = new OwlModemBG96(interface)l

  modem->initModem();
  modem->waitForNetworkRegistration();

  modem->mqtt.openConnection("my.mqtt.broker", 1883);
  modem->mqtt.login("BG96 Device", nullptr, nullptr);
  modem->mqtt.subscribe("some_topic", 1);
}

void on_message(str topic, str message) {
  // process incoming message
}

void do_work() {
  str buf;
  buf.s = new char[512];
  buf.len = 0;
  for (;;) {
    // publish data
    if (should_send) {
      modem->mqtt.publish("another_topic",
                          {.s = ..., .len = ...});
    }
  }
}

Working with Massive SDK - SARA-R410/SARA-N10

#include "modem/OwlModemRN4"

OwlModemRN4 *modem;
int socket;

void init(MySerialInterface* interface) {
  modem = new OwlModemRN4(interface)l

  modem->initModem();
  modem->waitForNetworkRegistration("test");

  modem->socket.open(AT_USO_Protocol__UDP, OUT_PORT, &socket);
}

void do_work() {
  str buf;
  buf.s = new char[512];
  buf.len = 0;
  for (;;) {
    // receive part
    modem->socket.receiveUDP(socket, 512, &buf, 512);
    if (buf.len != 0) {
      // received data, process it
    }

    // transmit part
    if (should_send) {
      int sent;
      modem->socket.sendUDP(socket, {.s = ..., .len = ...}, &sent);
    }
    }
  }
}

Last updated