This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to check the nRF is connected with MQTT broker or not?

Hi,
I am facing an issue, I am developing nRF9160 based Product, get sensor data  from peripherals and publish to AWS cloud.my firmware is based on AWS IoT sample. I observed that some time devices get disconnected from AWS.I missed the sensor data during that period.
1.Now I want to save data into SD card  during  that disconnected period.? So I need find Exact point in my application which shows that it is disconnected so I log data into SD card.
2.Once if I done it successfully, log the data then I want to send this file to AWS over MQTT when it again connected?

if I place check on shadow_update ( .So for test purpose I remove the antenna from Device while application is running .its Still updating the Shadow(although message not reached on AWS ).how to kill this issue?

static void shadow_update_work_fn(struct k_work *work)
{
int err;

err = shadow_update(false);
if (err) {
printk("shadow_update, error: %d\n", err);
}

printk("Next data publication in %d seconds\n", publication_interval_seconds);

k_delayed_work_submit(&shadow_update_work, K_SECONDS( publication_interval_seconds));
}




Thanks 

Parents Reply Children
Related