[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/rincon/tools/java/com/rincon/blackbook/bclean BClean.java, NONE, 1.1 BClean.class, NONE, 1.1 BCleanEvents.java, NONE, 1.1 todo.txt, NONE, 1.1 BCleanEvents.class, 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/bclean
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15414/contrib/rincon/tools/java/com/rincon/blackbook/bclean

Added Files:
	BClean.java BClean.class BCleanEvents.java todo.txt 
	BCleanEvents.class 
Log Message:
Fixed the java/com directory, and added in two more packages:  Blackbook, and EavesLogger.

--- NEW FILE: BClean.java ---
package com.rincon.blackbook.bclean;
/*
 * 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 java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

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

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

public class BClean implements MessageListener {

	/** Communication with the mote */
	private MoteIF comm = new MoteIF((Messenger) null);
		
	/** List of FileTransferEvents listeners */
	private static List listeners = new ArrayList();
	
	
	/**
	 * Constructor
	 *
	 */
	public BClean() {
		comm.registerListener(new BlackbookConnectMsg(), this);
	}

	/**
	 * Add a FileTransferEvents listener
	 * @param listener
	 */
	public void addListener(BCleanEvents listener) {
		if(!listeners.contains(listener)) {
			listeners.add(listener);
		}
	}
	
	/**
	 * Remove a FileTransferEvents listener
	 * @param listener
	 */
	public void removeListener(BCleanEvents listener) {
		listeners.remove(listener);
	}

	public void messageReceived(int to, Message m) {
		BlackbookConnectMsg inMsg = (BlackbookConnectMsg) m;
		
		switch(inMsg.get_cmd()) {
		case Commands.REPLY_BCLEAN_ERASING:
			for(Iterator it = listeners.iterator(); it.hasNext(); ) {
				((BCleanEvents) it.next()).erasing();
			}
			break;
			
		case Commands.REPLY_BCLEAN_DONE:
			for(Iterator it = listeners.iterator(); it.hasNext(); ) {
				((BCleanEvents) it.next()).gcDone(inMsg.get_result() == 1);
			}
			break;
			
		default:
		}

	}
	
}

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

	





get_result

SourceFile







--- NEW FILE: BCleanEvents.java ---
package com.rincon.blackbook.bclean;

/*
 * 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.
 */

public interface BCleanEvents {


	  /**
	   * The Garbage Collector is erasing a sector - this may take awhile
	   */
	  public void erasing();
	  
	  /**
	   * Garbage Collection is complete
	   * @return SUCCESS if any sectors were erased.
	   */
	  public void gcDone(boolean result);

	
}

--- NEW FILE: todo.txt ---
I added in the BClean events, and there are actually
some commands that go along with it but haven't
added in the functionality like the other interfaces to support
those commands.

@author David Moss (dmm at rincon.com)



--- NEW FILE: BCleanEvents.class ---
Êþº¾
SourceFile



More information about the Tinyos-contrib-commits mailing list