Package se.hendeby.sensordata
Class FileSensorDataReader
java.lang.Object
se.hendeby.sensordata.SensorDataReader
se.hendeby.sensordata.FileSensorDataReader
Class used to read measurement data from log files
This class is responsible for read measurement information from
log files created by the Sensor Fusion Android app. This is a
specialization of the
SensorDataReader class.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected double[]get(long maxDiff) Get a set of data with matching time stamp from the log file.double[][]double[][]getBssidId(int id) getCellId(int id) Extract the next received SensorData object Extracts a SensorData object from the receiver queue.getSsidId(int id) voidreset()Reset the reading of the log file.voidstart()Start reading the log file.booleanstatus()Status of the log file reader.voidstop()Stop reading the file.Methods inherited from class se.hendeby.sensordata.SensorDataReader
finalize, getAll, getNext
-
Constructor Details
-
FileSensorDataReader
Constructor. Construct the object given the name of the file to be used as log file.- Parameters:
fname- The path of the log file.- Throws:
IOException- Throws an exception on failure to open and read the log file.
-
-
Method Details
-
start
Start reading the log file.- Specified by:
startin classSensorDataReader- Throws:
IOException- If an I/O error is encountered an exception is thrown.
-
stop
Stop reading the file. In this process the log file is closed.- Specified by:
stopin classSensorDataReader- Throws:
IOException- If an I/O error is encountered and exception is thrown.
-
get
protected double[] get(long maxDiff) Get a set of data with matching time stamp from the log file. Reads the next available SensorData objects and return the measurements less than maxDiff milliseconds apart in a double vector, where the index in the vector is given by the SensorDatas offset value.- Specified by:
getin classSensorDataReader- Parameters:
maxDiff- Milliseconds between measurements to be considered from the same sample time.- Returns:
- A double array containing the measurements from the next available timestamp
-
getSensorData
Description copied from class:SensorDataReaderExtract the next received SensorData object Extracts a SensorData object from the receiver queue.- Specified by:
getSensorDatain classSensorDataReader- Returns:
- A SensorData object of null if there is no more queued objects.
-
reset
public void reset()Reset the reading of the log file. In doing so the log file is first closed and opened again.- Specified by:
resetin classSensorDataReader
-
status
public boolean status()Status of the log file reader.- Specified by:
statusin classSensorDataReader- Returns:
- Return true if the file can be read from.
-
getCellId
-
getAllCellRss
public double[][] getAllCellRss() -
getBssidId
-
getSsidId
-
getAllWifiRss
public double[][] getAllWifiRss()
-