Class SensorData

java.lang.Object
se.hendeby.sensordata.SensorData
Direct Known Subclasses:
AccData, BleRssData, CellRssData, GPSData, GyrData, LightData, MagData, OrientData, PressureData, ProximityData, RawGyrData, RawMagData, TempData, WifiRssData

public class SensorData extends Object
Base class for all measurement data objects. Current layout of data fields:
Position Description
0 time [ms]
1-3 accelerometer; x, y, z [m/s^2]
4-6 gyroscope; x, y, z [rad/s]
7-9 magnetometer; x, y, z [uT]
10-12 GPS [deg North, deg East, alt m]
13 Pressure [hPa]
14 Light [lux]
15 Proximity [cm]
16 Temperature [deg C]
17-20 Orientation [normalized quaternion]
21-26 Uncalibrated gyroscope; x, y, z, bx, by, bz [rad/s]
27-32 Uncalibrated magnetometer; x, y, z, bx, by, bz [uT]
Data layout in MATLAB matrix
  • Field Details

    • time

      public long time
      Time when the measurement was made [ms]
    • sensorInfo

      public final SensorInfo sensorInfo
      Type of the measurement in terms of a SensorInfo object.
    • DATA_FIELDS_USED

      public static final byte DATA_FIELDS_USED
      See Also:
  • Constructor Details

    • SensorData

      public SensorData(SensorInfo sensorInfo, long time, float[] values)
      Constructor.
      Parameters:
      sensorInfo - Type of measurement.
      time - Timestamp of the measurement [ms].
      values - The measurements.
  • Method Details

    • getTime

      public long getTime()
      Timestamp getter.
      Returns:
      The timestamp in milliseconds.
    • getValues

      public float[] getValues()
      Measurement values getter.
      Returns:
      The associated measurements.
    • serialize

      public byte[] serialize()
      Serialize the measurement for streaming or saving to file.
      Returns:
      The serialized measurement in a byte array.
    • deserialize

      public static SensorData deserialize(byte[] data)
      Deserialize a byte[] to a measurement in a SensorData object. Data serialized using the serialize.
      Parameters:
      data - Data to be deserialized.
      Returns:
      The measurement.