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
8785fe21
Commit
8785fe21
authored
Aug 01, 2018
by
Tobias Meuser
Browse files
Added functionality to decouple receiving and sending from workload
parent
b8135828
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/hybrid/CommunicationListener.java
0 → 100755
View file @
8785fe21
/*
* 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.vehicular.hybrid
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.LocationBasedEnvironmentProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.EnvironmentInformation
;
public
interface
CommunicationListener
{
void
onReceiveInformation
(
EnvironmentInformation
<?
extends
LocationBasedEnvironmentProperty
>
pInformation
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/hybrid/VehicularReceiver.java
0 → 100755
View file @
8785fe21
/*
* 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.vehicular.hybrid
;
import
de.tudarmstadt.maki.simonstrator.api.component.HostComponent
;
public
interface
VehicularReceiver
extends
HostComponent
{
void
initialize
();
void
registerCommunicationListener
(
CommunicationListener
pListener
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/hybrid/VehicularSender.java
0 → 100755
View file @
8785fe21
/*
* 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.vehicular.hybrid
;
import
de.tudarmstadt.maki.simonstrator.api.component.HostComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.LocationBasedEnvironmentProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.EnvironmentInformation
;
public
interface
VehicularSender
extends
HostComponent
{
void
initialize
();
boolean
send
(
EnvironmentInformation
<?
extends
LocationBasedEnvironmentProperty
>
pInformation
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/processing/ProcessingServer.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.processing
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.component.HostComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
import
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic.ProcessedTopic
;
public
interface
ProcessingServer
extends
HostComponent
{
Topic
getServerTopic
();
boolean
isActive
();
List
<
SubscriptionTopicType
>
getSubscriptionType
();
List
<
ProcessedTopic
>
getSubscriptions
(
SubscriptionTopicType
...
pTypes
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/subscriptions/SubscriptionTopicType.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions
;
public
enum
SubscriptionTopicType
{
GLOBAL
,
EVENT_BASED
,
GEOHASH
,
EDGE_BASED
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/subscriptions/topic/GlobalTopic.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.topic
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
class
GlobalTopic
implements
ProcessedTopic
{
private
Topic
_topic
;
public
GlobalTopic
(
Topic
pTopic
)
{
_topic
=
pTopic
;
}
@Override
public
Topic
getTopic
()
{
return
_topic
;
}
@Override
public
SubscriptionTopicType
getTopicType
()
{
return
SubscriptionTopicType
.
GLOBAL
;
}
@Override
public
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
)
{
return
true
;
}
@Override
public
boolean
matchesHost
(
Host
pHost
)
{
return
true
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/subscriptions/topic/ProcessedTopic.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.topic
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
interface
ProcessedTopic
{
Topic
getTopic
();
SubscriptionTopicType
getTopicType
();
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
);
boolean
matchesHost
(
Host
pHost
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/subscriptions/topic/RoadBasedTopic.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.topic
;
import
java.util.HashSet
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.PubSubComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.VehicularPointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
class
RoadBasedTopic
implements
ProcessedTopic
{
private
Topic
_topic
;
private
RoadNetworkEdge
_edge
;
public
RoadBasedTopic
(
PubSubComponent
pPubSub
,
RoadNetworkEdge
pEdge
)
{
_topic
=
pPubSub
.
createTopic
(
pEdge
.
getEdgeID
());
_edge
=
pEdge
;
}
@Override
public
Topic
getTopic
()
{
return
_topic
;
}
@Override
public
SubscriptionTopicType
getTopicType
()
{
return
SubscriptionTopicType
.
EDGE_BASED
;
}
@Override
public
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
)
{
if
(
pInformation
instanceof
VehicularPointInformation
)
{
VehicularPointInformation
<?>
vehicularInfo
=
(
VehicularPointInformation
<?>)
pInformation
;
return
_edge
.
equals
(
vehicularInfo
.
getEdge
());
}
return
false
;
}
@Override
public
boolean
matchesHost
(
Host
pHost
)
{
try
{
VehicleInformationComponent
vehicleInfo
=
pHost
.
getComponent
(
VehicleInformationComponent
.
class
);
RoadNetworkRoute
currentRoute
=
vehicleInfo
.
getCurrentRoute
();
RoadNetworkEdge
currentRoad
=
currentRoute
.
getStart
();
Set
<
RoadNetworkEdge
>
roads
=
new
HashSet
<>();
roads
.
add
(
currentRoad
);
roads
.
addAll
(
currentRoad
.
getAccessibleEdges
());
return
roads
.
contains
(
_edge
);
}
catch
(
ComponentNotAvailableException
e
)
{
}
return
false
;
}
}
src/de/tudarmstadt/maki/simonstrator/peerfact/application/vehicular/processing/topic/GlobalTopic.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
class
GlobalTopic
implements
ProcessedTopic
{
private
Topic
_topic
;
public
GlobalTopic
(
Topic
pTopic
)
{
_topic
=
pTopic
;
}
@Override
public
Topic
getTopic
()
{
return
_topic
;
}
@Override
public
SubscriptionTopicType
getTopicType
()
{
return
SubscriptionTopicType
.
GLOBAL
;
}
@Override
public
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
)
{
return
true
;
}
@Override
public
boolean
matchesHost
(
Host
pHost
)
{
return
true
;
}
}
src/de/tudarmstadt/maki/simonstrator/peerfact/application/vehicular/processing/topic/ProcessedTopic.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
interface
ProcessedTopic
{
Topic
getTopic
();
SubscriptionTopicType
getTopicType
();
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
);
boolean
matchesHost
(
Host
pHost
);
}
src/de/tudarmstadt/maki/simonstrator/peerfact/application/vehicular/processing/topic/RoadBasedTopic.java
0 → 100755
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic
;
import
java.util.HashSet
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.PubSubComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.VehicularPointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
class
RoadBasedTopic
implements
ProcessedTopic
{
private
Topic
_topic
;
private
RoadNetworkEdge
_edge
;
public
RoadBasedTopic
(
PubSubComponent
pPubSub
,
RoadNetworkEdge
pEdge
)
{
_topic
=
pPubSub
.
createTopic
(
pEdge
.
getEdgeID
());
_edge
=
pEdge
;
}
@Override
public
Topic
getTopic
()
{
return
_topic
;
}
@Override
public
SubscriptionTopicType
getTopicType
()
{
return
SubscriptionTopicType
.
EDGE_BASED
;
}
@Override
public
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
)
{
if
(
pInformation
instanceof
VehicularPointInformation
)
{
VehicularPointInformation
<?>
vehicularInfo
=
(
VehicularPointInformation
<?>)
pInformation
;
return
_edge
.
equals
(
vehicularInfo
.
getEdge
());
}
return
false
;
}
@Override
public
boolean
matchesHost
(
Host
pHost
)
{
try
{
VehicleInformationComponent
vehicleInfo
=
pHost
.
getComponent
(
VehicleInformationComponent
.
class
);
RoadNetworkRoute
currentRoute
=
vehicleInfo
.
getCurrentRoute
();
RoadNetworkEdge
currentRoad
=
currentRoute
.
getStart
();
Set
<
RoadNetworkEdge
>
roads
=
new
HashSet
<>();
roads
.
add
(
currentRoad
);
roads
.
addAll
(
currentRoad
.
getAccessibleEdges
());
return
roads
.
contains
(
_edge
);
}
catch
(
ComponentNotAvailableException
e
)
{
}
return
false
;
}
}
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