I have built and successfully run this application with the nRF Cloud and then I achieved a partial success with running this application with the AWS IoT.
When I run this app with the AWS IoT, I can see all relevant data sent from my nRF9160DK to the shadow topics of my thing created on AWS IoT, like the battery voltage values and time stamp values.
However, I would also like to see, in the relevant AWS IoT topics, the data sent from my nRF9160DK device that relates to button presses on the nRF9160DK device.
Apparently, the data that relates to the button presses on the nRF9160DK device should be available in the AWS IoT topic: "<imei>/messages" but there is no data that I could see in this AWS IoT topic, despite receiving without any problems the battery voltage values and time stamp values in the AWS IoT shadow topics of my thing created on the AWS IoT.
According to the info in the nRF9160DK Get Started guide, in order to subscribe to non AWS specific topics, you need to:
1. Specify the number of additional topics that needs to be subscribed to, by setting the option: CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT. (I can see that this option is already set to: 3).
2. Pass a list containing application-specific topics in the function: aws_iot_subscription_topics_add() , after the function call: aws_iot_init() and before the function call: aws_iot_connect().
From my analysis of the file: aws_iot_integration.c that is located in: asset_tracker_v2\src\cloud\aws_iot_integration.c , it appears that the topic: "<imei>/messages" is already included in the list of topics to which my nRF9160DK device will publish the relevant data.
I found a section of code in the main.c source file for sample: AWS-IoT that I consider to use in the app: Asset Tracker v2, in order to be able to subscribe to non AWS specific topics on AWS IoT, while running the app: Asset Tracker v2 with AWS IoT. (I attach a copy of the section of code from the source file main.c for the sample:AWS-IoT).
I have two questions:
1. Is the non AWS specific topic the same as the application specific topic?
2. If I need to insert the section of code from the main.c of the sample: AWS-IoT to the main.c of the app: Asset Tracker v2 (in order to be able to see the data in the AWS IoT topic: <imei>/messages) , where exactly shall I insert this section of code in the main.c source file for app: Asset Tracker v2 (or may be in another source .c file for this app)?
Regards,
JM