how can i send a 100 or 500 bytes Payload from nRF9160 to Leshan server?

Hello,

i had a look at lwm2m_client_sample and it worked pretty well. Now my next step is to be able to send for example a 100 or 500 Bytes Payload from nRf9160 to Leshan server.

Since i am a new comer, i don't really know how to go about it.

Questions:

1. Is it possible in the first place to be able to send payload data to leshan server?

2. When yes. How can i go about it? 

3. When no. Is there any alternative of sending payload data using lwm2m?

I will be glad, if someone could help me.

best regards

Cedric

  • Hi,

    Could you clarify a bit more what you actually want to accomplish?

    LwM2M have defined a lot of objects, that you can update the value of. It would therefore usually be more natural to update the relevant objects, than send a big blob of data.

    So there isn't really a "lwm2m_send()" function, but instead there are functions for updating an object, or the instances of an object.

    That said, there is a function for setting a resource to an opaque buffer, so if that is what you really want, it is possible.

    Best regards,

    Didrik

  • Hi Didrik,

    thanks for your reply and your explanations.

    Actually i want to be able to send a TLV Payload for example of firmware updates device.

    After that i want my nRF9160 to be in a sleep mode without the server acknowledging that he got the Payload and after 10mins my nRF9160 sends a Ping message and then sends a TLV payload again.

    That's what i am trying to accomplish.

    Which brings again these questions:

    1.Should we only send values of the defined objects or could we create an object ourself and then asign it a value or values?

    2. When yes. How may i go about it?

    Best regards

    Cedric

  • Hi Didrik,

    please can i also know, what these functions for updating objects and the instances of the object or the resources of the object are?

    Best regards,

    Cedric

  • ced27 said:

    Actually i want to be able to send a TLV Payload for example of firmware updates device.

    After that i want my nRF9160 to be in a sleep mode without the server acknowledging that he got the Payload and after 10mins my nRF9160 sends a Ping message and then sends a TLV payload again.

    I still don't quite feel like I understand what you want to do. But we are just talking about sending data from the device to the cloud every 10 minutes?

    If I've understood LwM2M correctly, you cannot really "send" something from the device to the cloud. Instead, the cloud must observe an object/instance/resource, and then the device will update the cloud every time the object/instance/resource is updated. You can then use the functions declared in zephyr/include/net/lwm2m.h to set the value of the object/instance/resource.

    As for what objects to use, I would recommend that you try to use the standardized objects as much as possible.

    You might also want to take a look at the lwm2m_client_utils library: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/networking/lwm2m_client_utils.html

  • Hi Didrik,

    Actually what i am trying to do is initiating the LwM2M Client to send data to the LwM2M Server without explicit request by that Server.

    That means i don't want the server to request before the client can send updates. Meaning sending data (sending updates) should be client initiated, not server initiated.

Related