[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain/tools Drain.java,
1.2, 1.3
Gilman Tolle
gtolle at users.sourceforge.net
Fri Mar 4 15:54:47 PST 2005
- Previous message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, 1.4,
1.5 DrainLinkEstM.nc, 1.4, 1.5
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2 BluSH.h,
NONE, 1.1 BluSHC.nc, NONE, 1.1 BluSHM.nc, NONE,
1.1 BluSH_AppI.nc, NONE, 1.1 BluSH_types.h, NONE,
1.1 UARTBufferC.nc, NONE, 1.1 UARTBufferM.nc, NONE,
1.1 cmdlinetools.c, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/Drain/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30685/tools
Modified Files:
Drain.java
Log Message:
Reverse routing working better...
Index: Drain.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/tools/Drain.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Drain.java 4 Mar 2005 03:13:56 -0000 1.2
--- Drain.java 4 Mar 2005 23:54:44 -0000 1.3
***************
*** 1,4 ****
--- 1,5 ----
import net.tinyos.message.*;
import net.tinyos.util.*;
+ import net.tinyos.nucleus.*;
import java.io.*;
***************
*** 20,23 ****
--- 21,25 ----
startMoteIF();
moteIF.registerListener(new DrainRegisterMsg(), this);
+ moteIF.registerListener(new DrainMsg(), new DrainListener());
}
***************
*** 59,62 ****
--- 61,67 ----
int numBits = numBits(children.size());
int index = to & (int)(Math.pow(2,numBits) - 1);
+
+ numBits = 3; // XXX: hack for now.
+
int remainderAddr = to >> numBits;
***************
*** 92,95 ****
--- 97,101 ----
regMsg.set_linkSource(spAddr);
regMsg.set_destAddr(children.indexOf(addr));
+ regMsg.set_addrLength((byte)3); // XXX: 3 bits hack for now.
regMsg.set_op((byte)2);
***************
*** 98,101 ****
--- 104,121 ----
}
+ private class DrainListener implements MessageListener {
+
+ synchronized public void messageReceived(int to, Message m) {
+
+ DrainMsg mhMsg = (DrainMsg)m;
+
+ System.out.println(" linkTo: " + to +
+ " type:" + mhMsg.get_type() +
+ " hops:" + (16 - mhMsg.get_ttl()) +
+ " source:" + mhMsg.get_source() +
+ " dest:" + mhMsg.get_dest());
+ }
+ }
+
private void setSPAddr() {
String moteid = Env.getenv("MOTEID");
***************
*** 162,165 ****
--- 182,211 ----
}
+ public static void sendQuery(Drain drain, int to) {
+ int ATTR_SIZE = 3;
+ int numAttrs = 2;
+
+ MgmtQueryMsg mqMsg = new MgmtQueryMsg(MgmtQueryMsg.DEFAULT_MESSAGE_SIZE +
+ ATTR_SIZE * numAttrs);
+
+ mqMsg.set_queryID((int)0x1234);
+ mqMsg.set_delay((short)10);
+ mqMsg.set_active((byte)1);
+ mqMsg.set_repeat((byte)0);
+ mqMsg.set_numAttrs((byte)numAttrs);
+ mqMsg.set_ramQuery((byte)0);
+ mqMsg.set_destination(MgmtQueryConsts.MGMTQUERY_DEST_COLLECTION);
+
+ mqMsg.setElement_attrList_id(0, 1);
+ mqMsg.setElement_attrList_id(1, 3);
+ mqMsg.setElement_attrList_pos(1, (byte)0);
+
+ System.out.println(mqMsg);
+
+ drain.send(to, MgmtQueryMsg.AM_TYPE,
+ mqMsg, MgmtQueryMsg.DEFAULT_MESSAGE_SIZE +
+ ATTR_SIZE * numAttrs);
+ }
+
public static void main(String args[]) {
***************
*** 195,201 ****
System.out.println("Sending to: " + to);
!
! drain.send(to, 30, new DrainRegisterMsg(),
! DrainRegisterMsg.DEFAULT_MESSAGE_SIZE);
} catch (IOException e) {}
} while (line != null);
--- 241,246 ----
System.out.println("Sending to: " + to);
!
! sendQuery(drain, to);
} catch (IOException e) {}
} while (line != null);
- Previous message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, 1.4,
1.5 DrainLinkEstM.nc, 1.4, 1.5
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2 BluSH.h,
NONE, 1.1 BluSHC.nc, NONE, 1.1 BluSHM.nc, NONE,
1.1 BluSH_AppI.nc, NONE, 1.1 BluSH_types.h, NONE,
1.1 UARTBufferC.nc, NONE, 1.1 UARTBufferM.nc, NONE,
1.1 cmdlinetools.c, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list