Package se.hendeby.sensordata
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
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] |
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytefinal SensorInfoType of the measurement in terms of a SensorInfo object.longTime when the measurement was made [ms] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SensorDatadeserialize(byte[] data) Deserialize a byte[] to a measurement in a SensorData object.longgetTime()Timestamp getter.float[]Measurement values getter.byte[]Serialize the measurement for streaming or saving to file.
-
Field Details
-
time
public long timeTime when the measurement was made [ms] -
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
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
Deserialize a byte[] to a measurement in a SensorData object. Data serialized using theserialize.- Parameters:
data- Data to be deserialized.- Returns:
- The measurement.
-