From 945b6f50bef020a2628dabd33844873fdef716cf Mon Sep 17 00:00:00 2001 From: kaisenl Date: Sun, 29 Jun 2008 21:36:43 +0000 Subject: [PATCH] Dip TEP Compliance --- apps/tests/TestDIP/TestDIPC-Master.nc | 28 ------------------ .../tests/{TestDIP => TestDip}/DipInject.java | 0 apps/tests/{TestDIP => TestDip}/Makefile | 2 +- apps/tests/{TestDIP => TestDip}/README | 6 ++-- apps/tests/TestDip/TestDip.h | 8 +++++ apps/tests/TestDip/TestDipC-Master.nc | 29 +++++++++++++++++++ .../TestDipP-Master.nc} | 28 +++++++++--------- apps/tests/{TestDIP => TestDip}/gentest.py | 14 ++++----- apps/tests/TestSerial/Makefile | 4 ++- 9 files changed, 65 insertions(+), 54 deletions(-) delete mode 100644 apps/tests/TestDIP/TestDIPC-Master.nc rename apps/tests/{TestDIP => TestDip}/DipInject.java (100%) rename apps/tests/{TestDIP => TestDip}/Makefile (98%) rename apps/tests/{TestDIP => TestDip}/README (92%) create mode 100644 apps/tests/TestDip/TestDip.h create mode 100644 apps/tests/TestDip/TestDipC-Master.nc rename apps/tests/{TestDIP/TestDIPP-Master.nc => TestDip/TestDipP-Master.nc} (72%) rename apps/tests/{TestDIP => TestDip}/gentest.py (84%) diff --git a/apps/tests/TestDIP/TestDIPC-Master.nc b/apps/tests/TestDIP/TestDIPC-Master.nc deleted file mode 100644 index b61094db..00000000 --- a/apps/tests/TestDIP/TestDIPC-Master.nc +++ /dev/null @@ -1,28 +0,0 @@ - -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; -} diff --git a/apps/tests/TestDIP/DipInject.java b/apps/tests/TestDip/DipInject.java similarity index 100% rename from apps/tests/TestDIP/DipInject.java rename to apps/tests/TestDip/DipInject.java diff --git a/apps/tests/TestDIP/Makefile b/apps/tests/TestDip/Makefile similarity index 98% rename from apps/tests/TestDIP/Makefile rename to apps/tests/TestDip/Makefile index 7d06b2e4..ed0305ab 100644 --- a/apps/tests/TestDIP/Makefile +++ b/apps/tests/TestDip/Makefile @@ -1,4 +1,4 @@ -COMPONENT=TestDIPC +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 diff --git a/apps/tests/TestDIP/README b/apps/tests/TestDip/README similarity index 92% rename from apps/tests/TestDIP/README rename to apps/tests/TestDip/README index 484ff05a..b56aeaff 100644 --- a/apps/tests/TestDIP/README +++ b/apps/tests/TestDip/README @@ -1,12 +1,12 @@ -Title: TestDIP Application +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, +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. diff --git a/apps/tests/TestDip/TestDip.h b/apps/tests/TestDip/TestDip.h new file mode 100644 index 00000000..7c7d120e --- /dev/null +++ b/apps/tests/TestDip/TestDip.h @@ -0,0 +1,8 @@ +#ifndef __TESTDIP_H__ +#define __TESTDIP_H__ + +enum { + AM_TESTDIP = 0xAB +}; + +#endif diff --git a/apps/tests/TestDip/TestDipC-Master.nc b/apps/tests/TestDip/TestDipC-Master.nc new file mode 100644 index 00000000..f2c673a2 --- /dev/null +++ b/apps/tests/TestDip/TestDipC-Master.nc @@ -0,0 +1,29 @@ +#include + +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; +} diff --git a/apps/tests/TestDIP/TestDIPP-Master.nc b/apps/tests/TestDip/TestDipP-Master.nc similarity index 72% rename from apps/tests/TestDIP/TestDIPP-Master.nc rename to apps/tests/TestDip/TestDipP-Master.nc index 2215ace9..e5404619 100644 --- a/apps/tests/TestDIP/TestDIPP-Master.nc +++ b/apps/tests/TestDip/TestDipP-Master.nc @@ -1,5 +1,5 @@ -module TestDIPP { +module TestDipP { uses interface Leds; uses interface StdControl; @@ -22,13 +22,13 @@ implementation { nx_uint8_t isOk; } dip_test_msg_t; - message_t m_test; + message_t testMsg; - uint8_t okbit = 1; + uint8_t okBit = 1; uint16_t data; uint8_t count = 0; /* - uint8_t newcount = N; + uint8_t newCount = N; */ // ... NEWCOUNT @@ -38,7 +38,7 @@ implementation { call StdControl.start(); if(TOS_NODE_ID == 0) { data = 0xBEEF; - dbg("TestDIPP","Updating data items\n"); + dbg("TestDipP","Updating data items\n"); /* call DisseminationUpdate1.change(&data); */ @@ -52,7 +52,7 @@ implementation { event void Boot.booted() { call SerialControl.start(); - dbg("TestDIPP", "Booted at %s\n", sim_time_string()); + dbg("TestDipP", "Booted at %s\n", sim_time_string()); } /* event void DisseminationValue1.changed() { @@ -65,22 +65,22 @@ implementation { // ... EVENTS void bookkeep() { - dip_test_msg_t* testmsg; + dip_test_msg_t* dipTestMsgPtr; - if(count < newcount) { + 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)); + 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) { + if(newCount == count) { call Leds.set(7); } diff --git a/apps/tests/TestDIP/gentest.py b/apps/tests/TestDip/gentest.py similarity index 84% rename from apps/tests/TestDIP/gentest.py rename to apps/tests/TestDip/gentest.py index 5e5084e7..c586fde4 100644 --- a/apps/tests/TestDIP/gentest.py +++ b/apps/tests/TestDip/gentest.py @@ -12,8 +12,8 @@ newitems = sys.argv[2] print "Generating Configurations" -fin = open("TestDIPC-Master.nc", "r") -fout = open("TestDIPC.nc", "w") +fin = open("TestDipC-Master.nc", "r") +fout = open("TestDipC.nc", "w") lines = fin.readlines() for line in lines: if(line.find("... DISSEMINATORS") != -1): @@ -21,9 +21,9 @@ for line in lines: 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(" TestDipP.DisseminationUpdate" + str(i)) fout.write(" -> Dissem" + str(i) + ";\n") - fout.write(" TestDIPP.DisseminationValue" + str(i)) + fout.write(" TestDipP.DisseminationValue" + str(i)) fout.write(" -> Dissem" + str(i) + ";\n\n") else: fout.write(line) @@ -33,8 +33,8 @@ fout.close() print "Generating Modules" -fin = open("TestDIPP-Master.nc", "r") -fout = open("TestDIPP.nc", "w") +fin = open("TestDipP-Master.nc", "r") +fout = open("TestDipP.nc", "w") lines = fin.readlines() for line in lines: if(line.find("... INTERFACES") != -1): @@ -44,7 +44,7 @@ for line in lines: fout.write(" uses interface DisseminationValue as DisseminationValue") fout.write(str(i) + ";\n\n") elif(line.find("... NEWCOUNT") != -1): - fout.write(" uint8_t newcount = " + str(newitems) + ";\n") + 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") diff --git a/apps/tests/TestSerial/Makefile b/apps/tests/TestSerial/Makefile index a5bb2208..daf594a9 100644 --- a/apps/tests/TestSerial/Makefile +++ b/apps/tests/TestSerial/Makefile @@ -2,8 +2,10 @@ COMPONENT=TestSerialAppC 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 $@ -- 2.39.2