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

Parents
  • 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

Reply
  • 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

Children
  • 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.

  • I will really appreciate if you can help me with this issue

  • At the moment, it is not possible to send something from the client without the server either reading or observing the resource.

    However, once the server has started to observe a resource, the device can send updates without the server sending something for each time.

    Is there a reason observing a resource isn't good enough?

  • Thanks for your reply.

    Observing is not good enough because it is server initiated. My goal it is to send something from the client to server without the server reading or observing th resource (client initiated). That means the client just sends data and then enters a Power saving mode(PSM). 

    And in this mode the client is not accessible, for the server to proceed a reading or observing of the resources.

    When the client wakes up from PSM, it sends data again and the cycle continues. In this way i will be able to serve battery energy. Another reason is, it will not have to wait for the server to start reading or observing.

    Do you have any suggestions on how i may do this, may be using a broker as intermediate station? Any suggestions will be welcome.

    Best regards

Related