eclipse-wakaama / wakaama

Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
BSD 3-Clause "New" or "Revised" License
498 stars 374 forks source link

Support of send operation for single resource data with TLV format ? #761

Closed EmbGangsta closed 5 months ago

EmbGangsta commented 6 months ago

I dont know if it's normal or a bug, but when I run the wakaama client demo with the "send 123 /3/0/9" command, I can see today the supported format is only SENML JSON or SENML CBOR.

Would it be possible to support TLV as well ?

sbernard31 commented 6 months ago

At least from LWM2M specification point of view.

TLV is not allowed for send command :

The value included in the payload MUST be either SenML JSON or SenML CBOR format described in Section 7.4. Data Formats for Transferring Resource Information. As example:

source : LWM2M-v1.1.1@core§6.4.6. Send Operation

EmbGangsta commented 6 months ago

Ok in that case that makes sense, thank you for confirmation.

Is the SenML CBOR more efficient than TLV in term of data size ?

sbernard31 commented 6 months ago

I don't know. :shrug:

TLV is a binary format so it should be pretty efficient. In LWM2M v1.0.x, it was the only binary format and probably the most used as you can do anything with it and it was mandatory at client and server side.

LWM2M v1.1.x more or less deprecates TLV :

LwM2M Clients supporting LwM2M TS 1.1 or newer SHOULD NOT use the legacy TLV or JSON formats.

And introduces SenML-CBOR which is based on CBOR described as :

The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation

(source : RFC8949 § Abstract)

So I guess it should be pretty efficient too but I don't know compare to TLV I suppose that authors add this format because this is an IETF standard (See RFC8428) contrary to TLV which is LWM2M only ? (It also seems that SenML-CBOR support timestamped value but don't know if this is supported by Wakaama)

But the funny part, in LWM2M v1.2.x , authors introduce another format called LwM2M CBOR which is suppose to be more efficient but is NOT an IETF standard and WITHOUT timestamped value support ... (probably not supported by Wakaama because if I remember well Wakaama is about LWM2M v1.1.x )

EmbGangsta commented 6 months ago

Thanks again.

I suppose yes that CBOR is efficient too, I will compare the data part when doing a read with TLV and a send with senml CBOR. I am doing tests with Wireshark/tcpdump on client side to evaluate data usage between formats Actually I would like to use LWM2M for embedded systems to send binary payloads most of the time ... so I was looking for something efficient !!

I hope the LWM2M standards will converge with something supported by many constructors. Today I am using Wakaama but in the final commercial product maybe we will use the embedded LWM2M stack from modem ... BTW, what are the legal rules in term of commercial reuse of Wakaama code in a finished sold product ??

sbernard31 commented 6 months ago

BTW, what are the legal rules in term of commercial reuse of Wakaama code in a finished sold product ??

Wakaama is dual licensing so you can choose to use one or another of those 2 licenses :

EmbGangsta commented 6 months ago

Thanks.

What is the rule to send unsolicited data using send method without always refreshing connection ?

I noticed that sometimes I have to update registration before to send Coap/CBOR data but sometimes it's not needed ...

Sorry for asking that, I am a rookie in LwM2M ...

sbernard31 commented 6 months ago

I don't know what you called "connection".

I noticed that sometimes I have to update registration before to send Coap/CBOR data but sometimes it's not needed ...

Hard to say but maybe you behind NAT and so from a Server point of view your client IP changes and so you need to do an update ?

See : https://github.com/eclipse-leshan/leshan/issues/1544

EmbGangsta commented 6 months ago

I am using Wakaama client "update 123" command to refresh the registration.

Maybe it is due to NAT, I don't now, but sometimes if I don't do the "update 123" then the server sends an error response telling I am not registered.

It's not always 1 or 2 minutes, it depends. Is there a session timeout exposed during first registration or registration update ?

sbernard31 commented 6 months ago

Please read all answers about : https://github.com/eclipse-leshan/leshan/issues/1544 And also links provided in those answers.

LukasWoodtli commented 5 months ago

@EmbGangsta Can we close this issue? As mentioned by @sbernard31 TLV is not allowed in send commands. So we will not implement that in Wakaama. You should probably use SENML CBOR for your case.