Class MobileClient
java.lang.Object
MobileClient
- All Implemented Interfaces:
- Constants, DatagramUpdateListener, UltrasoundUpdateListener
- public class MobileClient
- extends java.lang.Object
- implements UltrasoundUpdateListener, DatagramUpdateListener, Constants
This class provides location awareness to the granularity of a room
inside a building based on the reception of 802.11 broadcasts and the
corresponding detection of ultrasound. This class is intended to be used
by an application running on a mobile device. If the mobile device moves
close to a desktop running the ServerBeacon class/application, it will
know that it is in the same room as the desktop based on the information
provided by this MobileClient class.
An application using this class needs to provide a reference to a
LocationTracker object in the MobileClient class's constructor so that
the MobileClient class can signal the LocationTracker object when a room
change has occurred.
The MobileClient class implements both an UltrasoundUpdateListener
and a DatagramUpdateListener so that it can be informed of ultrasound
detections and datagram receptions.
Fields inherited from interface Constants |
AVG_DETECT_TIME, BIGEND, DEBOUNCE_VAL, GROUPADDR, HISTORY_SIZE, MAX_DETECT_TIME, MAXMSGSIZE, N, NUMTHREADS, PORTNUM, ROOM_MSG_BUF, SAMPLE_SIZE, SAMPLING_RATE, SEQUENCE, SIGN, TARGET_FREQUENCY, WEIGHT |
Method Summary |
void |
datagramDetected(java.lang.String message,
long timeDetected)
Callback method for the DatagramListener thread that receives
notifications of newly received datagram messages. |
void |
ultrasoundDetected(long timeDetected)
Callback method for the UltrasoundListener thread that receives
notifications of newly received ultrasound detections. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
notifyApp
protected LocationTracker notifyApp
messageHistory
protected Room[] messageHistory
msgHistInd
protected int msgHistInd
detections
protected java.lang.String[] detections
latestUpdate
protected int latestUpdate
debug
protected boolean debug
MobileClient
public MobileClient(LocationTracker extApp,
boolean inDebug)
- This is the only constructor for this class. It takes a reference
to a LocationTracker object so that the MobileClient class
can notify the object when a room change has occurred. No other
constructor is provided because the MobileClient class must have
access to a roomChanged() method.
- Parameters:
extApp
- Reference to the LocationTracker object that
will receive room change notifications.inDebug
- Whether or not to turn debugging information
on.
ultrasoundDetected
public void ultrasoundDetected(long timeDetected)
- Callback method for the UltrasoundListener thread that receives
notifications of newly received ultrasound detections. This
method attempts to correlate the time of the received ultrasound
detection with the time of one of the previously received
datagram transmissions in order to make a determination of room
location.
- Specified by:
ultrasoundDetected
in interface UltrasoundUpdateListener
- Parameters:
timeDetected
- The time (in milliseconds since January 1,
1970) at which the ultrasound was
received.
datagramDetected
public void datagramDetected(java.lang.String message,
long timeDetected)
- Callback method for the DatagramListener thread that receives
notifications of newly received datagram messages. This method
stores the received datagram message and the time at which it was
received for later correlation with ultrasound detections. If an
ultrasound detection is later correlated with the datagram
message received by this callback method, then the received
datagram message describes the current room location.
- Specified by:
datagramDetected
in interface DatagramUpdateListener
- Parameters:
timeDetected
- The time (in milliseconds since January 1,
1970) at which the datagram message was
received.message
- The string that was transmitted in the datagram.