-
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.
Added ClientAwakeTimeInformation to change the default 93 sec.
Signed-off-by: Carlos Gonzalo <carlosgp143@gmail.com>
- Loading branch information
1 parent
99dbc67
commit 1c322bf
Showing
8 changed files
with
107 additions
and
40 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
...an-server-core/src/main/java/org/eclipse/leshan/server/queue/ClientAwakeTimeProvider.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,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 RISE SICS AB. | ||
* | ||
* 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: | ||
* RISE SICS AB - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.server.queue; | ||
|
||
import org.eclipse.leshan.server.registration.Registration; | ||
|
||
public interface ClientAwakeTimeProvider { | ||
|
||
/** | ||
* Returns the client awake time for the corresponding client, identified by the {@link Registration} object. | ||
* | ||
* @param reg the client's registration object | ||
* @return the client awake time in milliseconds | ||
*/ | ||
int getClientAwakeTime(Registration reg); | ||
|
||
} |
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
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
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
41 changes: 41 additions & 0 deletions
41
...ver-core/src/main/java/org/eclipse/leshan/server/queue/StaticClientAwakeTimeProvider.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,41 @@ | ||
/******************************************************************************* | ||
* 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.queue; | ||
|
||
import org.eclipse.leshan.server.registration.Registration; | ||
|
||
public class StaticClientAwakeTimeProvider implements ClientAwakeTimeProvider { | ||
|
||
private final int clientAwakeTime; | ||
|
||
/** | ||
* Create a {@link ClientAwakeTimeProvider} which always return 9300ms which is the default CoAP MAX_TRANSMIT_WAIT | ||
* value. | ||
*/ | ||
public StaticClientAwakeTimeProvider() { | ||
this.clientAwakeTime = 93000; | ||
} | ||
|
||
public StaticClientAwakeTimeProvider(int defaultClientAwakeTime) { | ||
this.clientAwakeTime = defaultClientAwakeTime; | ||
} | ||
|
||
@Override | ||
public int getClientAwakeTime(Registration reg) { | ||
return clientAwakeTime; | ||
} | ||
|
||
} |
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