Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [leshan-dev] help in object instance accessing

In fact, when I say there no way to create several instance for multi instance object, I mean using the ObjectsInitializer.
But you can do that without it (or after it), you could create it "manually" using the ObjectEnabler constructor.
(ObjectsInitializer is just an helper to create the list of lwM2mObjectEnabler needed by the LeshanClient constructor)


Le 29/04/2015 12:11, Simon Bernard a écrit :
Currently, there no way to initialize the client with one or several instances for a multi instance object.
New instances could be created using the lwm2m protocol (Create request).
But this limitation is clearly a problem. we need to offer a way to initialize client with instances.
There are a discussion about that here : https://github.com/eclipse/leshan/commit/0679bced772a2f2f5d7171278d7be0f580222eb5#commitcomment-10911816

Le 28/04/2015 21:36, Foivos . a écrit :
Ok, that is helpful. But, how do I bind a LwM2mInstanceEnabler instance (java meaning) to a LwM2mObject instance?
Method ObjectsInitializer.setClassForObject() seems to bind succesfully only objects with
"instancetype= single" property to a java class.
 
Thank you very much for your help.


Date: Tue, 28 Apr 2015 12:10:57 +0200
From: contact@xxxxxxxxxxxxxxx
To: leshan-dev@xxxxxxxxxxx
Subject: Re: [leshan-dev] help in object instance accessing

Hi,

The LwM2mInstanceEnabler represent a unique instance of a lwm2m object.
So you will have 1 instance of the class LwM2mInstanceEnabler (at java meaning) for 1 instance of Object instance (at lwm2m meaning).
So when you implement the "read", you should not need the id to access to the instance ("you already in it", the instance is accessible with "this").
If you want to manage all the instances in only one java object, you should extends the BaseObjectEnabler and add it after the ObjectInitializer
Something like that :

List<ObjectEnabler> objectEnablers = initializer.create(3,4,5)
List<LwM2mObjectEnabler>  enablers = new ArrayList<LwM2mObjectEnabler>(enablers);
enablers.add(new MyCustomObjectEnabler());
final LeshanClient client = new LeshanClient(clientAddress, serverAddress, enablers)

(The API is still experimental and clearly not perfect so feedbacks are welcome ;))

Simon

Le 28/04/2015 03:49, Foivos . a écrit :
help in object instance accessing

I try to bind a multiple instance object (using ObjectInitializer.setClassForObject() method)
with a class that implements LwM2mInstanceEnabler interface.
Since method read() of the LwM2mInstanceEnabler interface  has not object-instance-id as argument,
I am not able to access a specific instance.
Is there any alternative way to access a specific object instance?

Thank you.


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


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


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



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



Back to the top