Commit bbe82c25 authored by Louis Neumann's avatar Louis Neumann
Browse files

Merge remote-tracking branch 'origin/jz/dev-metrics' into

jz/bachelor-thesis-louis-neumann
parents 6945f02d b4feb9ee
...@@ -50,7 +50,7 @@ public interface Metric<M extends MetricValue<?>> { ...@@ -50,7 +50,7 @@ public interface Metric<M extends MetricValue<?>> {
*/ */
public enum MetricUnit { public enum MetricUnit {
NONE(""), TRAFFIC("byte/s"), TIME("us"), DATA( NONE(""), TRAFFIC("byte/s"), TIME("us"), DATA(
"byte"), UNKNOWN("unknown"); "byte"), UNKNOWN("unknown"), JOULE("J");
private final String representation; private final String representation;
......
...@@ -20,14 +20,6 @@ ...@@ -20,14 +20,6 @@
package de.tudarmstadt.maki.simonstrator.api.component.pubsub.analyzer; package de.tudarmstadt.maki.simonstrator.api.component.pubsub.analyzer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import de.tudarmstadt.maki.simonstrator.api.Time;
/** /**
* An object that can be attached to a notification to enable easier analyzing * An object that can be attached to a notification to enable easier analyzing
* in simulation mode. * in simulation mode.
...@@ -67,6 +59,13 @@ public interface NotificationInfo { ...@@ -67,6 +59,13 @@ public interface NotificationInfo {
*/ */
public long getTimestampOfCreation(); public long getTimestampOfCreation();
/**
* The time this notification is valid seen from the timestamp of creation.
*
* @return
*/
public long getTimeToLive();
/** /**
* A sequence number for notifications, this can be used to detect missing * A sequence number for notifications, this can be used to detect missing
* notifications. Only to be used for analyzing. * notifications. Only to be used for analyzing.
...@@ -95,81 +94,5 @@ public interface NotificationInfo { ...@@ -95,81 +94,5 @@ public interface NotificationInfo {
public boolean hasMarker(Class<?> markerClass, long marker); public boolean hasMarker(Class<?> markerClass, long marker);
public class DefaultNotificationInfo implements NotificationInfo {
private final long payloadSize;
private final long originatorHostId;
private final long timestampOfCreation;
private final Set<Long> hostIdsDeliveredTo;
private final Map<Class<?>, Set<Long>> markers;
private final long sequenceNumber;
private static Map<Long, Long> hostSequenceNumbers = new LinkedHashMap<Long, Long>();
public DefaultNotificationInfo(long payloadSize, long originatorHostId) {
this.payloadSize = payloadSize;
this.originatorHostId = originatorHostId;
this.timestampOfCreation = Time.getCurrentTime();
this.hostIdsDeliveredTo = new HashSet<Long>();
this.markers = new HashMap<Class<?>, Set<Long>>();
if (hostSequenceNumbers.containsKey(originatorHostId)) {
this.sequenceNumber = hostSequenceNumbers.get(originatorHostId);
} else {
this.sequenceNumber = 0;
}
hostSequenceNumbers.put(originatorHostId, this.sequenceNumber + 1);
}
/**
* Marks the notification as being delivered to the given host. Method
* returns false, if the notification is a duplicate.
*
* @param hostId
* @return
*/
public boolean markAsDelivered(long hostId) {
return this.hostIdsDeliveredTo.add(hostId);
}
@Override
public void setMarker(Class<?> markerClass, long marker) {
Set<Long> cMarkers = markers.get(markerClass);
if (cMarkers == null) {
cMarkers = new HashSet<Long>();
markers.put(markerClass, cMarkers);
}
cMarkers.add(marker);
}
@Override
public boolean hasMarker(Class<?> markerClass, long number) {
return this.markers.containsKey(markerClass) && this.markers.get(markerClass).contains(number);
}
@Override
public long getNotificationPayloadSize() {
return payloadSize;
}
@Override
public long getOriginatorHostId() {
return originatorHostId;
}
@Override
public long getTimestampOfCreation() {
return timestampOfCreation;
}
@Override
public long getSequenceNumber() {
return sequenceNumber;
}
}
} }
...@@ -32,7 +32,7 @@ import de.tudarmstadt.maki.simonstrator.api.common.Transmitable; ...@@ -32,7 +32,7 @@ import de.tudarmstadt.maki.simonstrator.api.common.Transmitable;
* *
* @see http://developer.android.com/reference/android/location/Location.html * @see http://developer.android.com/reference/android/location/Location.html
* *
* @author Bjoern Richerzhagen * @author Bjoern Richerzhagen, Julian Zobel
* *
*/ */
public interface Location extends Transmitable, Cloneable { public interface Location extends Transmitable, Cloneable {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
package de.tudarmstadt.maki.simonstrator.api.uavsupport; package de.tudarmstadt.maki.simonstrator.api.uavsupport;
import de.tudarmstadt.maki.simonstrator.api.Host;
import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.NetInterfaceName; import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.NetInterfaceName;
import de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayContact; import de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayContact;
import de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayMessage; import de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayMessage;
...@@ -51,7 +52,7 @@ public interface UAVControl extends CommunicationInterfaceListener { ...@@ -51,7 +52,7 @@ public interface UAVControl extends CommunicationInterfaceListener {
public OverlayContact getOverlayContact(NetInterfaceName network); public OverlayContact getOverlayContact(NetInterfaceName network);
public OverlayContact getBaseOverlacContact(); public OverlayContact getBaseOverlayContact();
public Location getCurrentLocation(); public Location getCurrentLocation();
...@@ -67,4 +68,10 @@ public interface UAVControl extends CommunicationInterfaceListener { ...@@ -67,4 +68,10 @@ public interface UAVControl extends CommunicationInterfaceListener {
* transmitting all cached messages directly) * transmitting all cached messages directly)
*/ */
public void strategyTerminated(); public void strategyTerminated();
public Host getHost();
public double getReturnThreshold();
public double getRechargeThreshold();
} }
package de.tudarmstadt.maki.simonstrator.api.uavsupport.communication; package de.tudarmstadt.maki.simonstrator.api.uavsupport.communication;
import de.tudarmstadt.maki.simonstrator.api.Host;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.Actuator;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.strategy.UAVStrategy; import de.tudarmstadt.maki.simonstrator.api.uavsupport.strategy.UAVStrategy;
public interface UAVToBaseInterface { public interface UAVToBaseInterface {
...@@ -11,4 +13,10 @@ public interface UAVToBaseInterface { ...@@ -11,4 +13,10 @@ public interface UAVToBaseInterface {
public void startStrategy(); public void startStrategy();
public ConnectionInformation getConnectionInformation(); public ConnectionInformation getConnectionInformation();
public Actuator getActuatorAccess();
public double getReturnThreshold();
public Host getHost();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment