fixed read/observe "dataRead" object 19
This commit is contained in:
parent
423a9e2e04
commit
ad541703ce
@ -228,14 +228,13 @@ public class LwM2mClient implements Serializable {
|
||||
}
|
||||
|
||||
public boolean saveResourceValue(String pathRezIdVer, LwM2mResource resource, LwM2mModelProvider modelProvider, Mode mode) {
|
||||
if (this.resources.get(pathRezIdVer) != null && this.resources.get(pathRezIdVer).getResourceModel() != null &&
|
||||
resourceEqualsModel(resource, this.resources.get(pathRezIdVer).getResourceModel())) {
|
||||
if (this.resources.get(pathRezIdVer) != null && this.resources.get(pathRezIdVer).getResourceModel() != null) {
|
||||
this.resources.get(pathRezIdVer).updateLwM2mResource(resource, mode);
|
||||
return true;
|
||||
} else {
|
||||
LwM2mPath pathIds = new LwM2mPath(fromVersionedIdToObjectId(pathRezIdVer));
|
||||
ResourceModel resourceModel = modelProvider.getObjectModel(registration).getResourceModel(pathIds.getObjectId(), pathIds.getResourceId());
|
||||
if (resourceModel != null && resourceEqualsModel(resource, resourceModel)) {
|
||||
if (resourceModel != null) {
|
||||
this.resources.put(pathRezIdVer, new ResourceValue(resource, resourceModel));
|
||||
return true;
|
||||
} else {
|
||||
@ -244,11 +243,6 @@ public class LwM2mClient implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean resourceEqualsModel(LwM2mResource resource, ResourceModel resourceModel) {
|
||||
return ((!resourceModel.multiple && resource instanceof LwM2mSingleResource) ||
|
||||
(resourceModel.multiple && resource instanceof LwM2mMultipleResource));
|
||||
}
|
||||
|
||||
public Object getResourceValue(String pathRezIdVer, String pathRezId) {
|
||||
String pathRez = pathRezIdVer == null ? convertObjectIdToVersionedId(pathRezId, this.registration) : pathRezIdVer;
|
||||
if (this.resources.get(pathRez) != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user