From 86a6d296fe238ad0c7b5819abb42f41a3a2c9303 Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Tue, 6 Mar 2012 14:33:14 +0100 Subject: [PATCH] added mote interface method to be called when add mote interfaces have been added. useful if the mote interfaces want to observe each other --- tools/cooja/java/se/sics/cooja/MoteInterface.java | 6 ++++++ tools/cooja/java/se/sics/cooja/Simulation.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tools/cooja/java/se/sics/cooja/MoteInterface.java b/tools/cooja/java/se/sics/cooja/MoteInterface.java index 2b43cdaf6..a1e7461b7 100644 --- a/tools/cooja/java/se/sics/cooja/MoteInterface.java +++ b/tools/cooja/java/se/sics/cooja/MoteInterface.java @@ -147,5 +147,11 @@ public abstract class MoteInterface extends Observable { */ public void removed() { } + + /** + * Called when all mote interfaces have been added to mote. + */ + public void added() { + } } diff --git a/tools/cooja/java/se/sics/cooja/Simulation.java b/tools/cooja/java/se/sics/cooja/Simulation.java index 972acda22..c1e89627a 100644 --- a/tools/cooja/java/se/sics/cooja/Simulation.java +++ b/tools/cooja/java/se/sics/cooja/Simulation.java @@ -790,6 +790,12 @@ public class Simulation extends Observable implements Runnable { motes.add(mote); currentRadioMedium.registerMote(mote, Simulation.this); + + /* Notify mote interfaces that node was added */ + for (MoteInterface i: mote.getInterfaces().getInterfaces()) { + i.added(); + } + setChanged(); notifyObservers(mote); }