org.placelab.core
Class NetStumblerFileParser
java.lang.Object
org.placelab.spotter.AbstractSpotter
org.placelab.spotter.SyncSpotter
org.placelab.spotter.LogSpotter
org.placelab.core.NetStumblerFileParser
- All Implemented Interfaces:
- Spotter
- public class NetStumblerFileParser
- extends LogSpotter
NetStumblerFileParser will read an exported tab-separated text-log from NetStumbler
and read it line by line. Each line corresponds to a NetStumblerMeasurement.
We take each measurement and add it to a List.
There is a trick we do to get the absolute timestamp. We get the date from the
3rd line of the logfile and then parse out the year, month and day
Below is an example of a Netstumbler output:
# $Creator: Network Stumbler Version 0.3.30
# $Format: wi-scan with extensions
# Latitude Longitude ( SSID ) Type ( BSSID ) Time (GMT) [ SNR Sig Noise ] ...
$ $Date GMT: 2004-04-06
N 47.6619200 E122.3162617 ( default ) BBS ( 00:80:c8:19:5a:1d ) 01:25:07 (GMT) [ 35 87 52 ]
N 47.6619200 E122.3162617 ( linksys-g ) BBS ( 00:0c:41:14:a1:92 ) 01:25:07 (GMT) [ 23 73 50 ]
N 47.6619200 E122.3162617 ( 1100 ) BBS ( 00:0d:28:88:c7:56 ) 01:25:07 (GMT) [ 14 72 53 ]
| Methods inherited from class org.placelab.spotter.AbstractSpotter |
addListener, notifyEndOfScan, notifyEndOfScan, notifyGotException, notifyGotException, notifyGotMeasurement, notifyGotMeasurement, removeListener, scanOnce, scanOnce, waitForThread |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IgnoreDuplicateReading
public static boolean IgnoreDuplicateReading
NETSTUMBLER_RSSI_ADJUSTMENT
public static final int NETSTUMBLER_RSSI_ADJUSTMENT
- See Also:
- Constant Field Values
NetStumblerFileParser
public NetStumblerFileParser(java.lang.String tracefile)
throws java.io.IOException
open
public void open()
- Description copied from interface:
Spotter
- Load resources used by the spotter. Applications should be able to
invoke this methods multiple times in sequence and have the "right" things happen.
All Spotters should be opened before being used.
close
public void close()
- Description copied from interface:
Spotter
- Unloads resources used by the spotter. Multiple calls to close are ok.
readLine
public NetStumblerReading readLine()
throws java.io.IOException
- Throws:
java.io.IOException
readMeasurement
public StumblerMeasurement readMeasurement()
throws java.io.IOException
- Throws:
java.io.IOException
isValidFile
public static boolean isValidFile(java.lang.String file)
isValidFirstLine
public static boolean isValidFirstLine(java.lang.String line)
getMeasurementFromLog
public Measurement getMeasurementFromLog()
- Description copied from class:
LogSpotter
- Returns a single Measurement from the log, or null if there are no Measurements
remaining. This method is only of interest to implementers of LogSpotters, users
should instead call
Spotter.getMeasurement()
- Specified by:
getMeasurementFromLog in class LogSpotter