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)
SSL is not possible because MQTTS is NOT supported by UBlox…