[Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/cc2420/LplBroadcastCountToLeds
Makefile, NONE, 1.1 README.txt, NONE, 1.1 RadioCountMsg.java,
NONE, 1.1 RadioCountToLeds.h, NONE,
1.1 RadioCountToLedsAppC.nc, NONE, 1.1 RadioCountToLedsC.nc,
NONE, 1.1
dmm
rincon at users.sourceforge.net
Thu Apr 12 10:14:10 PDT 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/BaseStationCC2420
CC2420ControlP.nc, 1.5, 1.6 Makefile, 1.2, 1.3
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/cc2420/LplBroadcastPeriodicDelivery
Makefile, NONE, 1.1 README.txt, NONE, 1.1 TestPeriodic.h, NONE,
1.1 TestPeriodicC.nc, NONE, 1.1 TestPeriodicP.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/cc2420/LplBroadcastCountToLeds
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20118/LplBroadcastCountToLeds
Added Files:
Makefile README.txt RadioCountMsg.java RadioCountToLeds.h
RadioCountToLedsAppC.nc RadioCountToLedsC.nc
Log Message:
Supporting test suite for the newest CC2420 stack. Includes a low power version of RadioCountToLeds, TxThroughput analysis, TestAck, Unicast and Broadcast deliveries, RssiToSerial channel analyzer, and the PacketLink test app.
--- NEW FILE: Makefile ---
COMPONENT=RadioCountToLedsAppC
CFLAGS += -DACK_LOW_POWER_LISTENING
#CFLAGS += -DNOACK_LOW_POWER_LISTENING
BUILD_EXTRA_DEPS = RadioCountMsg.py RadioCountMsg.class
RadioCountMsg.py: RadioCountToLeds.h
mig python -target=$(PLATFORM) $(CFLAGS) -python-classname=RadioCountMsg RadioCountToLeds.h radio_count_msg -o $@
RadioCountMsg.class: RadioCountMsg.java
javac RadioCountMsg.java
RadioCountMsg.java: RadioCountToLeds.h
mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=RadioCountMsg RadioCountToLeds.h radio_count_msg -o $@
include $(MAKERULES)
--- NEW FILE: README.txt ---
README for RadioCountToLeds
Author/Contact: tinyos-help at millennium.berkeley.edu
Description:
This is a low power listening version of RadioCountToLeds,
using the broadcast address to delivery packets. That means even in
an ack'ing LPL scheme, the delivery will remain on for the full
duration of the receiver's LPL check to ensure all listeners get the message.
Try it with ACK_LOW_POWER_LISTENING and NOACK_LOW_POWER_LISTENING by editing
the Makefile
RadioCountToLeds maintains a 4Hz counter, broadcasting its value in
an AM packet every time it gets updated. A RadioCountToLeds node that
hears a counter displays the bottom three bits on its LEDs. This
application is a useful test to show that basic AM communication and
timers work.
Tools:
RadioCountMsg.java is a Java class representing the message that
this application sends. RadioCountMsg.py is a Python class representing
the message that this application sends.
Known bugs/limitations:
None.
$Id: README.txt,v 1.1 2007/04/12 17:14:08 rincon Exp $
--- NEW FILE: RadioCountMsg.java ---
/**
* This class is automatically generated by mig. DO NOT EDIT THIS FILE.
* This class implements a Java interface to the 'RadioCountMsg'
* message type.
*/
public class RadioCountMsg extends net.tinyos.message.Message {
/** The default size of this message type in bytes. */
public static final int DEFAULT_MESSAGE_SIZE = 2;
/** The Active Message type associated with this message. */
public static final int AM_TYPE = 6;
/** Create a new RadioCountMsg of size 2. */
public RadioCountMsg() {
super(DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/** Create a new RadioCountMsg of the given data_length. */
public RadioCountMsg(int data_length) {
super(data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new RadioCountMsg with the given data_length
* and base offset.
*/
public RadioCountMsg(int data_length, int base_offset) {
super(data_length, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new RadioCountMsg using the given byte array
* as backing store.
*/
public RadioCountMsg(byte[] data) {
super(data);
amTypeSet(AM_TYPE);
}
/**
* Create a new RadioCountMsg using the given byte array
* as backing store, with the given base offset.
*/
public RadioCountMsg(byte[] data, int base_offset) {
super(data, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new RadioCountMsg using the given byte array
* as backing store, with the given base offset and data length.
*/
public RadioCountMsg(byte[] data, int base_offset, int data_length) {
super(data, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new RadioCountMsg embedded in the given message
* at the given base offset.
*/
public RadioCountMsg(net.tinyos.message.Message msg, int base_offset) {
super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/**
* Create a new RadioCountMsg embedded in the given message
* at the given base offset and length.
*/
public RadioCountMsg(net.tinyos.message.Message msg, int base_offset, int data_length) {
super(msg, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
/* Return a String representation of this message. Includes the
* message type name and the non-indexed field values.
*/
public String toString() {
String s = "Message <RadioCountMsg> \n";
try {
s += " [counter=0x"+Long.toHexString(get_counter())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
return s;
}
// Message-type-specific access methods appear below.
/////////////////////////////////////////////////////////
// Accessor methods for field: counter
// Field type: int, unsigned
// Offset (bits): 0
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'counter' is signed (false).
*/
public static boolean isSigned_counter() {
return false;
}
/**
* Return whether the field 'counter' is an array (false).
*/
public static boolean isArray_counter() {
return false;
}
/**
* Return the offset (in bytes) of the field 'counter'
*/
public static int offset_counter() {
return (0 / 8);
}
/**
* Return the offset (in bits) of the field 'counter'
*/
public static int offsetBits_counter() {
return 0;
}
/**
* Return the value (as a int) of the field 'counter'
*/
public int get_counter() {
return (int)getUIntBEElement(offsetBits_counter(), 16);
}
/**
* Set the value of the field 'counter'
*/
public void set_counter(int value) {
setUIntBEElement(offsetBits_counter(), 16, value);
}
/**
* Return the size, in bytes, of the field 'counter'
*/
public static int size_counter() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'counter'
*/
public static int sizeBits_counter() {
return 16;
}
}
--- NEW FILE: RadioCountToLeds.h ---
#ifndef RADIO_COUNT_TO_LEDS_H
#define RADIO_COUNT_TO_LEDS_H
typedef nx_struct radio_count_msg {
nx_uint16_t counter;
} radio_count_msg_t;
enum {
AM_RADIO_COUNT_MSG = 6,
};
#endif
--- NEW FILE: RadioCountToLedsAppC.nc ---
// $Id: RadioCountToLedsAppC.nc,v 1.1 2007/04/12 17:14:08 rincon Exp $
/* tab:4
* "Copyright (c) 2000-2005 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
#include "RadioCountToLeds.h"
/**
* Configuration for the RadioCountToLeds application. RadioCountToLeds
* maintains a 4Hz counter, broadcasting its value in an AM packet
* every time it gets updated. A RadioCountToLeds node that hears a counter
* displays the bottom three bits on its LEDs. This application is a useful
* test to show that basic AM communication and timers work.
*
* @author Philip Levis
* @date June 6 2005
*/
configuration RadioCountToLedsAppC {}
implementation {
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
components CC1000ActiveMessageC as LplC;
#elif defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB)
components CC2420ActiveMessageC as LplC;
#else
#error "LPL testing not supported on this platform"
#endif
components MainC, RadioCountToLedsC as App, LedsC;
components new AMSenderC(AM_RADIO_COUNT_MSG);
components new AMReceiverC(AM_RADIO_COUNT_MSG);
components new TimerMilliC();
components ActiveMessageC;
App.Boot -> MainC.Boot;
App.LowPowerListening -> LplC;
App.Receive -> AMReceiverC;
App.AMSend -> AMSenderC;
App.AMControl -> ActiveMessageC;
App.Leds -> LedsC;
App.MilliTimer -> TimerMilliC;
App.Packet -> AMSenderC;
}
--- NEW FILE: RadioCountToLedsC.nc ---
// $Id: RadioCountToLedsC.nc,v 1.1 2007/04/12 17:14:08 rincon Exp $
/* tab:4
* "Copyright (c) 2000-2005 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
#include "Timer.h"
#include "RadioCountToLeds.h"
/**
* Implementation of the RadioCountToLeds application. RadioCountToLeds
* maintains a 4Hz counter, broadcasting its value in an AM packet
* every time it gets updated. A RadioCountToLeds node that hears a counter
* displays the bottom three bits on its LEDs. This application is a useful
* test to show that basic AM communication and timers work.
*
* @author Philip Levis
* @date June 6 2005
*/
module RadioCountToLedsC {
uses {
interface Leds;
interface Boot;
interface Receive;
interface AMSend;
interface Timer<TMilli> as MilliTimer;
interface SplitControl as AMControl;
interface Packet;
interface LowPowerListening;
}
}
implementation {
message_t packet;
bool locked;
uint16_t counter = 0;
event void Boot.booted() {
call AMControl.start();
}
event void AMControl.startDone(error_t err) {
if (err == SUCCESS) {
// Note we can setup LPL before or after the radio turns on
call LowPowerListening.setLocalSleepInterval(1000);
call MilliTimer.startOneShot(1500);
}
else {
call AMControl.start();
}
}
event void AMControl.stopDone(error_t err) {
// do nothing
}
event void MilliTimer.fired() {
counter++;
dbg("RadioCountToLedsC", "RadioCountToLedsC: timer fired, counter is %hu.\n", counter);
if (locked) {
return;
}
else {
radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(&packet, NULL);
if (call Packet.maxPayloadLength() < sizeof(radio_count_msg_t)) {
return;
}
rcm->counter = counter;
call LowPowerListening.setRxSleepInterval(&packet, 1000);
if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_count_msg_t)) == SUCCESS) {
dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n", counter);
locked = TRUE;
}
}
}
event message_t* Receive.receive(message_t* bufPtr,
void* payload, uint8_t len) {
dbg("RadioCountToLedsC", "Received packet of length %hhu.\n", len);
if (len != sizeof(radio_count_msg_t)) {
return bufPtr;
} else {
call Leds.set(((radio_count_msg_t*) payload)->counter);
return bufPtr;
}
}
event void AMSend.sendDone(message_t* bufPtr, error_t error) {
call MilliTimer.startOneShot(1500);
if (&packet == bufPtr) {
locked = FALSE;
}
}
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/BaseStationCC2420
CC2420ControlP.nc, 1.5, 1.6 Makefile, 1.2, 1.3
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/cc2420/LplBroadcastPeriodicDelivery
Makefile, NONE, 1.1 README.txt, NONE, 1.1 TestPeriodic.h, NONE,
1.1 TestPeriodicC.nc, NONE, 1.1 TestPeriodicP.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list