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

  • 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

  • ced27 said:
    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). 

    I still don't quite understand why observing doesn't fit your use case here. Except for the initial setup, everything is initiated from the client. Or doesn't the client register with the LwM2M server at all?

    If that is the case, is LwM2M really the best fit for your usecase over a pure CoAP or UDP server?

    ced27 said:
    Another reason is, it will not have to wait for the server to start reading or observing.

    This is true, but how fast after the device is online do you need to push updates? I am not convinced that this small initial delay is a big issue.

    The server should not need to observe the resource again after the device comes out of PSM.

    Anyway, I'll stop arguing now. You probably know your use case better than me Slight smile

    Currently observing the the closest you get in Zephyr's LwM2M client. LwM2M 1.1 introduces a "Send operation", which would fit your requirement, but it hasn't been implemented in Zephyr yet.

    Another option would be to not use LwM2M (at least for these updates), and just send a plain UDP/CoAP message to a listening socket on the server.

Reply
  • ced27 said:
    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). 

    I still don't quite understand why observing doesn't fit your use case here. Except for the initial setup, everything is initiated from the client. Or doesn't the client register with the LwM2M server at all?

    If that is the case, is LwM2M really the best fit for your usecase over a pure CoAP or UDP server?

    ced27 said:
    Another reason is, it will not have to wait for the server to start reading or observing.

    This is true, but how fast after the device is online do you need to push updates? I am not convinced that this small initial delay is a big issue.

    The server should not need to observe the resource again after the device comes out of PSM.

    Anyway, I'll stop arguing now. You probably know your use case better than me Slight smile

    Currently observing the the closest you get in Zephyr's LwM2M client. LwM2M 1.1 introduces a "Send operation", which would fit your requirement, but it hasn't been implemented in Zephyr yet.

    Another option would be to not use LwM2M (at least for these updates), and just send a plain UDP/CoAP message to a listening socket on the server.

Children
  • Hi Didrik,

    just out of curiosity, when do you think that Zepyhr's Lwm2m will be able to support the "send operation" from Lwm2m v.1.1?

    And from your experience, how can i be able to perform this "send operation" using Zephyr's Lwm2m v1.0, if possible? I will like to know your thoughts on this.

    Best regards,

    Cedric

  • ced27 said:
    just out of curiosity, when do you think that Zepyhr's Lwm2m will be able to support the "send operation" from Lwm2m v.1.1?

    This question should probably be directed to the the lwm2m channel on the zephyrproject Discord server.

    ced27 said:
    And from your experience, how can i be able to perform this "send operation" using Zephyr's Lwm2m v1.0, if possible? I will like to know your thoughts on this.

    I am not familiar enough with the LwM2M spec or Zephyr's implementation to answer this properly. My suggestion is to start by reading the specification of the "send operation" to see how it is performed, and maybe compare it with other operations already implemented by Zephyr.

Related