uwcse.location.objects.cricket
Class CricketDriver

java.lang.Object
  |
  +--com.intel.research.rain.Service
        |
        +--uwcse.location.LocationService
              |
              +--uwcse.location.FusionClientService
                    |
                    +--uwcse.location.objects.SensorDriver
                          |
                          +--uwcse.location.objects.cricket.CricketDriver
All Implemented Interfaces:
MessageHandler

public class CricketDriver
extends SensorDriver

A CricketDriver interacts with receiver hardware of the Cricket indoor location system from MIT and generates LinearDistanceMeasurements.

Version:
$Revision: 1.2 $
Author:
Jeffrey Hightower
See Also:
LinearDistanceMeasurement

Nested Class Summary
 
Nested classes inherited from class uwcse.location.LocationService
LocationService.RediscoverServices
 
Field Summary
static int BEACON_OFFSET_BODHI
           
static int CLOCK_FREQ_HZ
           
protected  String m_cricketName
           
protected  ProducerConsumerQueue m_packetQueue
           
protected  CricketDriver.CricketPacketThread m_packetThread
           
protected  javax.comm.SerialPort m_serialPort
           
protected  CricketSerialPortThread m_serialPortThread
           
static double SPEED_OF_SOUND
           
 
Fields inherited from class uwcse.location.objects.SensorDriver
m_measurementSinkServiceIDSet, SINK_DISCOVERY_QUERY
 
Fields inherited from class uwcse.location.FusionClientService
FUSION_DISCOVERY_QUERY, m_fusionServiceIDSet
 
Fields inherited from class uwcse.location.LocationService
CONFIG_FILENAME, MESSAGE_ELEMENT, MESSAGE_EXTENSION, RPC_ELEMENT, RPC_EXCEPTION_ELEMENT, RPC_EXTENSION, RPC_RESULT_ELEMENT
 
Constructor Summary
CricketDriver(String portName, String cricketName)
           
 
Method Summary
static double bodhisToMeters(double bodhis)
          This method converts "bodhis", the internal distance measurement units of the crickets to meters.
protected  void closeSerialPort()
          Close serial port and remove the event listener.
static void main(String[] argv)
          Run the CricketDriver.
protected  void openSerialPort(String portName)
          Open the specified serial port at the given baud rate.
protected static void printUsageAndExit()
          Show the program argument usage and then exit.
protected  void withdraw()
          Overridden to close the serial port if necessary before withdrawing from Rain.
 
Methods inherited from class uwcse.location.objects.SensorDriver
sendMeasurement
 
Methods inherited from class uwcse.location.FusionClientService
callFusionServiceRpc, getFusionServiceIDSet
 
Methods inherited from class uwcse.location.LocationService
addObject, callLocationRpc, correctedTimeMillis, getObject, getSysclockError, handleTerminalCommand, multicastLocationMsg, multicastLocationMsgs, processLocationMsg, processLocationRpc, runTerminalCommandLoop, sendLocationMsg, sendLocationMsgs, setDescription
 
Methods inherited from class com.intel.research.rain.Service
getDaemon, getDispatcher, getServiceID, process, receive, setDaemon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOCK_FREQ_HZ

public static final int CLOCK_FREQ_HZ

BEACON_OFFSET_BODHI

public static final int BEACON_OFFSET_BODHI

SPEED_OF_SOUND

public static final double SPEED_OF_SOUND

m_serialPortThread

protected CricketSerialPortThread m_serialPortThread

m_serialPort

protected javax.comm.SerialPort m_serialPort

m_cricketName

protected String m_cricketName

m_packetThread

protected CricketDriver.CricketPacketThread m_packetThread

m_packetQueue

protected ProducerConsumerQueue m_packetQueue
Constructor Detail

CricketDriver

public CricketDriver(String portName,
                     String cricketName)
              throws RainException,
                     LocationException,
                     IOException
Throws:
RainException
LocationException
IOException
Method Detail

openSerialPort

protected void openSerialPort(String portName)
                       throws javax.comm.NoSuchPortException,
                              javax.comm.PortInUseException,
                              IOException,
                              javax.comm.UnsupportedCommOperationException,
                              TooManyListenersException
Open the specified serial port at the given baud rate.

Throws:
javax.comm.NoSuchPortException
javax.comm.PortInUseException
IOException
javax.comm.UnsupportedCommOperationException
TooManyListenersException

closeSerialPort

protected void closeSerialPort()
Close serial port and remove the event listener.


bodhisToMeters

public static double bodhisToMeters(double bodhis)
This method converts "bodhis", the internal distance measurement units of the crickets to meters. Bodhis are nonstandard units derived from processor the clock speed of the crickets and the speed of sound.


withdraw

protected void withdraw()
Overridden to close the serial port if necessary before withdrawing from Rain.

Overrides:
withdraw in class SensorDriver

printUsageAndExit

protected static void printUsageAndExit()
Show the program argument usage and then exit.


main

public static void main(String[] argv)
Run the CricketDriver.



This documentation is for the Location Stack v0.8. The latest distribution, the documentation, and the list of contributors to the Location Stack can always be found at http://portolano.cs.washington.edu/projects/location/

© Copyright 2004 University of Washington CSE