lwm2m: front/back fix bug update profile
This commit is contained in:
parent
23373b055e
commit
2fcf5fd7c6
@ -109,14 +109,15 @@ public class LwM2mTransportRequest {
|
||||
* Device management and service enablement, including Read, Write, Execute, Discover, Create, Delete and Write-Attributes
|
||||
*
|
||||
* @param registration -
|
||||
* @param target -
|
||||
* @param targetIdVer -
|
||||
* @param typeOper -
|
||||
* @param contentFormatParam -
|
||||
* @param observation -
|
||||
*/
|
||||
public void sendAllRequest(Registration registration, String target, String typeOper,
|
||||
public void sendAllRequest(Registration registration, String targetIdVer, String typeOper,
|
||||
String contentFormatParam, Observation observation, Object params, long timeoutInMs) {
|
||||
LwM2mPath resultIds = new LwM2mPath(convertToObjectIdFromIdVer(target));
|
||||
String target = convertToObjectIdFromIdVer(targetIdVer);
|
||||
LwM2mPath resultIds = new LwM2mPath(target);
|
||||
if (registration != null && resultIds.getObjectId() >= 0) {
|
||||
DownlinkRequest request = null;
|
||||
ContentFormat contentFormat = contentFormatParam != null ? ContentFormat.fromName(contentFormatParam.toUpperCase()) : null;
|
||||
@ -221,7 +222,7 @@ public class LwM2mTransportRequest {
|
||||
this.sendRequest(registration, lwM2MClient, request, timeoutInMs);
|
||||
}
|
||||
else {
|
||||
log.error("[{}], [{}] - [{}] error SendRequest", registration.getEndpoint(), typeOper, target);
|
||||
log.error("[{}], [{}] - [{}] error SendRequest", registration.getEndpoint(), typeOper, targetIdVer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService {
|
||||
*/
|
||||
@Override
|
||||
public void onResourceUpdate (Optional<TransportProtos.ResourceUpdateMsg> resourceUpdateMsgOpt) {
|
||||
String idVer = resourceUpdateMsgOpt.get().getResourceKey(); // 19_1.0
|
||||
String idVer = resourceUpdateMsgOpt.get().getResourceKey();
|
||||
lwM2mClientContext.getLwM2mClients().values().stream().forEach(e -> e.updateResourceModel(idVer, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getModelProvider()));
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService {
|
||||
*/
|
||||
@Override
|
||||
public void onResourceDelete(Optional<TransportProtos.ResourceDeleteMsg> resourceDeleteMsgOpt) {
|
||||
String pathIdVer = resourceDeleteMsgOpt.get().getResourceKey(); // 19_1.0
|
||||
String pathIdVer = resourceDeleteMsgOpt.get().getResourceKey();
|
||||
lwM2mClientContext.getLwM2mClients().values().stream().forEach(e -> e.deleteResources(pathIdVer, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getModelProvider()));
|
||||
}
|
||||
|
||||
@ -537,8 +537,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService {
|
||||
Set<String> paths = new HashSet<>();
|
||||
paths.add(path);
|
||||
this.updateAttrTelemetry(registration, paths);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
log.error("Fail update Resource [{}]", lwM2mResource);
|
||||
}
|
||||
}
|
||||
@ -574,7 +573,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService {
|
||||
private boolean validatePathInAttrProfile(LwM2mClientProfile clientProfile, String path) {
|
||||
try {
|
||||
List<String> attributesSet = new Gson().fromJson(clientProfile.getPostAttributeProfile(),
|
||||
new TypeToken<List<String>>() {}.getType());
|
||||
new TypeToken<List<String>>() {
|
||||
}.getType());
|
||||
return attributesSet.stream().anyMatch(p -> p.equals(path));
|
||||
} catch (Exception e) {
|
||||
log.error("Fail Validate Path [{}] ClientProfile.Attribute", path, e);
|
||||
@ -830,7 +830,6 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService {
|
||||
if (sendAttrToThingsboard.getPathPostParametersAdd().size() > 0) {
|
||||
// update value in Resources
|
||||
registrationIds.forEach(registrationId -> {
|
||||
// LeshanServer lwServer = leshanServer;
|
||||
Registration registration = lwM2mClientContext.getRegistration(registrationId);
|
||||
this.readResourceValueObserve(registration, sendAttrToThingsboard.getPathPostParametersAdd(), GET_TYPE_OPER_READ);
|
||||
// send attr/telemetry to tingsboard for new path
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user