Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
API
Commits
0337558d
Commit
0337558d
authored
Apr 06, 2016
by
Nils Richerzhagen
Browse files
LatencySensor + Request and respective SiSType
parent
ab7cce88
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/latency/LatencyRequest.java
0 → 100644
View file @
0337558d
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.latency
;
/**
* A request for {@link LatencySensor} implementations.
*
* @author Nils Richerzhagen
*
*/
public
interface
LatencyRequest
{
/**
* Returning the interval between updates of the listener.
*
* @return interval - in Time.units
*/
public
long
getInterval
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/latency/LatencySensor.java
0 → 100644
View file @
0337558d
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.latency
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayContact
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.SensorComponent
;
/**
* Latency sensor that provides access to the last known latency to specified
* {@link ProbeHandler}s (i.e. {@link OverlayContact}s).
*
* Retrieve a {@link LatencyRequest} using the {@link LatencySensor}s
* implementation. Afterwards request latency updates from specified nodes
* {@link ProbeHandler}, provide a {@link LatencyListener} that handles the
* latency updates and give the retrieved {@link LatencyRequest}.
*
*
* @author Nils Richerzhagen & Bjoern Richerzhagen
*/
public
interface
LatencySensor
extends
SensorComponent
{
/**
* The final port for {@link LatencySensor} communication.
*/
public
final
static
int
_LATENCY_SERVICE_PORT
=
2266
;
/**
* After requesting a {@link LatencyRequest} one can request
* {@link LatencySensor} readings using this register method.
*
* From that point in time, the latency measurements are provided with the
* characteristics of the {@link LatencyRequest}.
*
* @param handler
* - to whom should the latency be calculated.
* @param listener
* - who wants the information callback.
* @param request
* - the request characteristics.
*/
public
void
requestLatencyUpdates
(
ProbeHandler
handler
,
LatencyListener
listener
,
LatencyRequest
request
);
/**
* Remove the respective {@link LatencyListener} from the update list.
*
* @param listener
*/
public
void
removeLatencyUpdates
(
LatencyListener
listener
);
/**
* Retrieve a {@link LatencyRequest} object with the specified interval for
* requestLocationUpdates
*
* @return
*/
public
LatencyRequest
getLatencyRequest
(
long
interval
);
/**
* The Set of {@link OverlayContact}s that are to be measured. I.e. the
* {@link OverlayContact}s that need to be ping'ed by the
* {@link LatencySensor}s implementation.
*
* @author Nils Richerzhagen
*
*/
public
static
interface
ProbeHandler
{
/**
* The Set of {@link OverlayContact}s.
*
* @return
*/
public
Set
<
OverlayContact
>
getContacts
();
}
/**
* The {@link LatencyListener}, called once the latency is updated.
* Including the respective {@link OverlayContact} to which the latency is
* measured.
*
* This should be implemented by the requesting component or any other
* component to handle the latency updates.
*
* @author Nils Richerzhagen
*
*/
public
static
interface
LatencyListener
{
/**
* The listener for any latency updates.
*
* @param contact
* - the contact {@link OverlayContact} to whom this latency
* is measured
* @param latency
* - the latency {@link Long} between the two (one-way) in
* Milliseconds.
*/
public
void
updatedLatency
(
OverlayContact
contact
,
long
latency
);
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sis/type/SiSTypes.java
View file @
0337558d
...
...
@@ -27,6 +27,7 @@ import de.tudarmstadt.maki.simonstrator.api.Monitor;
import
de.tudarmstadt.maki.simonstrator.api.Monitor.Level
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.Graph
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.INode
;
import
de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.NetInterfaceName
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.sis.type.aggregation.AbstractAggregation.AggregationDouble
;
...
...
@@ -76,6 +77,13 @@ public final class SiSTypes {
public
static
final
SiSType
<
Double
>
ENERGY_BATTERY_CAPACITY
=
create
(
"ENERGY_BATTERY_CAPACITY"
,
Double
.
class
,
new
AggregationDouble
());
/**
* Current measured cellular latency in ms. Is only available in the
* {@link NetInterfaceName}.MOBILE.
*/
public
static
final
SiSType
<
Double
>
LATENCY_CELL
=
create
(
"LATENCY_CELL"
,
Double
.
class
,
new
AggregationDouble
());
/**
* [none] Just a dummy Test attribute of type double. Do not use in
* production code.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment