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
bbe82c25
Commit
bbe82c25
authored
Jun 04, 2019
by
Louis Neumann
Browse files
Merge remote-tracking branch 'origin/jz/dev-metrics' into
jz/bachelor-thesis-louis-neumann
parents
6945f02d
b4feb9ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/common/metric/Metric.java
View file @
bbe82c25
...
...
@@ -50,7 +50,7 @@ public interface Metric<M extends MetricValue<?>> {
*/
public
enum
MetricUnit
{
NONE
(
""
),
TRAFFIC
(
"byte/s"
),
TIME
(
"us"
),
DATA
(
"byte"
),
UNKNOWN
(
"unknown"
);
"byte"
),
UNKNOWN
(
"unknown"
)
,
JOULE
(
"J"
)
;
private
final
String
representation
;
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/pubsub/analyzer/NotificationInfo.java
View file @
bbe82c25
...
...
@@ -20,14 +20,6 @@
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
* in simulation mode.
...
...
@@ -67,6 +59,13 @@ public interface NotificationInfo {
*/
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
* notifications. Only to be used for analyzing.
...
...
@@ -95,81 +94,5 @@ public interface NotificationInfo {
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
;
}
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/location/Location.java
View file @
bbe82c25
...
...
@@ -32,7 +32,7 @@ import de.tudarmstadt.maki.simonstrator.api.common.Transmitable;
*
* @see http://developer.android.com/reference/android/location/Location.html
*
* @author Bjoern Richerzhagen
* @author Bjoern Richerzhagen
, Julian Zobel
*
*/
public
interface
Location
extends
Transmitable
,
Cloneable
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/uavsupport/UAVControl.java
View file @
bbe82c25
...
...
@@ -21,6 +21,7 @@
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.overlay.OverlayContact
;
import
de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayMessage
;
...
...
@@ -51,7 +52,7 @@ public interface UAVControl extends CommunicationInterfaceListener {
public
OverlayContact
getOverlayContact
(
NetInterfaceName
network
);
public
OverlayContact
getBaseOverla
c
Contact
();
public
OverlayContact
getBaseOverla
y
Contact
();
public
Location
getCurrentLocation
();
...
...
@@ -67,4 +68,10 @@ public interface UAVControl extends CommunicationInterfaceListener {
* transmitting all cached messages directly)
*/
public
void
strategyTerminated
();
public
Host
getHost
();
public
double
getReturnThreshold
();
public
double
getRechargeThreshold
();
}
src/de/tudarmstadt/maki/simonstrator/api/uavsupport/communication/UAVToBaseInterface.java
View file @
bbe82c25
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
;
public
interface
UAVToBaseInterface
{
...
...
@@ -11,4 +13,10 @@ public interface UAVToBaseInterface {
public
void
startStrategy
();
public
ConnectionInformation
getConnectionInformation
();
public
Actuator
getActuatorAccess
();
public
double
getReturnThreshold
();
public
Host
getHost
();
}
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