Skip to content

NBMQTT is a new class for the MKRNB library to use the internal MQTT functionality of the SARA R410 modem

Notifications You must be signed in to change notification settings

CptHolzschnauz/MKRNB

This branch is 47 commits ahead of, 34 commits behind arduino-libraries/MKRNB:master.

Repository files navigation

MKRNB SARA R410 Internal MQTT Functionality Class Library for Arduino MKR 1500

This library enables an Arduino MKR NB 1500 board to connect to the internet over a NarrowBand IoT or LTE Cat M1 network. This new class makes it possible to use the internal MQTT functionality of the SARA R410 modem instead of a software on the MCU for convenient MQTT.

Save memory and let the modem firmware do the MQTT!

UNDER CONSTRUCTION!! BETA! NOT FINISHED! CONTRIBUTE IF YOU CAN! Check the example.

Done: Constructor: Example: NBMqtt mqtt;

getMQTTerror Get the last MQTT error from the modem.Example: mqtt.getMQTTerror();

setMQTTClientID Set the MQTT client ID : Example(With SIM IMEI): mqtt.setMQTTClientID("352753090834234");

setMQTTPort(Int): Set the clients MQTT Port (Normally not enrcypted is 1883, SSL is 8883. Example: mqtt.setMQTTPort(1883);

setMQTTUserPassword(String, String): Set Username / Password for the MQTT broker. Example: mqtt.setMQTTUserPassword("username", "password");

setMQTTbrokerURL(String): Set the MQTT broker URL (DNS is made automatic). Example: mqtt.setMQTTBrokerURL("public.cloud.shiftr.io");

setMQTTbrokerIP(String, (Optional Int)): Set the MQTT broker IP and optional port number.Example: mqtt.setMQTTBrokerIP("3.122.54.81");orwith port number mqtt.setMQTTBrokerIP("3.122.54.81",15458);

setMQTTBrokerConnect(bool): Connect / Disconnect to the MQTT broker. Example: mqtt.setMQTTBrokerConnect(true); to connect, mqtt.setMQTTBrokerConnect(false); to disconnect

sendMQTTMsg(String, String): Send a MQTT message to a topic. Example: mqtt.sendMQTTMsg("/TestTopic", "TestMessage");

setMQTTSubscribe(String): Subscribe to a topic. Example: setMQTTSubscribe("TestTopic");

setMQTTConfig(int): Save, restore and restore(factory settings) MQTT setting to/from the NVRam of the modem. Example: Save config to NVRam: mqtt.setMQTTConfig(2);, Load config from the NVRam mqtt.setMQTTConfig(1); Restore factory settings: mqtt.setMQTTConfig(0)

To do:

Read out MQTT messages

Set Timeouts

Set last will

SSL is not possible because MQTTS is NOT supported by UBlox…​

License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

About

NBMQTT is a new class for the MKRNB library to use the internal MQTT functionality of the SARA R410 modem

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 53.5%
  • C 46.5%