diff --git a/src/de/tud/kom/p2psim/impl/topology/views/FiveGTopologyView.java b/src/de/tud/kom/p2psim/impl/topology/views/FiveGTopologyView.java index 668073d673c198c39109091d2fc8810cf2e01c74..8038305e3d42a6b3166bfe04231c78cb73c44ddc 100644 --- a/src/de/tud/kom/p2psim/impl/topology/views/FiveGTopologyView.java +++ b/src/de/tud/kom/p2psim/impl/topology/views/FiveGTopologyView.java @@ -213,12 +213,12 @@ public class FiveGTopologyView extends AbstractTopologyView { null); } } - + /** - * Check, if a node moved into a new segment. If so, we need to update - * the HandoverSensor to trigger the listeners. We only need to check - * nodes that are included in the list of ap-enabled nodes (i.e., they - * already have a HandoverSensor-instance). + * Check, if a node moved into a new segment. If so, we need to update the + * HandoverSensor to trigger the listeners. We only need to check nodes that + * are included in the list of ap-enabled nodes (i.e., they already have a + * HandoverSensor-instance). */ protected void checkAPAssociations() { for (HandoverSensor5G sensor : handoverSensors) { @@ -232,7 +232,7 @@ public class FiveGTopologyView extends AbstractTopologyView { databaseAccessPoints.getEntryFor(segId, false) != null); } } - + /* * FIXME the not-so-elegant approach of updating all max-BWs */ @@ -240,9 +240,9 @@ public class FiveGTopologyView extends AbstractTopologyView { updateMaxMacBandwidth(mobileClient); } } - + long lastMovementTimestamp = 0; - + @Override public void onLocationChanged(Host host, Location location) { super.onLocationChanged(host, location); @@ -442,6 +442,30 @@ public class FiveGTopologyView extends AbstractTopologyView { public void setLinkData(FiveGTopologyDatabase.Entry linkData, FiveGTopologyDatabase.Entry apLinkData) { + + if (apLinkData != null) { + assert supportsAccessPoints; + if (this.apLinkData != null) { + // was in AP, moves into AP + this.apLinkData.onHostLeavesSegment(mobileClient); + apLinkData.onHostEntersSegment(mobileClient); + } else { + // was NOT in AP, moves into AP + this.linkData.onHostLeavesSegment(mobileClient); + apLinkData.onHostEntersSegment(mobileClient); + } + } else { + if (this.apLinkData != null) { + // was in AP, moves OUT OF AP + this.apLinkData.onHostLeavesSegment(mobileClient); + linkData.onHostEntersSegment(mobileClient); + } else { + // was NOT in AP, moves into NON-AP segment + this.linkData.onHostLeavesSegment(mobileClient); + linkData.onHostEntersSegment(mobileClient); + } + } + this.linkData = linkData; assert (apLinkData != null && supportsAccessPoints) || apLinkData == null; @@ -485,10 +509,11 @@ public class FiveGTopologyView extends AbstractTopologyView { } @Override - public boolean isConnected() - { - if(apLinkData != null) return apLinkData.getConnectivity(); - if(linkData != null) return linkData.getConnectivity(); + public boolean isConnected() { + if (apLinkData != null) + return apLinkData.getConnectivity(); + if (linkData != null) + return linkData.getConnectivity(); return false; } diff --git a/src/de/tud/kom/p2psim/impl/topology/views/fiveg/FiveGTopologyDatabase.java b/src/de/tud/kom/p2psim/impl/topology/views/fiveg/FiveGTopologyDatabase.java index 3a2cd6d56571d643d69aa91ce438251fbdda7b41..6e82c2ee6ac3e5fe368000f9c510cc4291e39607 100644 --- a/src/de/tud/kom/p2psim/impl/topology/views/fiveg/FiveGTopologyDatabase.java +++ b/src/de/tud/kom/p2psim/impl/topology/views/fiveg/FiveGTopologyDatabase.java @@ -20,6 +20,7 @@ package de.tud.kom.p2psim.impl.topology.views.fiveg; +import de.tud.kom.p2psim.api.linklayer.mac.MacAddress; import de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView; import de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView.CellLink; @@ -93,6 +94,14 @@ public interface FiveGTopologyDatabase { * @return */ public int getSegmentID(); + + default public void onHostLeavesSegment(MacAddress hostAddr) { + // ignore + } + + default public void onHostEntersSegment(MacAddress hostAddr) { + // ignore + } /** * Probability of a packet drop on the link - can even be 1, so that the