Skip to content

Commit

Permalink
Expose CoapEndpoint instead of Endpoint at client side
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Jul 3, 2023
1 parent c8606bc commit 330617f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.californium.core.coap.Request;
import org.eclipse.californium.core.coap.Response;
import org.eclipse.californium.core.config.CoapConfig;
import org.eclipse.californium.core.network.Endpoint;
import org.eclipse.californium.core.network.CoapEndpoint;
import org.eclipse.leshan.client.californium.CaliforniumConnectionController;
import org.eclipse.leshan.client.endpoint.ClientEndpointToolbox;
import org.eclipse.leshan.client.endpoint.LwM2mClientEndpoint;
Expand All @@ -49,15 +49,15 @@ public class CaliforniumClientEndpoint implements LwM2mClientEndpoint {

private final Protocol protocol;
private final ScheduledExecutorService executor;
private final Endpoint endpoint;
private final CoapEndpoint endpoint;
private final ClientEndpointToolbox toolbox;
private final ClientCoapMessageTranslator translator;
private final IdentityHandler identityHandler;
private final CaliforniumConnectionController connectionController;
private final LwM2mModel model;
private final ExceptionTranslator exceptionTranslator;

public CaliforniumClientEndpoint(Protocol protocol, Endpoint endpoint, ClientCoapMessageTranslator translator,
public CaliforniumClientEndpoint(Protocol protocol, CoapEndpoint endpoint, ClientCoapMessageTranslator translator,
ClientEndpointToolbox toolbox, IdentityHandler identityHandler,
CaliforniumConnectionController connectionController, LwM2mModel model,
ExceptionTranslator exceptionTranslator, ScheduledExecutorService executor) {
Expand Down Expand Up @@ -171,7 +171,7 @@ public void forceReconnection(LwM2mServer server, boolean resume) {
connectionController.forceReconnection(endpoint, server, resume);
}

public Endpoint getCoapEndpoint() {
public CoapEndpoint getCoapEndpoint() {
return endpoint;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.security.cert.Certificate;
import java.util.List;

import org.eclipse.californium.core.network.Endpoint;
import org.eclipse.californium.core.network.CoapEndpoint;
import org.eclipse.californium.elements.config.Configuration;
import org.eclipse.leshan.client.californium.CaliforniumConnectionController;
import org.eclipse.leshan.client.endpoint.ClientEndpointToolbox;
Expand All @@ -32,8 +32,9 @@ public interface CaliforniumClientEndpointFactory {

Protocol getProtocol();

Endpoint createCoapEndpoint(InetAddress clientAddress, Configuration defaultConfiguration, ServerInfo serverInfo,
boolean clientInitiatedOnly, List<Certificate> trustStore, ClientEndpointToolbox toolbox);
CoapEndpoint createCoapEndpoint(InetAddress clientAddress, Configuration defaultConfiguration,
ServerInfo serverInfo, boolean clientInitiatedOnly, List<Certificate> trustStore,
ClientEndpointToolbox toolbox);

CaliforniumConnectionController createConnectionController();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.concurrent.TimeUnit;

import org.eclipse.californium.core.CoapServer;
import org.eclipse.californium.core.network.CoapEndpoint;
import org.eclipse.californium.core.network.Endpoint;
import org.eclipse.californium.core.network.Exchange;
import org.eclipse.californium.core.server.resources.Resource;
Expand Down Expand Up @@ -172,7 +173,7 @@ public LwM2mServer createEndpoint(ServerInfo serverInfo, boolean clientInitiated

if (endpointFactory.getProtocol().getUriScheme().equals(serverInfo.getFullUri().getScheme())) {
// create Californium endpoint
Endpoint coapEndpoint = endpointFactory.createCoapEndpoint(clientAddress, serverConfig, serverInfo,
CoapEndpoint coapEndpoint = endpointFactory.createCoapEndpoint(clientAddress, serverConfig, serverInfo,
clientInitiatedOnly, trustStore, toolbox);

if (coapEndpoint != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected String getLoggingTag(URI uri) {
}

@Override
public Endpoint createCoapEndpoint(InetAddress clientAddress, Configuration defaultConfiguration,
public CoapEndpoint createCoapEndpoint(InetAddress clientAddress, Configuration defaultConfiguration,
ServerInfo serverInfo, boolean clientInitiatedOnly, List<Certificate> trustStore,
ClientEndpointToolbox toolbox) {
return createEndpointBuilder(new InetSocketAddress(clientAddress, 0), serverInfo, defaultConfiguration).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected String getLoggingTag(URI uri) {
}

@Override
public Endpoint createCoapEndpoint(InetAddress clientAddress, Configuration defaultConfiguration,
public CoapEndpoint createCoapEndpoint(InetAddress clientAddress, Configuration defaultConfiguration,
ServerInfo serverInfo, boolean clientInitiatedOnly, List<Certificate> trustStore,
ClientEndpointToolbox toolbox) {

Expand Down

0 comments on commit 330617f

Please sign in to comment.