Mqtt notes

From Wiki at Neela Nurseries
Revision as of 07:54, 15 December 2021 by Ted (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Notes on MQTT

Looks like in Nordic Semi's aws_iot sample app, the following enumerated events represent a firmware instance receiving subscribed messages from an MQTT broker:

- 1108 DEV - aws_iot event handler called,
AWS_IOT_EVT_READY
- 1108 DEV - aws_iot event handler called,
AWS_IOT_EVT_DATA_RECEIVED

s3://iot-poc/hello/world/

Ah, trouble when attempting to add MQTT topics:

*** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
I: Modem library is not yet initialized, AT commands not sent
I: Configuration of MAGPIO and COEX0 is left to drivers
The AWS IoT sample started, version: v1.0.0
ZZZ
ZZZ
ZZZ
ZZZ - preparing to subscribe to hello/world topic,
ZZZ
ZZZ
ZZZ - calling routine to subscribe to MQTT topics . . .
ZZZ
E: Application subscription list count mismatch
aws_iot_subscription_topics_add, error: -122
ZZZ
ZZZ
ZZZ
ZZZ
Adding application specific topics failed, error: -122
Summary of callback pointers for 'set flag' events:

Appears to come from `./nrf/subsys/net/lib/aws_iot/src/aws_iot.c:1168: LOG_ERR("Application subscription list count mismatch");`

Note 3 - code excert from `nrf/subsys/net/lib/aws_iot/src/aws_iot.c`:

 689                 if (!mqtt_evt->param.connack.session_present_flag ||
 690                     IS_ENABLED(CONFIG_MQTT_CLEAN_SESSION)) {
 691                         err = topic_subscribe();
 692 
 693                         if (err < 0) {
 694                                 aws_iot_evt.type = AWS_IOT_EVT_ERROR;
 695                                 aws_iot_evt.data.err = err;
 696                                 aws_iot_notify_event(&aws_iot_evt);
 697                                 break;
 698                         }
 699                         if (err == 0) {
 700                                 /* There were not topics to subscribe to. */
 701                                 aws_iot_evt.type = AWS_IOT_EVT_READY;
 702                                 aws_iot_notify_event(&aws_iot_evt);
 703                         } /* else: wait for SUBACK */
 704                 } else {
 705                         /* pre-existing session:
 706                          * subscription is already established.
 707                          */
 708                         aws_iot_evt.type = AWS_IOT_EVT_READY;
 709                         aws_iot_notify_event(&aws_iot_evt);
 710 
 711                         if (IS_ENABLED(


A link to review:


2021-12-14 Tue



2021-12-08

*  https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/main/demos/mqtt/mqtt_demo_basic_tls/mqtt_demo_basic_tls.c

+++

*  https://docs.aws.amazon.com/iot/latest/developerguide/topics.html


Unsorted references to MQTT:

# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/net/mqtt_publisher/README.html
# https://www.hivemq.com/blog/mqtt-essentials-part2-publish-subscribe/
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/index.html
# https://www.circuito.io/blog/arduino-code/
# https://www.hivemq.com/blog/mqtt-essentials-part-7-persistent-session-queuing-messages/
# https://www.hivemq.com/blog/mqtt-essentials-part-3-client-broker-connection-establishment/


# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/nrf/examples.html
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/nrf/ug_tfm.html#ug-tfm
# https://ci-builds.trustedfirmware.org/static-files/UxIoKYsDyPQ0ojvJOv9EX6-hZNDZd6IPGfcm05Bk1b0xNjM3MTA4NjMxODUxOjk6YW5vbnltb3VzOmpvYi90Zi1tLWJ1aWxkLWRvY3MtbmlnaHRseS9sYXN0U3RhYmxlQnVpbGQvYXJ0aWZhY3Q=/trusted-firmware-m/build/docs/user_guide/html/index.html

Nordic AWS FOTA example:

# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/nrf/samples/nrf9160/aws_fota/README.html