Open MLopezJ opened 1 year ago
I think I am using the proper requirements to execute the "send" operation request, but when I perform the operation, it does not affect the server. I am not sure if the request was received by the server or ignored because it had a mistake.
However, when the action is performed by Anjay (LwM2M client from AVSystem) or a Thingy:91, it works.
Trace the request with WireShark and observe the payload sent.
I tried this Tuesday 11 July (check week # 28 for more details), but "I was not able to ‘translate’ the payload". It was because the payload was in CBOR format and it printed with some ASCII codes which makes it difficult to transform back to text. It is also because of my lack of knowledge of WireShark. Stig could help me with this but he is on vacation until August 21.
I also told this to AVSystems 12 of July through the help center:
Trace from Anjay request
I used WireShark to inspect the send request from Anjay. However, because of lack of knowledge about the tool, I am not able to translate the payload properly from cbor to human redable text. Can you help me with that? I would like to know how the payload looks, just to confirm I am setting it correctly here: https://github.com/MLopezJ/minimalist-lwm2m-client/blob/saga/src/send.ts#L61
** help center: https://helpcenter.avsystem.com/plugins/servlet/desk/portal/17/CDM-410
but no answer received since then.
Use the same payload as the one in the LwM2M documentation.
** This option does not answer the question formulated.
Map the documentation with the lines of code, this way it would be easier to understand the decisions made in the code and check if there are any misunderstood
** This option does not answer the question formulated. It only confirms that the documentation steps are followed
Print payload from Anjay. Check the C code and print out the payload of the request.
Create a node.js LwM2M server and send a "send" request with Anjay to this server to check how the request is received. Then, send the "send" request using the device simulator and check for the differences.
Trace the "send" request from the Device Simulator with WireShark and compare it with the request from Thingy 91 and Anjay.
Test send operation request to have the confidence that it is as the documentation establishes.
The option number 6 is going to be executed first. It is desired to see the differences between requests.
Then, option number 7 is going to be implemented. It is desired to use the outside-in approach of TDD in order to have confidence that the documentation is followed in the code. The device simulator relies on node-coap and another lib is used for the cbor transformation. It is not tested. The goal of this step is to have the confidence that the implementation is correct.
Option number 1 would be ideal but there is a blocker related to not being able to translate the payload
A minimalist version of the device simulator is going to be used as the LwM2M Client in the tests. This is because the minimalist version contains aspects only related to the standard, excluding logic that is not necessary to check if the LwM2M operation is executed correctly.
It is desired to trace the operation with the following clients: Thingy:91 and Device Simulator. However, there is an already existing trace for Anjay, which is another client from AVSystems.
Set up Thingy:91 in a new environment will take some time and with anjay is possible to examine how a request accepted by Coiote looks like. Because of those 2 reasons;
is that as first step the trace from Anjay and the trace from Minimalist device simulator are going to be compared. Having say that, is important to clarify that this do not remove the need of compare result of the traces of Thingy:91 and the minimalist device simulator.
Main objective with this is to check if there are big differences between requests structs.
Both trace looks really similar. The only difference found is in the struct of the payload. Both follow senml+cbor format but the minimalist device simulator uses the object implementation and Anjay uses resource description.
// [{ 0: '/3/0/0', 3: 'newManufacturer' }]
// name: /3/0/0, string value: newManufacturer
// [ { -2: /3303/0, 0: /5700, -3: ...., 2: 14},
// { 0: /5701, 3: cel}
// ]
// [
// base name: /3303/0, name: /5700, base time: ..., value: 14,
// name: /5701, string value: cel
// ]
In order with the result of last comparation, the payload from minimalist device simulator is going to be changed for the resource specification as first try.
from:
[{ 0: '/3/0/0', 3: 'newManufacturer' }]
to
[{ -2: '/3/0/' , 0: /0', -3: 1688129143.99978, 3: 'newManufacturer' }]
// ... getCborValue method
const map = new Map()
.set(-2, '/3/0') // base name
.set(0, '/0') // name
.set(-3, 1688129143.99978) // base time
.set(3, newManufacturer) // string value
If that doesnt work, the object 3303 is going to be added in the minimalist device simulator and the payload will be the same as the one in Anjay:
// [ { -2: /3303/0, 0: 5700, -3: ...., 2: 14},
// { 0: 5701, 3: cel}
// ]
// ... getCborValue method
const element1 = new Map()
.set(-2, '/3303/0') // base name
.set(0, '/5700') // name
.set(-3, 1688129143.99978) // base time
.set(2, 14.0) // string value
const element2 = new Map()
.set(0, '/5701') // name
.set(3, 'Cel') // string value
For both cases, the result was not stable. Sometimes the response is 403 (forbidden) and sometimes the request has no answer from the server (retransmissioning). Even when the answer is from error code, is the first time that there is an answer from the server for the send operation
request made with a simulated device.
Comparing the trace result from the last example and Anjay, in which both payloads suppose to be the same, there is one important difference that is important to mention. It is that even when the Concise Binary Object Representation suggest the payload is the same, there is a difference of 4 bytes between the accepted request and the request from a simulated device.
One possible reason why this is happening is because the value 14 from the update of resource 5700 is integer in the device simulator and float in Anjay. However I havent dig into it to see if that is why it is happening or not.
Payload from successful send operation was used in the device simulator, but request was not accepted.
It is desired to implement the Send Operation from Dev Mang & Serv Enab in the Device Simulator. The request must be accepted for the LwM2M Server (Coiote in this case).