I am collecting data with Arduino MKR GSM 1400 and sending data to Azure Cloud (IOT HUB). Currently I use ArduinoMqttClient ArduinoMqttClient
My question is, how to ensure both parties accepted QoS1 ? Is there any logging (in serial monitor) to see confirmation about delivery, re-transmit and so on? I did not find how to enable logging or whether azure on the other side accept the settings and they communicate each other for QoS 1.
Here is sample of code for publishing in ArduinoMqttClient:
Serial.println("Publishing message"); bool retained = false; int qos = 1; bool dup = false; String payload; payload += "hello"; payload += " "; payload += millis(); payload += " "; payload += cont++; // send message, the Print interface can be used to set the message contents mqttClient.beginMessage(outTopic, payload.length(), retained, qos, dup); mqttClient.print(payload); mqttClient.endMessage();
Here is sample of code for subscribe in ArduinoMqttClient:
Serial.print("Subscribing to topic: "); // subscribe to a topic // the second parameter set's the QoS of the subscription, // the the library supports subscribing at QoS 0, 1, or 2 int subscribeQos = 1; mqttClient.subscribe(inTopic, subscribeQos);