+++ /dev/null
-
-import java.io.*;
-import net.tinyos.message.*;
-import net.tinyos.util.*;
-
-public class DipInject implements MessageListener
-{
- MoteIF mote;
-
- DipInject(DipMsg dipmsg) {
- mote = new MoteIF(PrintStreamMessenger.err);
- mote.registerListener(dipmsg, this);
- }
-
- public synchronized void messageReceived(int dest_addr, Message message)
- {
- // do nothing for now
- }
-
- void sendDipDataMsg(int key, long version, short[] data) {
- int totalsize = DipMsg.DEFAULT_MESSAGE_SIZE +
- DipDataMsg.DEFAULT_MESSAGE_SIZE +
- DipData.DEFAULT_MESSAGE_SIZE;
- DipMsg dm = new DipMsg(totalsize);
- dm.set_type((short)3);
-
- DipDataMsg ddm = new DipDataMsg(dm, DipMsg.DEFAULT_MESSAGE_SIZE);
- ddm.set_key(key);
- ddm.set_version(version << 16);
- ddm.set_size((short)data.length);
-
- DipData dd = new DipData(ddm, DipDataMsg.DEFAULT_MESSAGE_SIZE);
- dd.set_data(data);
-
- try {
- mote.send(MoteIF.TOS_BCAST_ADDR, dd);
- }
- catch(IOException e) {
- System.err.println("Cannot send message");
- }
- }
-
- public static void main(String args[]) {
- int i;
-
- System.out.println("Usage: java DipInject [key] [version] [hex data delimit space in quotes]");
- int k = Integer.parseInt(args[0], 16);
- long v = Long.parseLong(args[1]);
- String hexdata[] = args[2].split(" ");
- short d[];
-
- if(hexdata.length > 16) {
- System.err.println("Data too long, keep it <= 16 bytes please");
- }
-
- d = new short[hexdata.length];
- for(i = 0; i < d.length; i++)
- d[i] = Short.parseShort(hexdata[i], 16);
-
- System.out.println("Key: " + k);
- System.out.println("Version: " + v);
- System.out.print("Data: ");
- for(i = 0; i < d.length; i++) {
- System.out.print(d[i] + " ");
- }
- System.out.println();
-
- DipInject dipinject = new DipInject(new DipMsg());
- dipinject.sendDipDataMsg(k, v, d);
- }
-}
\ No newline at end of file
+++ /dev/null
-COMPONENT=TestDIPC
-BUILD_EXTRA_DEPS = DipMsg.py DipDataMsg.py DipMsg.class DipDataMsg.class DipData.class DipInject.class
-CFLAGS += -I$(TOSDIR)/lib/net
-CFLAGS += -I$(TOSDIR)/lib/net/dip -I$(TOSDIR)/lib/net/dip/interfaces
-#CFLAGS += -I$(TOSDIR)/lib/net/drip
-
-CONSTANTS += -DTOSH_DATA_LENGTH=32
-CFLAGS += $(CONSTANTS)
-
-CLEAN_EXTRA += DipMsg.py DipDataMsg.py DipData.py DipMsg.java DipDataMsg.java DipData.java DipMsg.class DipDataMsg.class DipData.class DipInject.class
-
-DipMsg.py:
- mig python -target=$(PLATFORM) -python-classname=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_msg -o $@
-
-DipDataMsg.py:
- mig python -target=$(PLATFORM) -python-classname=DipDataMsg -python-extends=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data_msg -o $@
-
-DipData.py:
- mig python -target=$(PLATFORM) -python-classname=DipData -python-extends=DipDataMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data -o $@
-
-
-DipMsg.class: DipMsg.java
- javac -target 1.4 -source 1.4 DipMsg.java
-
-DipDataMsg.class: DipDataMsg.java
- javac -target 1.4 -source 1.4 DipDataMsg.java
-
-DipData.class: DipData.java
- javac -target 1.4 -source 1.4 DipData.java
-
-DipMsg.java:
- mig java -target=$(PLATFORM) -java-classname=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_msg -o $@
-
-DipDataMsg.java:
- mig java -target=$(PLATFORM) -java-classname=DipDataMsg -java-extends=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data_msg -o $@
-
-DipData.java:
- mig java -target=$(PLATFORM) -java-classname=DipData -java-extends=DipDataMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data -o $@
-
-DipInject.class:
- javac -target 1.4 -source 1.4 DipInject.java
-
-include $(MAKERULES)
+++ /dev/null
-
-Title: TestDIP Application
-Author: Kaisen Lin
-
-1. SETTING UP THE TEST
-
-You need to first generate the code for compilation. The gentest.py
-script reads in the Master files and creates TestDIPC.nc (the
-configuration) and TESTDIPP.nc (the module). It takes two parameters,
-the total number of items and the number of new items. The items that
-are random are chosen randomly.
-
-If you want 128 total items in the dissemination set, where 96 of
-those 128 items are new, you would type:
-
-python gentest.py 128 96
-
-After the configuration and module have been generated, you can use
-the normal compilation method (e.g. make telosb).
-
-2, READING THE LEDS
-
-When an node receives a new item, it toggles LED0. When a node
-completes all items, it turns all LEDs on.
-
-3. SERIAL MESSAGES
-
-typedef nx_struct dip_test_msg_t {
- nx_am_addr_t id;
- nx_uint8_t count;
- nx_uint8_t isOk;
-} dip_test_msg_t;
-
-When a node receives a new item, it sends a dip_test_msg_t through the
-serial interface.
-
-id is the node id
-count is how many new items it has received so far
-isOk will be true if the data value was as expected
-
-4. PACKET INJECTOR
-
-You can also use the injector to send data packets via a
-basestation. The syntax to do that is:
-
-java DipInject [key] [version] [data in quotes delimited by space]
-
-key is the data key in hexadecimal
-version is the version number in decimal
-data is the actual data in quotes delimited by space
-
-For example, if you want to send key 10, version 2, and data "ab cd
-ef". You would type:
-
-java DipInject 0a 2 "ab cd ef"
-
-For this specific test application, your data needs to be "ef be". You
-will need a SerialForwarder running for this work.
-
-5. TIMING
-
-With a single sender and single receiver on a table using TelosB
-nodes, it takes approximately:
-
-3.5 minutes for a node to receive 128 out of 128 items.
-4.0 minutes for a node to receive 240 out of 240 items.
-
-With a single sender and two receivers on Mirage MicaZ nodes, it takes
-approximately:
-
-2 minutes for both nodes to receive 96 out of 96 items.
-With 128 items or more, MicaZ nodes don't receive anything. Memory limitation?
+++ /dev/null
-
-configuration TestDIPC {
-
-}
-
-implementation {
- components TestDIPP;
- components LedsC as LedsC;
- TestDIPP.Leds -> LedsC;
-
- components DisseminationC;
- TestDIPP.StdControl -> DisseminationC;
- /*
- components new DisseminatorC(uint32_t, 0x1) as Dissem1;
- TestDIPP.DisseminationValue1 -> Dissem1;
- TestDIPP.DisseminationUpdate1 -> Dissem1;
- */
-
- // ... DISSEMINATORS
-
- components MainC;
- TestDIPP.Boot -> MainC;
-
- components SerialActiveMessageC;
- components new SerialAMSenderC(0xAB);
- TestDIPP.SerialSend -> SerialAMSenderC;
- TestDIPP.SerialControl -> SerialActiveMessageC;
-}
+++ /dev/null
-
-module TestDIPP {
- uses interface Leds;
- uses interface StdControl;
-
- /*
- uses interface DisseminationUpdate<uint16_t> as DisseminationUpdate1;
- uses interface DisseminationValue<uint16_t> as DisseminationValue1;
- */
-
- // ... INTERFACES
-
- uses interface Boot;
- uses interface AMSend as SerialSend;
- uses interface SplitControl as SerialControl;
-}
-
-implementation {
- typedef nx_struct dip_test_msg_t {
- nx_am_addr_t id;
- nx_uint8_t count;
- nx_uint8_t isOk;
- } dip_test_msg_t;
-
- message_t m_test;
-
- uint8_t okbit = 1;
- uint16_t data;
- uint8_t count = 0;
- /*
- uint8_t newcount = N;
- */
- // ... NEWCOUNT
-
- void bookkeep();
-
- event void SerialControl.startDone(error_t err) {
- call StdControl.start();
- if(TOS_NODE_ID == 0) {
- data = 0xBEEF;
- dbg("TestDIPP","Updating data items\n");
- /*
- call DisseminationUpdate1.change(&data);
- */
- // ... CHANGES
- }
- }
-
- event void SerialControl.stopDone(error_t err) {
-
- }
-
- event void Boot.booted() {
- call SerialControl.start();
- dbg("TestDIPP", "Booted at %s\n", sim_time_string());
- }
- /*
- event void DisseminationValue1.changed() {
- uint16_t val = *(uint16_t*) call DisseminationValue1.get();
- if(val != 0xBEEF) { return; }
- bookkeep();
- }
- */
-
- // ... EVENTS
-
- void bookkeep() {
- dip_test_msg_t* testmsg;
-
- if(count < newcount) {
- count++;
- }
- dbg("TestDIPP", "Got an update, %u complete now at %s\n", count, sim_time_string());
- call Leds.led0Toggle();
-
- testmsg = (dip_test_msg_t*) call SerialSend.getPayload(&m_test, 0);
- testmsg->id = TOS_NODE_ID;
- testmsg->count = count;
- testmsg->isOk = okbit;
- call SerialSend.send(0, &m_test, sizeof(dip_test_msg_t));
-
-
- if(newcount == count) {
- call Leds.set(7);
- }
-
- }
-
- event void SerialSend.sendDone(message_t* message, error_t err) {
-
- }
-}
+++ /dev/null
-#!/usr/bin/python
-
-import sys
-import re
-import os
-import random
-
-print "Usage: python gentest.py [numitems] [newitems]"
-
-items = sys.argv[1]
-newitems = sys.argv[2]
-
-print "Generating Configurations"
-
-fin = open("TestDIPC-Master.nc", "r")
-fout = open("TestDIPC.nc", "w")
-lines = fin.readlines()
-for line in lines:
- if(line.find("... DISSEMINATORS") != -1):
- for i in range(1, int(items)+1):
- fout.write(" components new DisseminatorC(uint16_t, ")
- fout.write(str(i))
- fout.write(") as Dissem" + str(i) + ";\n")
- fout.write(" TestDIPP.DisseminationUpdate" + str(i))
- fout.write(" -> Dissem" + str(i) + ";\n")
- fout.write(" TestDIPP.DisseminationValue" + str(i))
- fout.write(" -> Dissem" + str(i) + ";\n\n")
- else:
- fout.write(line)
-
-fin.close()
-fout.close()
-
-print "Generating Modules"
-
-fin = open("TestDIPP-Master.nc", "r")
-fout = open("TestDIPP.nc", "w")
-lines = fin.readlines()
-for line in lines:
- if(line.find("... INTERFACES") != -1):
- for i in range(1, int(items)+1):
- fout.write(" uses interface DisseminationUpdate<uint16_t> as DisseminationUpdate")
- fout.write(str(i) + ";\n")
- fout.write(" uses interface DisseminationValue<uint16_t> as DisseminationValue")
- fout.write(str(i) + ";\n\n")
- elif(line.find("... NEWCOUNT") != -1):
- fout.write(" uint8_t newcount = " + str(newitems) + ";\n")
- elif(line.find("... CHANGES") != -1):
- for i in random.sample(range(1, int(items)+1), int(newitems)):
- fout.write(" call DisseminationUpdate" + str(i) + ".change(&data);\n")
- elif(line.find("... EVENTS") != -1):
- for i in range(1, int(items)+1):
- fout.write(" event void DisseminationValue" + str(i))
- fout.write(".changed() {\n")
- fout.write(" uint16_t val = *(uint16_t*) call DisseminationValue" + str(i) + ".get();\n")
- fout.write(" if(val != 0xBEEF) { return; }\n")
- fout.write(" bookkeep();\n")
- fout.write(" }\n\n")
- else:
- fout.write(line)
-
--- /dev/null
+
+import java.io.*;
+import net.tinyos.message.*;
+import net.tinyos.util.*;
+
+public class DipInject implements MessageListener
+{
+ MoteIF mote;
+
+ DipInject(DipMsg dipmsg) {
+ mote = new MoteIF(PrintStreamMessenger.err);
+ mote.registerListener(dipmsg, this);
+ }
+
+ public synchronized void messageReceived(int dest_addr, Message message)
+ {
+ // do nothing for now
+ }
+
+ void sendDipDataMsg(int key, long version, short[] data) {
+ int totalsize = DipMsg.DEFAULT_MESSAGE_SIZE +
+ DipDataMsg.DEFAULT_MESSAGE_SIZE +
+ DipData.DEFAULT_MESSAGE_SIZE;
+ DipMsg dm = new DipMsg(totalsize);
+ dm.set_type((short)3);
+
+ DipDataMsg ddm = new DipDataMsg(dm, DipMsg.DEFAULT_MESSAGE_SIZE);
+ ddm.set_key(key);
+ ddm.set_version(version << 16);
+ ddm.set_size((short)data.length);
+
+ DipData dd = new DipData(ddm, DipDataMsg.DEFAULT_MESSAGE_SIZE);
+ dd.set_data(data);
+
+ try {
+ mote.send(MoteIF.TOS_BCAST_ADDR, dd);
+ }
+ catch(IOException e) {
+ System.err.println("Cannot send message");
+ }
+ }
+
+ public static void main(String args[]) {
+ int i;
+
+ System.out.println("Usage: java DipInject [key] [version] [hex data delimit space in quotes]");
+ int k = Integer.parseInt(args[0], 16);
+ long v = Long.parseLong(args[1]);
+ String hexdata[] = args[2].split(" ");
+ short d[];
+
+ if(hexdata.length > 16) {
+ System.err.println("Data too long, keep it <= 16 bytes please");
+ }
+
+ d = new short[hexdata.length];
+ for(i = 0; i < d.length; i++)
+ d[i] = Short.parseShort(hexdata[i], 16);
+
+ System.out.println("Key: " + k);
+ System.out.println("Version: " + v);
+ System.out.print("Data: ");
+ for(i = 0; i < d.length; i++) {
+ System.out.print(d[i] + " ");
+ }
+ System.out.println();
+
+ DipInject dipinject = new DipInject(new DipMsg());
+ dipinject.sendDipDataMsg(k, v, d);
+ }
+}
\ No newline at end of file
--- /dev/null
+COMPONENT=TestDipC
+BUILD_EXTRA_DEPS = DipMsg.py DipDataMsg.py DipMsg.class DipDataMsg.class DipData.class DipInject.class
+CFLAGS += -I$(TOSDIR)/lib/net
+CFLAGS += -I$(TOSDIR)/lib/net/dip -I$(TOSDIR)/lib/net/dip/interfaces
+#CFLAGS += -I$(TOSDIR)/lib/net/drip
+
+CONSTANTS += -DTOSH_DATA_LENGTH=32
+CFLAGS += $(CONSTANTS)
+
+CLEAN_EXTRA += DipMsg.py DipDataMsg.py DipData.py DipMsg.java DipDataMsg.java DipData.java DipMsg.class DipDataMsg.class DipData.class DipInject.class
+
+DipMsg.py:
+ mig python -target=$(PLATFORM) -python-classname=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_msg -o $@
+
+DipDataMsg.py:
+ mig python -target=$(PLATFORM) -python-classname=DipDataMsg -python-extends=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data_msg -o $@
+
+DipData.py:
+ mig python -target=$(PLATFORM) -python-classname=DipData -python-extends=DipDataMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data -o $@
+
+
+DipMsg.class: DipMsg.java
+ javac -target 1.4 -source 1.4 DipMsg.java
+
+DipDataMsg.class: DipDataMsg.java
+ javac -target 1.4 -source 1.4 DipDataMsg.java
+
+DipData.class: DipData.java
+ javac -target 1.4 -source 1.4 DipData.java
+
+DipMsg.java:
+ mig java -target=$(PLATFORM) -java-classname=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_msg -o $@
+
+DipDataMsg.java:
+ mig java -target=$(PLATFORM) -java-classname=DipDataMsg -java-extends=DipMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data_msg -o $@
+
+DipData.java:
+ mig java -target=$(PLATFORM) -java-classname=DipData -java-extends=DipDataMsg $(CFLAGS) $(TOSDIR)/lib/net/dip/Dip.h dip_data -o $@
+
+DipInject.class:
+ javac -target 1.4 -source 1.4 DipInject.java
+
+include $(MAKERULES)
--- /dev/null
+
+Title: TestDip Application
+Author: Kaisen Lin
+
+1. SETTING UP THE TEST
+
+You need to first generate the code for compilation. The gentest.py
+script reads in the Master files and creates TestDipC.nc (the
+configuration) and TestDipP.nc (the module). It takes two parameters,
+the total number of items and the number of new items. The items that
+are random are chosen randomly.
+
+If you want 128 total items in the dissemination set, where 96 of
+those 128 items are new, you would type:
+
+python gentest.py 128 96
+
+After the configuration and module have been generated, you can use
+the normal compilation method (e.g. make telosb).
+
+2, READING THE LEDS
+
+When an node receives a new item, it toggles LED0. When a node
+completes all items, it turns all LEDs on.
+
+3. SERIAL MESSAGES
+
+typedef nx_struct dip_test_msg_t {
+ nx_am_addr_t id;
+ nx_uint8_t count;
+ nx_uint8_t isOk;
+} dip_test_msg_t;
+
+When a node receives a new item, it sends a dip_test_msg_t through the
+serial interface.
+
+id is the node id
+count is how many new items it has received so far
+isOk will be true if the data value was as expected
+
+4. PACKET INJECTOR
+
+You can also use the injector to send data packets via a
+basestation. The syntax to do that is:
+
+java DipInject [key] [version] [data in quotes delimited by space]
+
+key is the data key in hexadecimal
+version is the version number in decimal
+data is the actual data in quotes delimited by space
+
+For example, if you want to send key 10, version 2, and data "ab cd
+ef". You would type:
+
+java DipInject 0a 2 "ab cd ef"
+
+For this specific test application, your data needs to be "ef be". You
+will need a SerialForwarder running for this work.
+
+5. TIMING
+
+With a single sender and single receiver on a table using TelosB
+nodes, it takes approximately:
+
+3.5 minutes for a node to receive 128 out of 128 items.
+4.0 minutes for a node to receive 240 out of 240 items.
+
+With a single sender and two receivers on Mirage MicaZ nodes, it takes
+approximately:
+
+2 minutes for both nodes to receive 96 out of 96 items.
+With 128 items or more, MicaZ nodes don't receive anything. Memory limitation?
--- /dev/null
+#ifndef __TESTDIP_H__
+#define __TESTDIP_H__
+
+enum {
+ AM_TESTDIP = 0xAB
+};
+
+#endif
--- /dev/null
+#include <TestDip.h>
+
+configuration TestDipC {
+
+}
+
+implementation {
+ components TestDipP;
+ components LedsC as LedsC;
+ TestDipP.Leds -> LedsC;
+
+ components DisseminationC;
+ TestDipP.StdControl -> DisseminationC;
+ /*
+ components new DisseminatorC(uint32_t, 0x1) as Dissem1;
+ TestDipP.DisseminationValue1 -> Dissem1;
+ TestDipP.DisseminationUpdate1 -> Dissem1;
+ */
+
+ // ... DISSEMINATORS
+
+ components MainC;
+ TestDipP.Boot -> MainC;
+
+ components SerialActiveMessageC;
+ components new SerialAMSenderC(AM_TESTDIP);
+ TestDipP.SerialSend -> SerialAMSenderC;
+ TestDipP.SerialControl -> SerialActiveMessageC;
+}
--- /dev/null
+
+module TestDipP {
+ uses interface Leds;
+ uses interface StdControl;
+
+ /*
+ uses interface DisseminationUpdate<uint16_t> as DisseminationUpdate1;
+ uses interface DisseminationValue<uint16_t> as DisseminationValue1;
+ */
+
+ // ... INTERFACES
+
+ uses interface Boot;
+ uses interface AMSend as SerialSend;
+ uses interface SplitControl as SerialControl;
+}
+
+implementation {
+ typedef nx_struct dip_test_msg_t {
+ nx_am_addr_t id;
+ nx_uint8_t count;
+ nx_uint8_t isOk;
+ } dip_test_msg_t;
+
+ message_t testMsg;
+
+ uint8_t okBit = 1;
+ uint16_t data;
+ uint8_t count = 0;
+ /*
+ uint8_t newCount = N;
+ */
+ // ... NEWCOUNT
+
+ void bookkeep();
+
+ event void SerialControl.startDone(error_t err) {
+ call StdControl.start();
+ if(TOS_NODE_ID == 0) {
+ data = 0xBEEF;
+ dbg("TestDipP","Updating data items\n");
+ /*
+ call DisseminationUpdate1.change(&data);
+ */
+ // ... CHANGES
+ }
+ }
+
+ event void SerialControl.stopDone(error_t err) {
+
+ }
+
+ event void Boot.booted() {
+ call SerialControl.start();
+ dbg("TestDipP", "Booted at %s\n", sim_time_string());
+ }
+ /*
+ event void DisseminationValue1.changed() {
+ uint16_t val = *(uint16_t*) call DisseminationValue1.get();
+ if(val != 0xBEEF) { return; }
+ bookkeep();
+ }
+ */
+
+ // ... EVENTS
+
+ void bookkeep() {
+ dip_test_msg_t* dipTestMsgPtr;
+
+ if(count < newCount) {
+ count++;
+ }
+ dbg("TestDIPP", "Got an update, %u complete now at %s\n", count, sim_time_string());
+ call Leds.led0Toggle();
+
+ dipTestMsgPtr = (dip_test_msg_t*) call SerialSend.getPayload(&testMsg, 0);
+ dipTestMsgPtr->id = TOS_NODE_ID;
+ dipTestMsgPtr->count = count;
+ dipTestMsgPtr->isOk = okBit;
+ call SerialSend.send(0, &testMsg, sizeof(dip_test_msg_t));
+
+
+ if(newCount == count) {
+ call Leds.set(7);
+ }
+
+ }
+
+ event void SerialSend.sendDone(message_t* message, error_t err) {
+
+ }
+}
--- /dev/null
+#!/usr/bin/python
+
+import sys
+import re
+import os
+import random
+
+print "Usage: python gentest.py [numitems] [newitems]"
+
+items = sys.argv[1]
+newitems = sys.argv[2]
+
+print "Generating Configurations"
+
+fin = open("TestDipC-Master.nc", "r")
+fout = open("TestDipC.nc", "w")
+lines = fin.readlines()
+for line in lines:
+ if(line.find("... DISSEMINATORS") != -1):
+ for i in range(1, int(items)+1):
+ fout.write(" components new DisseminatorC(uint16_t, ")
+ fout.write(str(i))
+ fout.write(") as Dissem" + str(i) + ";\n")
+ fout.write(" TestDipP.DisseminationUpdate" + str(i))
+ fout.write(" -> Dissem" + str(i) + ";\n")
+ fout.write(" TestDipP.DisseminationValue" + str(i))
+ fout.write(" -> Dissem" + str(i) + ";\n\n")
+ else:
+ fout.write(line)
+
+fin.close()
+fout.close()
+
+print "Generating Modules"
+
+fin = open("TestDipP-Master.nc", "r")
+fout = open("TestDipP.nc", "w")
+lines = fin.readlines()
+for line in lines:
+ if(line.find("... INTERFACES") != -1):
+ for i in range(1, int(items)+1):
+ fout.write(" uses interface DisseminationUpdate<uint16_t> as DisseminationUpdate")
+ fout.write(str(i) + ";\n")
+ fout.write(" uses interface DisseminationValue<uint16_t> as DisseminationValue")
+ fout.write(str(i) + ";\n\n")
+ elif(line.find("... NEWCOUNT") != -1):
+ fout.write(" uint8_t newCount = " + str(newitems) + ";\n")
+ elif(line.find("... CHANGES") != -1):
+ for i in random.sample(range(1, int(items)+1), int(newitems)):
+ fout.write(" call DisseminationUpdate" + str(i) + ".change(&data);\n")
+ elif(line.find("... EVENTS") != -1):
+ for i in range(1, int(items)+1):
+ fout.write(" event void DisseminationValue" + str(i))
+ fout.write(".changed() {\n")
+ fout.write(" uint16_t val = *(uint16_t*) call DisseminationValue" + str(i) + ".get();\n")
+ fout.write(" if(val != 0xBEEF) { return; }\n")
+ fout.write(" bookkeep();\n")
+ fout.write(" }\n\n")
+ else:
+ fout.write(line)
+
BUILD_EXTRA_DEPS += TestSerial.class
CLEAN_EXTRA = *.class TestSerialMsg.java
+CFLAGS += -I$(TOSDIR)/lib/T2Hack
+
TestSerial.class: $(wildcard *.java) TestSerialMsg.java
- javac *.java
+ javac -target 1.4 -source 1.4 *.java
TestSerialMsg.java:
mig java -target=null $(CFLAGS) -java-classname=TestSerialMsg TestSerial.h test_serial_msg -o $@