# CarSensorEvent

Summary:[Nested Classes](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#nestedclasses)\|[Constants](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#constants)\|[Inherited Constants](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#inhconstants)\|[Fields](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#lfields)\|[Methods](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#inhmethods)  

# CarSensorEvent

`
public


class
CarSensorEvent
`  
`

extends Object


``


implements

Parcelable


`

|---|-------------------------------------|
| java.lang.Object                       ||
| ↳ | android.car.hardware.CarSensorEvent |

<br />

*** ** * ** ***

<br />

**This class is deprecated.**   
consider using[CarPropertyValue](https://developer.android.com/reference/android/car/hardware/CarPropertyValue)and[CarPropertyManager](https://developer.android.com/reference/android/car/hardware/property/CarPropertyManager)instead.

A CarSensorEvent object corresponds to a single sensor event coming from the car. The sensor data is stored in a sensor-type specific format in the object's float and byte arrays. To aid unmarshalling the object's data arrays, this class provides static nested classes and conversion methods. The conversion methods each have an optional data parameter which, if not null, will be used and returned. This parameter should be used to avoid unnecessary object churn whenever possible. Additionally, calling a conversion method on a CarSensorEvent object with an inappropriate type will result in an`UnsupportedOperationException`being thrown.

## Summary

|                                                                                    ### Nested classes                                                                                    ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [CarSensorEvent.EnvironmentData](https://developer.android.com/reference/android/car/hardware/CarSensorEvent.EnvironmentData) Environment data with timestamp and temperature. |

|                                                                                                                                                                    ### Constants                                                                                                                                                                    ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [GEAR_DRIVE](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_DRIVE) This is for transmission without specific gear number for moving forward like CVT.                                                                                                                                                      |
| `int` | [GEAR_EIGHTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_EIGHTH) Gear number 8.                                                                                                                                                                                                                        |
| `int` | [GEAR_FIFTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_FIFTH) Gear number 5.                                                                                                                                                                                                                          |
| `int` | [GEAR_FIRST](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_FIRST) intValues\[0\] from 1 to 99 represents transmission gear number for moving forward.                                                                                                                                                     |
| `int` | [GEAR_FOURTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_FOURTH) Gear number 4.                                                                                                                                                                                                                        |
| `int` | [GEAR_NEUTRAL](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_NEUTRAL) GEAR_\* represents meaning of intValues\[0\] for[CarSensorManager.SENSOR_TYPE_GEAR](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_GEAR)sensor type.                                     |
| `int` | [GEAR_NINTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_NINTH) Gear number 9.                                                                                                                                                                                                                          |
| `int` | [GEAR_PARK](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_PARK) Gear in parking state                                                                                                                                                                                                                     |
| `int` | [GEAR_REVERSE](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_REVERSE) Gear in reverse                                                                                                                                                                                                                     |
| `int` | [GEAR_SECOND](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_SECOND) Gear number 2.                                                                                                                                                                                                                        |
| `int` | [GEAR_SEVENTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_SEVENTH) Gear number 7.                                                                                                                                                                                                                      |
| `int` | [GEAR_SIXTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_SIXTH) Gear number 6.                                                                                                                                                                                                                          |
| `int` | [GEAR_TENTH](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_TENTH) Gear number 10.                                                                                                                                                                                                                         |
| `int` | [GEAR_THIRD](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#GEAR_THIRD) Gear number 3.                                                                                                                                                                                                                          |
| `int` | [IGNITION_STATE_ACC](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#IGNITION_STATE_ACC) Accessory is turned off, but engine is not running yet (for EV car is not ready to move).                                                                                                                               |
| `int` | [IGNITION_STATE_LOCK](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#IGNITION_STATE_LOCK) Steering wheel is locked.                                                                                                                                                                                             |
| `int` | [IGNITION_STATE_OFF](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#IGNITION_STATE_OFF) Typically engine is off, but steering wheel is unlocked.                                                                                                                                                                |
| `int` | [IGNITION_STATE_ON](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#IGNITION_STATE_ON) In this state engine typically is running (for EV, car is ready to move).                                                                                                                                                 |
| `int` | [IGNITION_STATE_START](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#IGNITION_STATE_START) In this state engine is typically starting (cranking).                                                                                                                                                              |
| `int` | [IGNITION_STATE_UNDEFINED](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#IGNITION_STATE_UNDEFINED) Ignition state is unknown.                                                                                                                                                                                  |
| `int` | [INDEX_ENVIRONMENT_TEMPERATURE](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#INDEX_ENVIRONMENT_TEMPERATURE) Index for[CarSensorManager.SENSOR_TYPE_ENV_OUTSIDE_TEMPERATURE](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_ENV_OUTSIDE_TEMPERATURE)in floatValues. |
| `int` | [INDEX_WHEEL_DISTANCE_FRONT_LEFT](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#INDEX_WHEEL_DISTANCE_FRONT_LEFT) <br />                                                                                                                                                                                        |
| `int` | [INDEX_WHEEL_DISTANCE_FRONT_RIGHT](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#INDEX_WHEEL_DISTANCE_FRONT_RIGHT) <br />                                                                                                                                                                                      |
| `int` | [INDEX_WHEEL_DISTANCE_REAR_LEFT](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#INDEX_WHEEL_DISTANCE_REAR_LEFT) <br />                                                                                                                                                                                          |
| `int` | [INDEX_WHEEL_DISTANCE_REAR_RIGHT](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#INDEX_WHEEL_DISTANCE_REAR_RIGHT) <br />                                                                                                                                                                                        |
| `int` | [INDEX_WHEEL_DISTANCE_RESET_COUNT](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#INDEX_WHEEL_DISTANCE_RESET_COUNT) Index for[CarSensorManager.SENSOR_TYPE_WHEEL_TICK_DISTANCE](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_WHEEL_TICK_DISTANCE)in longValues.    |

|                                                                                                                                                                 ### Inherited constants                                                                                                                                                                 |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface`android.os.Parcelable` |-------|----------------------------------------| | `int` | `CONTENTS_FILE_DESCRIPTOR` <br />      | | `int` | `PARCELABLE_ELIDE_DUPLICATES` <br />   | | `int` | `PARCELABLE_STABILITY_LOCAL` <br />    | | `int` | `PARCELABLE_STABILITY_VINTF` <br />    | | `int` | `PARCELABLE_WRITE_RETURN_VALUE` <br /> | |

|                                                                                                                                                                                                     ### Fields                                                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public static final Creator<`[CarSensorEvent](https://developer.android.com/reference/android/car/hardware/CarSensorEvent)`>` | [CREATOR](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#CREATOR) <br />                                                                                                                                                                              |
| ` public final float[]`                                                                                                         | [floatValues](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#floatValues) array holding float type of sensor data.                                                                                                                                    |
| ` public final int[]`                                                                                                           | [intValues](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#intValues) array holding int type of sensor data                                                                                                                                           |
| ` public final long[]`                                                                                                          | [longValues](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#longValues) array holding long int type of sensor data                                                                                                                                    |
| ` public int`                                                                                                                   | [sensorType](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#sensorType) Sensor type for this event like[CarSensorManager.SENSOR_TYPE_CAR_SPEED](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_CAR_SPEED). |
| ` public long`                                                                                                                  | [timestamp](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#timestamp) When this data was received from car.                                                                                                                                           |

|                                                                             ### Public methods                                                                              ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`  | ` `[describeContents](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#describeContents())`() `                                         |
| ` void` | ` `[writeToParcel](https://developer.android.com/reference/android/car/hardware/CarSensorEvent#writeToParcel(android.os.Parcel,%20int))`(Parcel dest, int flags) ` |

| ### Inherited methods |
|-----------------------|---|
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||
| From interface` android.os.Parcelable ` |------------------|------------------------------------------| | ` abstract int`  | ` describeContents() `                   | | ` default int`   | ` getStability() `                       | | ` abstract void` | ` writeToParcel(Parcel arg0, int arg1) ` | ||

## Constants

### GEAR_DRIVE

```
public static final int GEAR_DRIVE
```

This is for transmission without specific gear number for moving forward like CVT. It tells that car is in a transmission state to move it forward.

<br />

Constant Value: 8 (0x00000008)  

### GEAR_EIGHTH

```
public static final int GEAR_EIGHTH
```

Gear number 8.

<br />

Constant Value: 2048 (0x00000800)  

### GEAR_FIFTH

```
public static final int GEAR_FIFTH
```

Gear number 5.

<br />

Constant Value: 256 (0x00000100)  

### GEAR_FIRST

```
public static final int GEAR_FIRST
```

intValues\[0\] from 1 to 99 represents transmission gear number for moving forward. GEAR_FIRST is for gear number 1.

<br />

Constant Value: 16 (0x00000010)  

### GEAR_FOURTH

```
public static final int GEAR_FOURTH
```

Gear number 4.

<br />

Constant Value: 128 (0x00000080)  

### GEAR_NEUTRAL

```
public static final int GEAR_NEUTRAL
```

GEAR_\* represents meaning of intValues\[0\] for[CarSensorManager.SENSOR_TYPE_GEAR](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_GEAR)sensor type. GEAR_NEUTRAL means transmission gear is in neutral state, and the car may be moving.

<br />

Constant Value: 1 (0x00000001)  

### GEAR_NINTH

```
public static final int GEAR_NINTH
```

Gear number 9.

<br />

Constant Value: 4096 (0x00001000)  

### GEAR_PARK

```
public static final int GEAR_PARK
```

Gear in parking state

<br />

Constant Value: 4 (0x00000004)  

### GEAR_REVERSE

```
public static final int GEAR_REVERSE
```

Gear in reverse

<br />

Constant Value: 2 (0x00000002)  

### GEAR_SECOND

```
public static final int GEAR_SECOND
```

Gear number 2.

<br />

Constant Value: 32 (0x00000020)  

### GEAR_SEVENTH

```
public static final int GEAR_SEVENTH
```

Gear number 7.

<br />

Constant Value: 1024 (0x00000400)  

### GEAR_SIXTH

```
public static final int GEAR_SIXTH
```

Gear number 6.

<br />

Constant Value: 512 (0x00000200)  

### GEAR_TENTH

```
public static final int GEAR_TENTH
```

Gear number 10.

<br />

Constant Value: 8192 (0x00002000)  

### GEAR_THIRD

```
public static final int GEAR_THIRD
```

Gear number 3.

<br />

Constant Value: 64 (0x00000040)  

### IGNITION_STATE_ACC

```
public static final int IGNITION_STATE_ACC
```

Accessory is turned off, but engine is not running yet (for EV car is not ready to move).

<br />

Constant Value: 3 (0x00000003)  

### IGNITION_STATE_LOCK

```
public static final int IGNITION_STATE_LOCK
```

Steering wheel is locked.

<br />

Constant Value: 1 (0x00000001)  

### IGNITION_STATE_OFF

```
public static final int IGNITION_STATE_OFF
```

Typically engine is off, but steering wheel is unlocked.

<br />

Constant Value: 2 (0x00000002)  

### IGNITION_STATE_ON

```
public static final int IGNITION_STATE_ON
```

In this state engine typically is running (for EV, car is ready to move).

<br />

Constant Value: 4 (0x00000004)  

### IGNITION_STATE_START

```
public static final int IGNITION_STATE_START
```

In this state engine is typically starting (cranking).

<br />

Constant Value: 5 (0x00000005)  

### IGNITION_STATE_UNDEFINED

```
public static final int IGNITION_STATE_UNDEFINED
```

Ignition state is unknown. The constants that starts with IGNITION_STATE_ represent values for[CarSensorManager.SENSOR_TYPE_IGNITION_STATE](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_IGNITION_STATE)sensor.

<br />

Constant Value: 0 (0x00000000)  

### INDEX_ENVIRONMENT_TEMPERATURE

```
public static final int INDEX_ENVIRONMENT_TEMPERATURE
```

Index for[CarSensorManager.SENSOR_TYPE_ENV_OUTSIDE_TEMPERATURE](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_ENV_OUTSIDE_TEMPERATURE)in floatValues. Temperature in Celsius degrees.

<br />

Constant Value: 0 (0x00000000)  

### INDEX_WHEEL_DISTANCE_FRONT_LEFT

```
public static final int INDEX_WHEEL_DISTANCE_FRONT_LEFT
```

<br />

<br />

Constant Value: 1 (0x00000001)  

### INDEX_WHEEL_DISTANCE_FRONT_RIGHT

```
public static final int INDEX_WHEEL_DISTANCE_FRONT_RIGHT
```

<br />

<br />

Constant Value: 2 (0x00000002)  

### INDEX_WHEEL_DISTANCE_REAR_LEFT

```
public static final int INDEX_WHEEL_DISTANCE_REAR_LEFT
```

<br />

<br />

Constant Value: 4 (0x00000004)  

### INDEX_WHEEL_DISTANCE_REAR_RIGHT

```
public static final int INDEX_WHEEL_DISTANCE_REAR_RIGHT
```

<br />

<br />

Constant Value: 3 (0x00000003)  

### INDEX_WHEEL_DISTANCE_RESET_COUNT

```
public static final int INDEX_WHEEL_DISTANCE_RESET_COUNT
```

Index for[CarSensorManager.SENSOR_TYPE_WHEEL_TICK_DISTANCE](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_WHEEL_TICK_DISTANCE)in longValues. RESET_COUNT is incremented whenever the HAL detects that a sensor reset has occurred. It represents to the upper layer that the WHEEL_DISTANCE values will not be contiguous with other values reported with a different RESET_COUNT.

<br />

Constant Value: 0 (0x00000000)

## Fields

### CREATOR

```
public static final Creator<CarSensorEvent> CREATOR
```

<br />

<br />

### floatValues

```
public final float[] floatValues
```

array holding float type of sensor data. If the sensor has single value, only floatValues\[0\] should be used.

<br />

### intValues

```
public final int[] intValues
```

array holding int type of sensor data

<br />

### longValues

```
public final long[] longValues
```

array holding long int type of sensor data

<br />

### sensorType

```
public int sensorType
```

Sensor type for this event like[CarSensorManager.SENSOR_TYPE_CAR_SPEED](https://developer.android.com/reference/android/car/hardware/CarSensorManager#SENSOR_TYPE_CAR_SPEED).

<br />

### timestamp

```
public long timestamp
```

When this data was received from car. It is elapsed real-time of data reception from car in nanoseconds since system boot.

<br />

## Public methods

### describeContents

```
public int describeContents ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### writeToParcel

```
public void writeToParcel (Parcel dest, 
                int flags)
```

<br />

<br />

|        Parameters        ||
|---------|-----------------|
| `dest`  | `Parcel` <br /> |
| `flags` | `int` <br />    |