[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drip/TestDrip Makefile, NONE, 1.1 TestDrip.h, NONE, 1.1 TestDrip.nc, NONE, 1.1 TestDripM.nc, NONE, 1.1

Gilman Tolle gtolle at users.sourceforge.net
Tue Jan 18 16:01:22 PST 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/Drip/TestDrip
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10251/TestDrip

Added Files:
	Makefile TestDrip.h TestDrip.nc TestDripM.nc 
Log Message:
Drip is now entirely independent of the Nucleus system. This is the official version of Drip, and the one that will see future improvements and bugfixes. There is a README.

--- NEW FILE: Makefile ---
COMPONENT=TestDrip

PFLAGS += -I$(TOSDIR)/../beta/Drip/

include $(TOSDIR)/../apps/Makerules

--- NEW FILE: TestDrip.h ---
enum {
  AM_TESTDRIPMSG = 254,
};

typedef struct TestDripMsg {
  uint16_t data;
} TestDripMsg;

--- NEW FILE: TestDrip.nc ---
includes TestDrip;

configuration TestDrip {

}
implementation {
  
  components 
    Main, 
    DelugeC,
    TestDripM,
    DripC,
    DripStateC,
    LedsC as Leds;
  
  Main.StdControl -> DelugeC;
  Main.StdControl -> TestDripM;
  Main.StdControl -> DripC;

  TestDripM.Leds -> Leds;

  TestDripM.ReceiveDrip -> DripC.Receive[AM_TESTDRIPMSG];
  TestDripM.Drip -> DripC.Drip[AM_TESTDRIPMSG];
  DripC.DripState[AM_TESTDRIPMSG] -> DripStateC.DripState[unique("DripState")];
}

--- NEW FILE: TestDripM.nc ---
module TestDripM {
  provides interface StdControl;

  uses {
    interface Leds;

    interface Receive as ReceiveDrip;
    interface Drip;
  }
}

implementation {
  
  uint16_t data;

  command result_t StdControl.init() { 
    call Leds.init();
    call Drip.init();
    return SUCCESS; 
  }
  
  command result_t StdControl.start() { return SUCCESS; }
  command result_t StdControl.stop() { return SUCCESS; }

  event TOS_MsgPtr ReceiveDrip.receive(TOS_MsgPtr msg, 
				       void* payload, 
				       uint16_t payloadLen) {
    
    TestDripMsg *tdMsg = (TestDripMsg*)payload;
    data = tdMsg->data;
    call Leds.redToggle();
    return msg;
  }

  event result_t Drip.rebroadcastRequest(TOS_MsgPtr msg, 
					 void *payload) {

    TestDripMsg *tdMsg = (TestDripMsg*)payload;
    tdMsg->data = data;

    call Leds.greenToggle();
    call Drip.rebroadcast(msg, payload, sizeof(TestDripMsg));
    return SUCCESS;
  }
}



More information about the Tinyos-beta-commits mailing list