This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

AWS IoT library and access to mqtt topics

Greets,

I'm using the aws_iot library atop an nRF9160 successfully to connect and interact with AWS services. 

The aws_iot_evt_handler_t callback is triggered when messages arrive, but it is passed a pointer to struct aws_iot_evt which is of little use.

The library handles parsing of topics of interest (e.g. for FOTA) but then only calls the client code callback with the payload, whereas the, pretty crucial (at least in our application), topics are hidden away in underlying layers.

At this point, I've hacked the struct aws_iot_evt to add a pointer to the raw struct mqtt_evt, and added code in aws_iot.c mqtt_evt_handler() to actually assign it, so that in my handler I can actually do stuff with

  evt->mqtt->param.publish.message.topic

So, this solution works but is ugly, and will stop working as soon as we update the SDK.

My question is: since the aws_iot is gobbling up and masking the topics, there must be some mechanism that I am not seeing--what is it?  What is the recommended approach for using aws_iot while actually leveraging the full spectrum of MQTT functions, namely get ahold of topics?

Thanks,

P

Parents Reply Children
Related