Minor imrovements

This commit is contained in:
Andrii Shvaika 2021-06-29 16:32:51 +03:00
parent 27b4c99609
commit afeca4cc59
6 changed files with 13 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public class LwM2mSessionMsgListener implements GenericFutureListener<Future<? s
@Override
public void onToTransportUpdateCredentials(ToTransportUpdateCredentialsProto updateCredentials) {
this.handler.onToTransportUpdateCredentials(updateCredentials);
this.handler.onToTransportUpdateCredentials(sessionInfo, updateCredentials);
}
@Override

View File

@ -56,4 +56,6 @@ public interface LwM2mClientContext {
void registerClient(Registration registration, ValidateDeviceCredentialsResponse credentials);
void update(LwM2mClient lwM2MClient);
void removeCredentials(TransportProtos.SessionInfoProto sessionInfo);
}

View File

@ -228,6 +228,11 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
}
}
@Override
public void removeCredentials(TransportProtos.SessionInfoProto sessionInfo) {
//TODO: implement
}
@Override
public Collection<LwM2mClient> getLwM2mClients() {
return lwM2mClientsByEndpoint.values();

View File

@ -132,7 +132,7 @@ public class DefaultLwM2mDownlinkMsgHandler extends LwM2MExecutorAwareService im
log.info("[{}] Send observation: {}.", client.getEndpoint(), request.getVersionedId());
sendRequest(client, downlink, request.getTimeout(), callback);
} else {
callback.onError("Observation is already registered!", new RuntimeException());
callback.onValidationError(resultIds.toString(), "Observation is already registered!");
}
}

View File

@ -824,12 +824,13 @@ public class DefaultLwM2MUplinkMsgHandler extends LwM2MExecutorAwareService impl
}
/**
* @param sessionInfo
* @param updateCredentials - Credentials include config only security Client (without config attr/telemetry...)
* config attr/telemetry... in profile
*/
@Override
public void onToTransportUpdateCredentials(TransportProtos.ToTransportUpdateCredentialsProto updateCredentials) {
public void onToTransportUpdateCredentials(SessionInfoProto sessionInfo, TransportProtos.ToTransportUpdateCredentialsProto updateCredentials) {
log.info("[{}] idList [{}] valueList updateCredentials", updateCredentials.getCredentialsIdList(), updateCredentials.getCredentialsValueList());
this.clientContext.removeCredentials(sessionInfo);
}
/**

View File

@ -52,7 +52,7 @@ public interface LwM2mUplinkMsgHandler {
void onWriteResponseOk(LwM2mClient client, String path, WriteRequest request);
void onToTransportUpdateCredentials(TransportProtos.ToTransportUpdateCredentialsProto updateCredentials);
void onToTransportUpdateCredentials(TransportProtos.SessionInfoProto sessionInfo, TransportProtos.ToTransportUpdateCredentialsProto updateCredentials);
LwM2MTransportServerConfig getConfig();
}