[Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestActivePacketIndicator
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
David Moss
mossmoss at users.sourceforge.net
Sat Jul 21 22:31:44 PDT 2007
- Previous message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestActiveEnergyIndicator
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestChannel
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestActivePacketIndicator
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19699/TestActivePacketIndicator
Added Files:
Makefile TestRadioC.nc TestRadioP.nc suite.properties
Log Message:
Moved from a flat directory structure to a project-oriented directory structure
--- NEW FILE: Makefile ---
COMPONENT=TestRadioC
include $(MAKERULES)
--- NEW FILE: TestRadioC.nc ---
configuration TestRadioC {
}
implementation {
components new TestCaseC() as TestIndicatorC,
new StatisticsC() as IndicatorStatsC;
components TestRadioP,
ActiveMessageC,
new AMSenderC(4),
new AMReceiverC(4),
new TimerMilliC(),
ActiveMessageAddressC,
CC2420ReceiveC,
LedsC;
TestRadioP.SetUpOneTime -> TestIndicatorC.SetUpOneTime;
TestRadioP.TestIndicator -> TestIndicatorC;
TestRadioP.Statistics -> IndicatorStatsC;
TestRadioP.TearDownOneTime -> TestIndicatorC.TearDownOneTime;
TestRadioP.SplitControl -> ActiveMessageC;
TestRadioP.AMSend -> AMSenderC;
TestRadioP.Receive -> AMReceiverC;
TestRadioP.PacketIndicator -> CC2420ReceiveC.PacketIndicator;
TestRadioP.ActiveMessageAddress -> ActiveMessageAddressC;
TestRadioP.Timer -> TimerMilliC;
TestRadioP.Leds -> LedsC;
}
--- NEW FILE: TestRadioP.nc ---
#include "TestCase.h"
module TestRadioP {
uses {
interface TestControl as SetUpOneTime;
interface TestControl as TearDownOneTime;
interface TestCase as TestIndicator;
interface Statistics;
interface SplitControl;
interface AMSend;
interface Receive;
interface ActiveMessageAddress;
interface ReceiveIndicator as PacketIndicator;
interface Timer<TMilli>;
interface Leds;
}
}
implementation {
uint32_t detects;
uint32_t misses;
uint32_t received;
bool sending;
bool detecting;
bool transmitter;
message_t myMsg;
/***************** Prototypes ****************/
task void send();
task void detect();
/***************** SetUpOneTime ****************/
event void SetUpOneTime.run() {
detects = 0;
misses = 0;
received = 0;
detecting = FALSE;
transmitter = call ActiveMessageAddress.amAddress() == 1;
call SplitControl.start();
}
/***************** TearDownOneTime ***************/
event void TearDownOneTime.run() {
sending = FALSE;
call SplitControl.stop();
}
/***************** SplitControl Events ****************/
event void SplitControl.startDone(error_t error) {
if(transmitter) {
sending = TRUE;
post send();
}
call SetUpOneTime.done();
}
event void SplitControl.stopDone(error_t error) {
call TearDownOneTime.done();
}
/***************** Tests *****************/
event void TestIndicator.run() {
detecting = TRUE;
call Timer.startOneShot(10240);
post detect();
}
/***************** Timer Events ****************/
event void Timer.fired() {
if(transmitter) {
post send();
} else {
detecting = FALSE;
call Leds.led1Off();
assertResultIsAbove("Too few packet detects", 500, detects);
assertResultIsAbove("Too few packet gaps", 10000, misses);
call Statistics.log("[Packet Detects]", detects);
call TestIndicator.done();
}
}
/***************** Statistics Events ****************/
event void Statistics.logDone() {
}
/***************** Send/Receive ****************/
event void AMSend.sendDone(message_t *msg, error_t error) {
call Leds.led0Off();
call Timer.startOneShot(128);
}
event message_t *Receive.receive(message_t *msg, void *payload, uint8_t len) {
received++;
return msg;
}
/***************** ActiveMessageAddress Events ****************/
async event void ActiveMessageAddress.changed() {
}
/***************** Tasks ****************/
task void send() {
if(sending) {
call Leds.led0On();
if(call AMSend.send(0, &myMsg, TOSH_DATA_LENGTH) != SUCCESS) {
post send();
}
}
}
task void detect() {
if(call PacketIndicator.isReceiving()) {
detects++;
call Leds.led1On();
} else {
misses++;
call Leds.led1Off();
}
if(detecting) {
post detect();
}
}
}
--- NEW FILE: suite.properties ---
/**
* Valid keywords are:
* @author <optional author(s)> (multiple)
* @testname <optional testname> (once)
* @description <optional, multiline description> (once)
* @extra <any build/install extras> (multiple)
* @ignore <single target> (multiple)
* @only <single target> (multiple)
* @minnodes <# nodes> (once)
* @maxnodes <# nodes> (once)
* @exactnodes <# of exact nodes> (once)
* @mintargets <# of minimum targets for heterogeneous network testing> (once)
* @timeout <timeout duration of the test in minutes, default is 1 min.>
* @skip (once)
*/
@testname Test Energy Indicator while transmitting packets
@author David Moss
@description Verify the indicator toggles on and off as messages are sent
@exactnodes 2
@ignore mica2
@ignore mica2dot
- Previous message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestActiveEnergyIndicator
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestChannel
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list