[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/rincon/tools/java/com/rincon/blackbook/printstatus PrintSector.java, NONE, 1.1 PrintFile.class, NONE, 1.1 PrintFile.java, NONE, 1.1 PrintSector.class, NONE, 1.1 PrintNode.java, NONE, 1.1 PrintNode.class, NONE, 1.1 readme.txt, NONE, 1.1

dmm rincon at users.sourceforge.net
Thu Apr 20 16:02:54 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/rincon/tools/java/com/rincon/blackbook/printstatus
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15414/contrib/rincon/tools/java/com/rincon/blackbook/printstatus

Added Files:
	PrintSector.java PrintFile.class PrintFile.java 
	PrintSector.class PrintNode.java PrintNode.class readme.txt 
Log Message:
Fixed the java/com directory, and added in two more packages:  Blackbook, and EavesLogger.

--- NEW FILE: PrintSector.java ---
package com.rincon.blackbook.printstatus;

/*
 * Copyright (c) 2004-2006 Rincon Research Corporation.  
 * All rights reserved.
 * 
 * Rincon Research will permit distribution and use by others subject to
 * the restrictions of a licensing agreement which contains (among other things)
 * the following restrictions:
 * 
 *  1. No credit will be taken for the Work of others.
 *  2. It will not be resold for a price in excess of reproduction and 
 *      distribution costs.
 *  3. Others are not restricted from copying it or using it except as 
 *      set forward in the licensing agreement.
 *  4. Commented source code of any modifications or additions will be 
 *      made available to Rincon Research on the same terms.
 *  5. This notice will remain intact and displayed prominently.
 * 
 * Copies of the complete licensing agreement may be obtained by contacting 
 * Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
 * 
 * There is no warranty with this product, either expressed or implied.  
 * Use at your own risk.  Rincon Research is not liable or responsible for 
 * damage or loss incurred or resulting from the use or misuse of this software.
 */

import java.io.IOException;

import com.rincon.blackbook.Commands;
import com.rincon.blackbook.messages.BlackbookSectorMsg;


import net.tinyos.message.Message;
import net.tinyos.message.MessageListener;
import net.tinyos.message.MoteIF;
import net.tinyos.util.Messenger;

public class PrintSector implements MessageListener {

	/** Communication with the mote */
	private MoteIF comm = new MoteIF((Messenger) null);
	
	/** Command to send */
	private BlackbookSectorMsg outMsg = new BlackbookSectorMsg();
	
	/** Current destination address */
	private int dest = Commands.TOS_BCAST_ADDR;
	
	/**
	 * Constructor
	 *
	 */
	public PrintSector(String[] args) {
		comm.registerListener(new BlackbookSectorMsg(), this);
		if(args.length < 1) {
			System.err.println("PrintSector <sector #>");
			System.exit(1);
		}
		
		outMsg.set_focusedSector_index((short) Integer.parseInt(args[0]));
		send(outMsg);
	}

	/**
	 * Set the destination address of the next send command
	 * @param destination
	 */
	public void setDestination(int destination) {
		dest = destination;
	}
	
	/**
	 * Send a message
	 * @param dest
	 * @param m
	 */
	private void send(Message m) {
		System.out.println("Sent");
		try {
			comm.send(dest, m);
		} catch (IOException e) {
			System.err.println("Couldn't contact the mote");
		}
	}



	public void messageReceived(int to, Message m) {
		BlackbookSectorMsg inMsg = (BlackbookSectorMsg) m;

		System.out.println("\nSector " + outMsg.get_focusedSector_index());
		System.out.println("\ttotalUnfinalizedNodes=" + inMsg.get_focusedSector_totalUnfinalizedNodes());
		System.out.println("\twritePage=" + inMsg.get_focusedSector_writePage());
		System.out.println("\ttotalNodes=" + inMsg.get_focusedSector_totalNodes());
		System.out.println("\tindex=" + inMsg.get_focusedSector_index());
		System.out.println("\tinUse=" + inMsg.get_focusedSector_inUse());
		
        System.exit(0);
	
	}

	/**
	 * Main Method
	 * @param args
	 */
	public static void main(String[] args) {
		new PrintSector(args);
	}

}

--- NEW FILE: PrintFile.class ---
Êþº¾



	







File 










FILE_EMPTY

SourceFile




--- NEW FILE: PrintFile.java ---
package com.rincon.blackbook.printstatus;

/*
 * Copyright (c) 2004-2006 Rincon Research Corporation.  
 * All rights reserved.
 * 
 * Rincon Research will permit distribution and use by others subject to
 * the restrictions of a licensing agreement which contains (among other things)
 * the following restrictions:
 * 
 *  1. No credit will be taken for the Work of others.
 *  2. It will not be resold for a price in excess of reproduction and 
 *      distribution costs.
 *  3. Others are not restricted from copying it or using it except as 
 *      set forward in the licensing agreement.
 *  4. Commented source code of any modifications or additions will be 
 *      made available to Rincon Research on the same terms.
 *  5. This notice will remain intact and displayed prominently.
 * 
 * Copies of the complete licensing agreement may be obtained by contacting 
 * Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
 * 
 * There is no warranty with this product, either expressed or implied.  
 * Use at your own risk.  Rincon Research is not liable or responsible for 
 * damage or loss incurred or resulting from the use or misuse of this software.
 */

import java.io.IOException;

import com.rincon.blackbook.Commands;
import com.rincon.blackbook.messages.BlackbookFileMsg;

import net.tinyos.message.Message;
import net.tinyos.message.MessageListener;
import net.tinyos.message.MoteIF;
import net.tinyos.util.Messenger;

public class PrintFile implements MessageListener {

	/** Communication with the mote */
	private MoteIF comm = new MoteIF((Messenger) null);
	
	/** Command to send */
	private BlackbookFileMsg outMsg = new BlackbookFileMsg();
	
	/** Current destination address */
	private int dest = Commands.TOS_BCAST_ADDR;
	
	/**
	 * Constructor
	 *
	 */
	public PrintFile(String[] args) {
		comm.registerListener(new BlackbookFileMsg(), this);
		if(args.length < 1) {
			System.err.println("PrintFile <file #>");
			System.exit(1);
		}
		
		outMsg.set_focusedFile_type((short) Integer.parseInt(args[0]));
		send(outMsg);
	}

	/**
	 * Set the destination address of the next send command
	 * @param destination
	 */
	public void setDestination(int destination) {
		dest = destination;
	}
	
	/**
	 * Send a message
	 * @param dest
	 * @param m
	 */
	private void send(Message m) {
		System.out.println("Sent");
		try {
			comm.send(dest, m);
		} catch (IOException e) {
			System.err.println("Couldn't contact the mote");
		}
	}



	public void messageReceived(int to, Message m) {
		BlackbookFileMsg inMsg = (BlackbookFileMsg) m;

		System.out.println("\nFile " + outMsg.get_focusedFile_type());
		System.out.println("\tfirstNode=0x" + Long.toHexString(inMsg.get_focusedFile_firstNode()));
		System.out.println("\tfilenameCrc=0x" + Long.toHexString(inMsg.get_focusedFile_filenameCrc()));
		System.out.println("\ttype=" + inMsg.get_focusedFile_type());
		
		System.out.print("\tstate=");
		switch(inMsg.get_focusedFile_state()) {
		case 0:
			System.out.println("FILE_EMPTY");
			break;
			
		case 1:
			System.out.println("FILE_TEMPORARY");
			break;
			
		case 2: 
			System.out.println("FILE_IDLE");
			break;
			
		case 3:
			System.out.println("FILE_READING");
			break;
			
		case 4:
			System.out.println("FILE_WRITING");
			break;
			
		case 5: 
			System.out.println("FILE_DELETING");
			break;
			
		case 6: 
			System.out.println("FILE_BOOTING");
			break;
			
		case 7:
			System.out.println("FILE_DELETED");
			break;
			
		case 8:
			System.out.println("FILE_OPEN");
			break;
			
		default:
			System.out.println("Unknown State (" + inMsg.get_focusedFile_state() + ")");
			break;
		}
		
        System.exit(0);
	
	}

	/**
	 * Main Method
	 * @param args
	 */
	public static void main(String[] args) {
		new PrintFile(args);
	}

}

--- NEW FILE: PrintSector.class ---
Êþº¾



	







Sector 









SourceFile




--- NEW FILE: PrintNode.java ---
package com.rincon.blackbook.printstatus;

/*
 * Copyright (c) 2004-2006 Rincon Research Corporation.  
 * All rights reserved.
 * 
 * Rincon Research will permit distribution and use by others subject to
 * the restrictions of a licensing agreement which contains (among other things)
 * the following restrictions:
 * 
 *  1. No credit will be taken for the Work of others.
 *  2. It will not be resold for a price in excess of reproduction and 
 *      distribution costs.
 *  3. Others are not restricted from copying it or using it except as 
 *      set forward in the licensing agreement.
 *  4. Commented source code of any modifications or additions will be 
 *      made available to Rincon Research on the same terms.
 *  5. This notice will remain intact and displayed prominently.
 * 
 * Copies of the complete licensing agreement may be obtained by contacting 
 * Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
 * 
 * There is no warranty with this product, either expressed or implied.  
 * Use at your own risk.  Rincon Research is not liable or responsible for 
 * damage or loss incurred or resulting from the use or misuse of this software.
 */

import java.io.IOException;

import com.rincon.blackbook.Commands;
import com.rincon.blackbook.messages.BlackbookNodeMsg;

import net.tinyos.message.Message;
import net.tinyos.message.MessageListener;
import net.tinyos.message.MoteIF;
import net.tinyos.util.Messenger;

public class PrintNode implements MessageListener {

	/** Communication with the mote */
	private MoteIF comm = new MoteIF((Messenger) null);
	
	/** Command to send */
	private BlackbookNodeMsg outMsg = new BlackbookNodeMsg();
	
	/** Current destination address */
	private int dest = Commands.TOS_BCAST_ADDR;
	
	/**
	 * Constructor
	 *
	 */
	public PrintNode(String[] args) {
		comm.registerListener(new BlackbookNodeMsg(), this);
		if(args.length < 1) {
			System.err.println("PrintNode <node #>");
			System.exit(1);
		}
		
		outMsg.set_focusedNode_client((short) Integer.parseInt(args[0]));
		send(outMsg);
	}

	/**
	 * Set the destination address of the next send command
	 * @param destination
	 */
	public void setDestination(int destination) {
		dest = destination;
	}
	
	/**
	 * Send a message
	 * @param dest
	 * @param m
	 */
	private void send(Message m) {
		System.out.println("Sent");
		try {
			comm.send(dest, m);
		} catch (IOException e) {
			System.err.println("Couldn't contact the mote");
		}
	}



	public void messageReceived(int to, Message m) {
		BlackbookNodeMsg inMsg = (BlackbookNodeMsg) m;

		System.out.println("\nNode " + outMsg.get_focusedNode_client());
        System.out.println("\tflashAddress=0x" + Long.toHexString(inMsg.get_focusedNode_flashAddress()));
        System.out.println("\tnextNode=" + inMsg.get_focusedNode_nextNode());
        System.out.println("\tdataLength=0x" + Long.toHexString(inMsg.get_focusedNode_dataLength()));
        System.out.println("\treserveLength=0x" + Long.toHexString(inMsg.get_focusedNode_reserveLength()));
        System.out.println("\tdataCrc=0x" + Long.toHexString(inMsg.get_focusedNode_dataCrc()));
        System.out.println("\tfilenameCrc=0x" + Long.toHexString(inMsg.get_focusedNode_filenameCrc()));
        System.out.print("\tstate=");
        
        switch(inMsg.get_focusedNode_state()) {
        case 0:
        	System.out.println("NODE_EMPTY");
        	break;
        
        case 1: 
        	System.out.println("NODE_IDLE");
        	break;
        	
        case 2:
        	System.out.println("NODE_WRITING_UNFINALIZED");
        	break;
        
        case 3:
        	System.out.println("NODE_CLOSED_UNFINALIZED");
        	break;
        	
        case 4:
        	System.out.println("NODE_OPEN");
        	break;
        	
        case 5:
        	System.out.println("NODE_TEMPORARY");
        	break;
        	
        case 6: 
        	System.out.println("NODE_BOOTING");
        	break;
        
        case 7:
        	System.out.println("NODE_DELETED");
        	break;
        	
        default:
        	System.out.println("Unknown State (" + inMsg.get_focusedNode_state() + ")");

        }
        System.exit(0);
	
	}

	/**
	 * Main Method
	 * @param args
	 */
	public static void main(String[] args) {
		new PrintNode(args);
	}

}

--- NEW FILE: PrintNode.class ---
Êþº¾
	The method set_focusedNode_client(short) is undefined for the type BlackbookNodeMsg
	The method get_focusedNode_client() is undefined for the type BlackbookNodeMsg




	The method get_focusedNode_client() is undefined for the type BlackbookNodeMsg


SourceFile

»



»




--- NEW FILE: readme.txt ---
These 3 programs let you view the status of a file
at a given file index, a node at a given node index,
or a sector in blackbook.  It's mainly used for debugging.

@author David Moss (dmm at rincon.com)


More information about the Tinyos-contrib-commits mailing list