Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a object to client? #570

Closed
bujingyun8 opened this issue Sep 21, 2018 · 3 comments
Closed

How to add a object to client? #570

bujingyun8 opened this issue Sep 21, 2018 · 3 comments
Labels
question Any question about leshan

Comments

@bujingyun8
Copy link

I want to add the object 19 to my demo client ,but cann't add successfully.Is there a xml file for leshan?

@sbernard31 sbernard31 added the question Any question about leshan label Sep 21, 2018
@sbernard31
Copy link
Contributor

Each Object is described by a model. This model should be described in a ddf format defined by OMA (.xml).
All the objects defined by the OMA or registered/reserved are available here.

If you are using leshan-client-demo, it does not support object 19.

If you are coding your own client using leshan your need to get the xml file (available following the link above), load this model and implement the corresponding object.

To load the code you can use ObjectLoaders, it helps to load models from files/folders or resources in your jar/war.

// Load the default model defined in the core specification 1.0
List<ObjectModel> models = ObjectLoader.loadDefault(); specification.
// Load the object 19 model
models.addAll(ObjectLoader.load...); 

Then use ObjectsInitializer to set your Object 19 implementation like explain https://github.com/eclipse/leshan/wiki/Getting-Started-:-Client#create-my-own-objects

⚠️ if your are testing with leshan-server-demo by default it does not bring the object 19 model. You will need to launch it manually using the option below

 -m,--modelsfolder <arg>        A folder which contains object models in OMA DDF(.xml) format.

@sbernard31
Copy link
Contributor

@bujingyun8 could we close this issue ?

@sbernard31
Copy link
Contributor

sbernard31 commented Oct 18, 2018

I added more information about that in the F.A.Q.

I think we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Any question about leshan
Projects
None yet
Development

No branches or pull requests

2 participants