From cc865f18bb8724ca0aff3dc203867799c74d9b5a Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 13 Jul 2007 09:08:24 +0000 Subject: [PATCH] handling radio when nodes die --- tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java | 6 +++++- tools/cooja/java/se/sics/cooja/radiomediums/UDGM.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java index e5f66c7e4..923e5a429 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ContikiMote.java,v 1.5 2007/05/19 16:56:55 fros4943 Exp $ + * $Id: ContikiMote.java,v 1.6 2007/07/13 09:08:24 fros4943 Exp $ */ package se.sics.cooja.contikimote; @@ -116,6 +116,10 @@ public class ContikiMote implements Mote { myState = newState; stateObservable.stateChanged(); } + + if (myState == State.DEAD) { + mySim.getRadioMedium().unregisterMote(this, mySim); + } } public State getState() { diff --git a/tools/cooja/java/se/sics/cooja/radiomediums/UDGM.java b/tools/cooja/java/se/sics/cooja/radiomediums/UDGM.java index 4b6be7153..656037280 100644 --- a/tools/cooja/java/se/sics/cooja/radiomediums/UDGM.java +++ b/tools/cooja/java/se/sics/cooja/radiomediums/UDGM.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: UDGM.java,v 1.5 2007/07/10 12:43:24 fros4943 Exp $ + * $Id: UDGM.java,v 1.6 2007/07/13 09:08:25 fros4943 Exp $ */ package se.sics.cooja.radiomediums; @@ -245,6 +245,9 @@ public class UDGM extends AbstractRadioMedium { if (moteRadio == null) return new Color[] { Color.GRAY }; + if (mote.getState() == Mote.State.DEAD) + return new Color[] { Color.GRAY }; + if (selectedMote != null && mote == selectedMote) return new Color[] { Color.CYAN };