Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] test object can't be read from leshan server

Hi Simon,

Thanks for your explanation. I'll try it.


2016-02-18 0:43 GMT+08:00 Simon Bernard <sbernard@xxxxxxxxxxxxxxxxxx>:
Hi Ricky,
 
   You are in particular use case where Leshan does not know the model of your object.
   This is not a well supported case of the LWM2M spec.
 
   Currently, when Leshan have no model for an object it supposes that all resources was a STRING.
   For JSON format we can be a bit smarter using type carried by the format. (There is a PR[1] for this)

   This PR will allow you to make READ on custom object from the UI.
   The WRITE will not work, because the UI always send String (this is a UI limitation), but you can use the REST API, e.g. using curl like this :

>> curl -H "Content-Type: application/json" -X POST -d  "{'id':'10','resources':[{'id':1,'value':12},{'id':3,'value':12.5}]}" http://localhost:8081/api/clients/testlwm2mclient/1024/10
Client [testlwm2mclient] returned unexpected response code [2.04]%  

   The other solution is to define model for this object at server side.
   You can define the model of you object in a leshan json format or xml DDF file format.
   Put this file in a folder.
   Then set the "MODELS_FOLDER" environment variable to the path of this folder, then run :
   export MODELS_FOLDER="/your/path" && java -jar leshan-server-demo.jar
  
   Here the json for wakaama 1024 object :
[
  {
    "name": "My Custom Object",
    "id": 1024,
    "instancetype": "multiple",
    "mandatory": true,
    "description": "",
    "resourcedefs": [
      {
        "id": 1,
        "name": "My resource 1",
        "operations": "RW",
        "instancetype": "single",
        "mandatory": true,
        "type": "integer",
        "range": "",
        "units": "",
        "description": ""
      },
      {
        "id": 3,
        "name": "My resource 3",
        "operations": "RW",
        "instancetype": "single",
        "mandatory": true,
        "type": "float",
        "range": "",
        "units": "",
        "description": ""
      }
    ]
  }
]

HTH, Simon.

[1]https://github.com/eclipse/leshan/pull/74


Le 16/02/2016 02:27, Ricky Liu a écrit :
Hi David,

Thank you for your prompt reply.  :)

I fixed my coding error and got correct response from leshan. But the test object seems to be leshan server problem.

Could you recommend any server besides leshan?

2016-02-15 22:19 GMT+08:00 Navarro, David <david.navarro@xxxxxxxxx>:

Hi,

 

You should ask on the leshan mailing list. The Read operation works on all other objects but Firmware Update. Thus it is not an issue with the JSON encoding or the content-type not matching.

 

Regards,

David Navarro

 

From: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] On Behalf Of Ricky Liu
Sent: Monday, 15 February, 2016 07:20
To: wakaama-dev@xxxxxxxxxxx
Subject: [wakaama-dev] test object can't be read from leshan server

 

Hi,

 

I try to read test object resource in the client demo code form leshan server (http://leshan.eclipse.org/) but get this error:
"Unable to read instance /1024/10 for testlwm2mclient : 400 Value does not match the given datatype"

 

I also try to write custom object to read a string.  It works on wakaama server but get error from leshan.eclipse.org

"400 The validated object is null"

 

Anything wrong with wakaama or leshan?  or did I miss any config?

 

Thanks.

 

PS:  If I use wakaama server, /1024/10 can be read by wakaama server.

Client #0 1024/10 : 2.05 (COAP_205_CONTENT)

    42 bytes received of type application/vnd.oma.lwm2m+json:

    {"e":[{"n":"1","v":20},{"n":"3","v":-30}]}

 

 

--

RickyLiu

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


_______________________________________________
wakaama-dev mailing list
wakaama-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/wakaama-dev



--
RickyLiu


_______________________________________________
wakaama-dev mailing list
wakaama-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/wakaama-dev



--
RickyLiu

Back to the top