|
|
|
@ -24,7 +24,6 @@ import org.eclipse.leshan.core.LwM2m; |
|
|
|
import org.eclipse.leshan.core.LwM2m.Version; |
|
|
|
import org.eclipse.leshan.core.link.Link; |
|
|
|
import org.eclipse.leshan.core.link.attributes.Attribute; |
|
|
|
import org.eclipse.leshan.core.link.lwm2m.MixedLwM2mLink; |
|
|
|
import org.eclipse.leshan.core.model.ObjectModel; |
|
|
|
import org.eclipse.leshan.core.model.ResourceModel; |
|
|
|
import org.eclipse.leshan.core.node.LwM2mMultipleResource; |
|
|
|
@ -211,11 +210,14 @@ public class LwM2mClient { |
|
|
|
} |
|
|
|
|
|
|
|
private LwM2m.Version getObjectIDVerFromDeviceProfile(DeviceProfile deviceProfile) { |
|
|
|
String defaultObjectIdVer = deviceProfile != null ? ((Lwm2mDeviceProfileTransportConfiguration)deviceProfile |
|
|
|
.getProfileData() |
|
|
|
.getTransportConfiguration()) |
|
|
|
.getClientLwM2mSettings() |
|
|
|
.getDefaultObjectIDVer() : null; |
|
|
|
String defaultObjectIdVer = null; |
|
|
|
if (deviceProfile != null) { |
|
|
|
defaultObjectIdVer = ((Lwm2mDeviceProfileTransportConfiguration) deviceProfile |
|
|
|
.getProfileData() |
|
|
|
.getTransportConfiguration()) |
|
|
|
.getClientLwM2mSettings() |
|
|
|
.getDefaultObjectIDVer(); |
|
|
|
} |
|
|
|
return new Version(defaultObjectIdVer == null ? LWM2M_OBJECT_VERSION_DEFAULT : defaultObjectIdVer); |
|
|
|
} |
|
|
|
|
|
|
|
@ -454,22 +456,17 @@ public class LwM2mClient { |
|
|
|
private void setSupportedClientObjects(){ |
|
|
|
this.supportedClientObjects = new ConcurrentHashMap<>(); |
|
|
|
for (Link link: this.registration.getSortedObjectLinks()) { |
|
|
|
if (link instanceof MixedLwM2mLink) { |
|
|
|
MixedLwM2mLink mixedLwM2mLink = (MixedLwM2mLink) link; |
|
|
|
if (!mixedLwM2mLink.getPath().isRoot()) { |
|
|
|
LwM2mPath lwM2mPath = mixedLwM2mLink.getPath(); |
|
|
|
if (lwM2mPath.isObject()) { |
|
|
|
LwM2m.Version ver; |
|
|
|
if (mixedLwM2mLink.getAttributes().get("ver") != null) { |
|
|
|
ver = (Version) mixedLwM2mLink.getAttributes().get("ver").getValue(); |
|
|
|
} else { |
|
|
|
ver = getDefaultObjectIDVer(); |
|
|
|
} |
|
|
|
this.supportedClientObjects.put(lwM2mPath.getObjectId(), ver); |
|
|
|
} else if (this.supportedClientObjects.get(lwM2mPath.getObjectId()) == null) { |
|
|
|
this.supportedClientObjects.put(lwM2mPath.getObjectId(), getDefaultObjectIDVer()); |
|
|
|
} |
|
|
|
LwM2mPath lwM2mPath = new LwM2mPath(link.getUriReference()); |
|
|
|
if (lwM2mPath.isObject()) { |
|
|
|
LwM2m.Version ver; |
|
|
|
if (link.getAttributes().get("ver")!= null) { |
|
|
|
ver = (Version) link.getAttributes().get("ver").getValue(); |
|
|
|
} else { |
|
|
|
ver = getDefaultObjectIDVer(); |
|
|
|
} |
|
|
|
this.supportedClientObjects.put(lwM2mPath.getObjectId(), ver); |
|
|
|
} else if (lwM2mPath.getObjectId() != null && this.supportedClientObjects.get(lwM2mPath.getObjectId()) == null){ |
|
|
|
this.supportedClientObjects.put(lwM2mPath.getObjectId(), getDefaultObjectIDVer()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|