SensorEvent

public class SensorEvent

This class represents a KallistoSensor event and holds information such as the sensor’s type, the timestamp, accuracy and of course the sensor’s data.

Refer to the Kallisto device datasheet for the coordinate system.

Fields

accuracy

public int accuracy

The accuracy of this event.

Only reports KallistoSensorManager.SENSOR_STATUS_ACCURACY_HIGH for now.

rawTimestamp

public long rawTimestamp

The time at which the event happened in nanoseconds.

This time is generated by the Kallisto device and doesn’t have any relation with the real time. Beware that it uses a 32 bit counter in microseconds so it will overflow after 2³²-1 uS.

Since the transport layer is the Bluetooth Low Energy, there will be delays to the event delivery. A event generated will be delayed by the BLE connection (refer to the Bluetooth specification for details) and by queuing in the device side. Expect delays, in average, of about 100 ms.

sensor

public KallistoSensor sensor

The sensor that generated this event.

timestamp

public long timestamp

The time at which the event happened in nanoseconds.

Beware that some sensors doesn’t support synchronization so this field will be equal to the rawTimestamp.

This time is synchronized with SystemClock.elapsedRealtimeNanos() with a very simple algorithm that calculates the relation between the 0 in the device and the real time.

Since the transport layer is the Bluetooth Low Energy, there will be delays to the event delivery. A event generated will be delayed by the BLE connection (refer to the Bluetooth specification for details) and by queuing in the device side. Expect delays, in average, of about 100 ms.

values

public final float[] values

The length and contents of the values array depends on which KallistoSensor type is being monitored.

Some new sensor types were introduced:

: A new event with the value 1 is received when a fall is detected.

: A sensor of this type measures a voltage. Reports a single value with the voltage measured in milli-volts.

: A sensor of this type measures the equivalent CO2 concentrations. Reports a single value representing the concentration in parts-per-million (ppm).

: A sensor of this type measures the Total Volatile Organic Compound concentration. Reports a single value representing the concentration in parts-per-billion (ppb).

: A simple on/off button. Reports a button press with the value 1 and a 0 otherwise. Only reports transitions.

Refer to the Android documentation for the rest of the sensor types.

See android.hardware.SensorEvent.values.