-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#485: add support of CoAP request for CaliforniumLwM2mRequestSender
- Loading branch information
1 parent
3397939
commit e16d8f3
Showing
2 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/CoapRequestSender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Sierra Wireless and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Sierra Wireless - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.server.californium; | ||
|
||
import org.eclipse.californium.core.coap.Request; | ||
import org.eclipse.californium.core.coap.Response; | ||
import org.eclipse.leshan.core.californium.CoapResponseCallback; | ||
import org.eclipse.leshan.core.node.codec.CodecException; | ||
import org.eclipse.leshan.core.response.ErrorCallback; | ||
import org.eclipse.leshan.server.registration.Registration; | ||
|
||
public interface CoapRequestSender { | ||
|
||
/** | ||
* Sends a CoAP request synchronously. Will block until a response is received from the remote client. | ||
* | ||
* @param destination the remote client | ||
* @param request the request to send to the client | ||
* @param timeout the request timeout in millisecond | ||
* @return the response or <code>null</code> if the timeout expires (given parameter or CoAP timeout). | ||
* | ||
* @throws CodecException if request payload can not be encoded. | ||
* @throws InterruptedException if the thread was interrupted. | ||
*/ | ||
Response sendCoapRequest(final Registration destination, final Request coapRequest, long timeout) | ||
throws InterruptedException; | ||
|
||
/** | ||
* Sends a CoAP request asynchronously. | ||
* | ||
* @param destination the remote client | ||
* @param request the request to send to the client | ||
* @param timeout the request timeout in millisecond | ||
* @param responseCallback a callback called when a response is received (successful or error response) | ||
* @param errorCallback a callback called when an error or exception occurred when response is received | ||
* | ||
* @throws CodecException if request payload can not be encoded. | ||
*/ | ||
void sendCoapRequest(final Registration destination, final Request coapRequest, long timeout, | ||
CoapResponseCallback responseCallback, ErrorCallback errorCallback); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters