From 4b78e80bda8d41bb169635ad626833a29d515937 Mon Sep 17 00:00:00 2001 From: joxe Date: Sat, 7 Feb 2009 16:38:51 +0000 Subject: [PATCH] added MAC address setting - setNodeID in SkyNode --- .../apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java | 6 +++++- .../apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java | 6 +++++- .../src/se/sics/cooja/mspmote/interfaces/MspMoteID.java | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java index 7e4ae38f1..a35fbdfd4 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspMote.java,v 1.19 2009/01/23 15:32:24 fros4943 Exp $ + * $Id: MspMote.java,v 1.20 2009/02/07 16:38:51 joxe Exp $ */ package se.sics.cooja.mspmote; @@ -257,6 +257,10 @@ public abstract class MspMote implements Mote { return Mote.State.ACTIVE; } + /* called when moteID is updated */ + public void idUpdated(int newID) { + } + public MoteType getType() { return myMoteType; } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java index 1bbec2ac8..a299967ca 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: SkyMote.java,v 1.9 2008/12/03 13:11:20 fros4943 Exp $ + * $Id: SkyMote.java,v 1.10 2009/02/07 16:38:51 joxe Exp $ */ package se.sics.cooja.mspmote; @@ -120,6 +120,10 @@ public class SkyMote extends MspMote { return moteInterfaceHandler; } + public void idUpdated(int newID) { + skyNode.setNodeID(newID); + } + public String toString() { MoteID moteID = getInterfaces() != null ? getInterfaces().getMoteID() : null; if (moteID != null) { diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java index 6748dcccc..27144dfdc 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspMoteID.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspMoteID.java,v 1.9 2008/12/04 14:03:41 joxe Exp $ + * $Id: MspMoteID.java,v 1.10 2009/02/07 16:38:51 joxe Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -161,6 +161,10 @@ public class MspMoteID extends MoteID { } public void setMoteID(int newID) { + /* tell mote instance */ + if (moteID != newID) { + mote.idUpdated(newID); + } moteID = newID; if (location == ID_LOCATION.VARIABLE_NODE_ID) {