-
Notifications
You must be signed in to change notification settings - Fork 409
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
New API to handle LWM2M Data. #981
Comments
In current implementation we have interface LwM2mResource which provide a few methods that are implemented with NoSuchElementException. What do you think to split LwM2mResource into separate interfaces that allow to avoid sub implementation. For example we can split current LwM2mResource interface into: interface LwM2mResource extends LwM2mNode {
Type getType();
}
interface LwM2mSingleResource extends LwM2mResource {
Object getValue();
}
interface LwM2mMultipleResource extends LwM2mResource {
Object getValue(int id);
LwM2mResourceInstance getInstance(int id);
Map<Integer, LwM2mResourceInstance> getInstances();
} We can drop isMultiInstances() method because we can distinguish between LwM2mSingleResource and LwM2mMultipleResource using |
I guess this was mainly to avoid some instanceof / cast ?
As explained in #1192 (comment) I feel this is not directly linked to the new |
The current Leshan API to handle LWM2M Data is based on those classes :
The data structure is a kind of Tree :
This designed was mainly inspired by the LWM2M Resource Model and also by the first multi-value Data format : TLV.
This was not a eccentric idea but at usage the current API is a bit verbose and maybe we could do better.
At current stage this is only an idea but maybe we should move from "the tree model" to a "path->value model". This would be more inspired by the SENML DataFormat.
But using the same idea as
TreeMap
we could still keep the Tree hierarchy with a more comfortable way to access data by path.The new API could looks like :
(I guess implementation will be based on
TreeMap
)The text was updated successfully, but these errors were encountered: