[Tinyos-2-commits] CVS: tinyos-2.x/apps/tutorials/RssiDemo/java Makefile, NONE, 1.1 RssiDemo.java, NONE, 1.1
Kevin Klues
klueska at users.sourceforge.net
Tue Apr 15 10:56:51 PDT 2008
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tutorials/RssiDemo/RssiBase ApplicationDefinitions.h, NONE, 1.1 Makefile, NONE, 1.1 RssiBaseAppC.nc, NONE, 1.1 RssiBaseC.nc, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tutorials/RssiDemo RssiDemoMessages.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tutorials/RssiDemo/java
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16144/RssiDemo/java
Added Files:
Makefile RssiDemo.java
Log Message:
New demo app demonstrating how to sample rssi readings from the network
--- NEW FILE: Makefile ---
all: RssiDemo.class
RssiMsg.class: RssiMsg.java
javac $<
RssiDemo.class: RssiDemo.java RssiMsg.java
javac $^
RssiMsg.java: ../RssiDemoMessages.h
mig java -target=null -java-classname=RssiMsg $< RssiMsg -o $@
--- NEW FILE: RssiDemo.java ---
/*
* "Copyright (c) 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."
*
*/
/*
* This is a modified version of TestSerial.java, from apps/tests/TestSerial
* from TinyOS 2.x (www.tinyos.net)
*/
/**
* Java-side application for testing the RSSI demo
*
* @author Phil Levis <pal at cs.berkeley.edu>
* @author Dimas Abreu Dutra <dimas at dcc.ufmb.br>
* @date April 11 2008
*/
import java.io.IOException;
import net.tinyos.message.*;
import net.tinyos.packet.*;
import net.tinyos.util.*;
public class RssiDemo implements MessageListener {
private MoteIF moteIF;
public RssiDemo(MoteIF moteIF) {
this.moteIF = moteIF;
this.moteIF.registerListener(new RssiMsg(), this);
}
public void messageReceived(int to, Message message) {
RssiMsg msg = (RssiMsg) message;
int source = message.getSerialPacket().get_header_src();
System.out.println("Rssi Message received from node " + source +
": Rssi = " + msg.get_rssi());
}
private static void usage() {
System.err.println("usage: RssiDemo [-comm <source>]");
}
public static void main(String[] args) throws Exception {
String source = null;
if (args.length == 2) {
if (!args[0].equals("-comm")) {
usage();
System.exit(1);
}
source = args[1];
}
else if (args.length != 0) {
usage();
System.exit(1);
}
PhoenixSource phoenix;
if (source == null) {
phoenix = BuildSource.makePhoenix(PrintStreamMessenger.err);
}
else {
phoenix = BuildSource.makePhoenix(source, PrintStreamMessenger.err);
}
MoteIF mif = new MoteIF(phoenix);
RssiDemo serial = new RssiDemo(mif);
}
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tutorials/RssiDemo/RssiBase ApplicationDefinitions.h, NONE, 1.1 Makefile, NONE, 1.1 RssiBaseAppC.nc, NONE, 1.1 RssiBaseC.nc, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tutorials/RssiDemo RssiDemoMessages.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list