Class FileSensorDataReader

java.lang.Object
se.hendeby.sensordata.SensorDataReader
se.hendeby.sensordata.FileSensorDataReader

public class FileSensorDataReader extends SensorDataReader
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 Details

    • FileSensorDataReader

      public FileSensorDataReader(String fname) throws IOException
      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

      public void start() throws IOException
      Start reading the log file.
      Specified by:
      start in class SensorDataReader
      Throws:
      IOException - If an I/O error is encountered an exception is thrown.
    • stop

      public void stop() throws IOException
      Stop reading the file. In this process the log file is closed.
      Specified by:
      stop in class SensorDataReader
      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:
      get in class SensorDataReader
      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

      public SensorData getSensorData()
      Description copied from class: SensorDataReader
      Extract the next received SensorData object Extracts a SensorData object from the receiver queue.
      Specified by:
      getSensorData in class SensorDataReader
      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:
      reset in class SensorDataReader
    • status

      public boolean status()
      Status of the log file reader.
      Specified by:
      status in class SensorDataReader
      Returns:
      Return true if the file can be read from.
    • getCellId

      public String getCellId(int id)
    • getAllCellRss

      public double[][] getAllCellRss()
    • getBssidId

      public String getBssidId(int id)
    • getSsidId

      public String getSsidId(int id)
    • getAllWifiRss

      public double[][] getAllWifiRss()