content: /**
   * Copyright (c) 2008 Andrew Rapp. All rights reserved.
   *  
   * This file is part of XBee-API.
   *  
   * XBee-API is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *  
   * XBee-API is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *  
   * You should have received a copy of the GNU General Public License
   * along with XBee-API.  If not, see <http://www.gnu.org/licenses/>.
   */
  
  package com.rapplogic.xbee.examples.zigbee;
  
  import org.apache.log4j.Logger;
  import org.apache.log4j.PropertyConfigurator;
  
  import com.rapplogic.xbee.api.XBee;
  import com.rapplogic.xbee.api.XBeeException;
  import com.rapplogic.xbee.api.XBeeResponse;
  
  /** 
   * @author andrew
   */
  public class BroadcastReceiverExample {
  
  	private final static Logger log = Logger.getLogger(BroadcastReceiverExample.class);
  	
  	private BroadcastReceiverExample() throws XBeeException {
  		
  		XBee xbee = new XBee();
  		
  		try {
  			// replace with your com port and baud rate. this is the com port of my coordinator
  			xbee.open("/dev/tty.usbserial-A6005uPi", 9600);
  			
  			while (true) {				
  				XBeeResponse response = xbee.getResponse();
  				log.info("received response " + response);
  			}
  		} finally {
  			if (xbee != null && xbee.isConnected()) {
  				xbee.close();		
  			}
  		}
  	}
  	
  	public static void main(String[] args) throws XBeeException, InterruptedException  {
  		PropertyConfigurator.configure("log4j.properties");
  		new BroadcastReceiverExample();
  	}
  }
  