From 7c20758662f5608d392393df44d6d300b9684c6b Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Tue, 1 Nov 2011 09:38:46 +0100 Subject: [PATCH] example code for manually configuring sky motes MAC addresses --- .../src/se/sics/cooja/mspmote/SkyMote.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) 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 80340ad58..fa0eca844 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 @@ -61,6 +61,7 @@ public class SkyMote extends MspMote { skyNode = new SkyNode(); registry = skyNode.getRegistry(); skyNode.setFlash(new CoojaM25P80(skyNode.getCPU())); + prepareMote(fileELF, skyNode); } catch (Exception e) { logger.fatal("Error when creating Sky mote: ", e); @@ -69,8 +70,40 @@ public class SkyMote extends MspMote { return true; } + /*private void configureWithMacAddressesTxt(int id) { + String txt = + "18 MAC 00:12:74:00:11:2b:0a:e9\n" + + "16 MAC 00:12:74:00:11:2b:03:7f\n" + + "8 MAC 00:12:74:00:10:58:2c:fb\n" + + "7 MAC 00:12:74:00:10:58:4b:6c\n" + + "6 MAC 00:12:74:00:10:58:42:22\n" + + "5 MAC 00:12:74:00:10:58:5e:65\n" + + "19 MAC 00:12:74:00:10:57:23:25\n"; + + for (String l: txt.split("\n")) { + String[] arr = l.split(" "); + if (Integer.parseInt(arr[0]) != id) { + continue; + } + String mac = arr[2]; + String[] arr2 = mac.split(":"); + + skyNode.ds2411.setMACID( + Integer.parseInt(arr2[7],16), + Integer.parseInt(arr2[6],16), + Integer.parseInt(arr2[5],16), + Integer.parseInt(arr2[4],16), + Integer.parseInt(arr2[3],16), + 0 + ); + } + }*/ + public void idUpdated(int newID) { skyNode.setNodeID(newID); + + /* Statically configured MAC addresses */ + /*configureWithMacAddressesTxt(newID);*/ } public SkyCoffeeFilesystem getFilesystem() {