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

Need to access the data sent from the NRF_Cloud to Thingy91 device

Hi Dev Team,

I am building an application wherein I need to send commands from the Cloud to a Thingy91 device. I tried out the cloud_client sample and I was able to send a JSON string from the terminal of the Nrfcloud to my device and it was received through the CLOUD_EVT_DATA_RECEIVED: event. 

I wanted to know how I could parse this data (use this data) that I have sent (or) store this data that I am sending from the Cloud in a variable or array that I could use.

I basically need the data that I send through the Cloud to enable a different feature of my code. So my intention is to be able to access the data that I am sending from the cloud.

I did not find any relevant samples to sending commands from Cloud to the device, so needed a bit of help in understanding how to parse the data.

Regards,

Adeel.

Parents
  • Hello,

     

    I wanted to know how I could parse this data (use this data) that I have sent (or) store this data that I am sending from the Cloud in a variable or array that I could use.

     Have you looked at the cJSON library? It is used in the AWS IoT sample to parse JSON objects. Perhaps you could use it in similar fashion in your application.

  • Hi, Yes I used the cJSON library to make my data. I also sent it through the nrf cloud terminal and was able to receive it in my lte device. 

    I also received some other data along with my sent data as seen in the previous image, and I was unsure what it was. 

    Its something like this attached after my data :  

    {"d2c":"prod/318e3ece-4317-46a6-adc0-ab4e06f69556/m/d/nrf-352656100371429/d2c","c2d":"prod/318e3ece-4317-46a6-adc0-ab4e06f69556/m/d/nrf-352656100371429/c2d"}},
            "nrfcloud_mqtt_topic_prefix":"prod/318e3ece-4317-46a6-adc0-ab4e06f69556/"},
        config":{"GPS":{"enable":true}}}

    I think its automatically from the cloud_client example. I was unable to trace where this data could come from in the NRF Cloud. Could you let me know what that data is and where could I find the source of it on the cloud. 

    Then I could use some parsing techniques from the cjson library to get my data out.

    Regards,

    Adeel.

  • Adeel said:
    I also received some other data along with my sent data as seen in the previous image, and I was unsure what it was. 

     It is from the device shadow. You can ignore it, they are not related to your messages.

Reply Children
No Data
Related