jvermillard / leshan

OMA Lightweight M2M java implementation - LWM2M
40 stars 25 forks source link

No content format when writing objects #28

Closed cburger-scheidlin closed 10 years ago

cburger-scheidlin commented 10 years ago

The Lightweight M2M specification states that a default value of text/plain is assumed for the Content-Type Option (section 8.1 Required Features). However, when serializing a 'Write' request to an object, leshan does not set a content-format option at all. The content that is sent is TLV encoded, so I think that the content-format option should be set to application/vnd.oma.lwm2m+tlv.

sbernard31 commented 10 years ago

I fix the bug, we forgot to set Content-type (content-format). (commit fac6d088171b0b5e57895d73b711417b2358f01f) I check it with wireshark so it should be ok now. But I see content type option is formatted as an 8-bit unsigned integer. ( http://tools.ietf.org/html/draft-ietf-core-coap-03#section-11.2 ) In our code we define 1542 for "application/vnd.oma.lwm2m+tlv" but I could find this information in lightweight m2m specification. Maybe @jvermillard, @msangoi should help on this.

cburger-scheidlin commented 10 years ago

You are linking to an outdated version of the CoAP RFC. The current one is http://tools.ietf.org/html/rfc7252#section-12.3. The content format can now be 16 bit wide if required. I have also failed to spot the particular integer value for application/vnd.oma.lwm2m+tlv. I would presume 1542 is as good as any as long as no official value has been released. Which according to www.iana.org/assignments/core-parameters/core-parameters.xhtml has not happened, yet.