Read / Write lwm2m resource instance

Hi all,

I'm implementing a lwm2m client on a NRF9160 and have a problem with read/write resource instances. I use Leshan demo server to test the object and a came across a problem on ‘Remote SIM Provisioning’ object 504. When I read ‘504/0/11’ it reads all instances of this resource, but when I try to read a single instance of this resource, got an error. See images blow

Read resource insntances OK

Read single resource instace NOK.

This is my first problem, because after i need to write.

Can anybody help?

  • Hi Charlie,

    You are missing the point. My problem is not the info inside that resource instance, that is a string and i can force any value there, what i need is to resolve the problem explained in the first post. If i read the resource, everything is OK, but if i read the resource instance i get an error.

    After exploring more the code i realized that Leshan sends a different payload depending on the button pressed, read resource or resource instance, but the answer from LWm2m client is the same.

    This is what Leshan send when we press 'Read resource'

    >>>> RCV COAP MSG LEN: 24<<<<
    00> Header<> 48 01 #ID 07 79 #TK dc ae 4e 38 b6 5c 1b 33
    00> Payld <> b3 35 30 34 01 30 02 31 31 62 2d 16
    00> >>>> END MSG <<<<

    00> RCV PATH: obj_id 504, obj_inst_id 0, res_id 11, res_inst_id 0, level 3
    This is what lwm2m client answers

    >>>> SND COAP MSG LEN: 42<<<<
    00> Header<> 68 45 #ID 07 79 #TK dc ae 4e 38 b6 5c 1b 33
    00> Payld <> c2 2d 16 ff 88 0b 17 48 00 14 38 39 33 35 31 30 36 30 30 30 30 37 37 30 38 36 32 39 39 31
    >>>> END MSG <<<<

    Until here everything is OK. The problem cames when i press 'Read resource instance'. see the payload

    >>>> RCV COAP MSG LEN: 26<<<<
    00> Header<> 48 01 #ID 07 7a #TK 78 62 70 15 7e de ef 47
    00> Payld <> b3 35 30 34 01 30 02 31 31 01 30 62 2d 16
    00> >>>> END MSG <<<<

    00> RCV PATH: obj_id 504, obj_inst_id 0, res_id 11, res_inst_id 0, level 4

    00> >>>> SND COAP MSG LEN: 39<<<<
    00> Header<> 68 45 #ID 07 7a #TK 78 62 70 15 7e de ef 47
    00> Payld <> c2 2d 16 ff 88 0b 17 48 00 14 38 39 33 35 31 30 36 30 30 30 30 37 37 30 38 36 32 39 39 31
    00> >>>> END MSG <<<<

  • After digging in other blogs i found what should be the answer for 'Read resource instance'

    This is what Leshan asks

    00> >>>> RCV COAP MSG LEN: 26<<<<
    00>
    00> Header<> 48 01 #ID 07 7a #TK 78 62 70 15 7e de ef 47
    00> Payld <> b3 35 30 34 01 30 02 31 31 01 30 62 2d 16
    00> >>>> END MSG <<<<
    00>
    00> RCV PATH: obj_id 504, obj_inst_id 0, res_id 11, res_inst_id 0, level 4
    00>

    This should be what lwm2m client answers


    00> >>>> SND COAP MSG LEN: 39<<<<
    00>
    00> Header<> 68 45 #ID 07 7a #TK 78 62 70 15 7e de ef 47
    00> Payld <> c2 2d 16 ff 48 00 14 38 39 33 35 31 30 36 30 30 30 30 37 37 30 38 36 32 39 39 31
    00> >>>> END MSG <<<<

    With this answer from lwm2m client everything works fine.

  • Hi ICM_UC,

    Sorry for my misunderstanding, glad to hear you found the issue.

    Best regards,

    Charlie

  • Hi Charlie,

    I still need your help!

    To correct this problem i need to change nordic lwm2m library and this is a problem because every time you update SDK i need to replicate all the changes.

    How can we solve this problem?

  • Hi ICM_UC,

    You can share your modification to the lwm2m library here. I will create an internal bug or improvement report after evaluating your solution.

    Do you experience a similar issue with objects in the current nRF9160: LwM2M Client sample?

    Best regards,

    Charlie 

Related