CarPropertyValue

public final class CarPropertyValue
extends Object implements Parcelable

java.lang.Object
   ↳ android.car.hardware.CarPropertyValue<T>


Stores a value for a vehicle property ID and area ID combination. Client should use android.car.* types when dealing with property ID, area ID or property value and MUST NOT use android.hardware.automotive.vehicle.* types directly.

Summary

Constants

int STATUS_AVAILABLE

CarPropertyValue is available.

int STATUS_ERROR

CarPropertyValue has an error.

int STATUS_UNAVAILABLE

CarPropertyValue is unavailable.

Inherited constants

Fields

public static final Creator<CarPropertyValue<T>> CREATOR

Public methods

int describeContents()
boolean equals(Object object)

Checks equality with passed object.

int getAreaId()

Returns the area identifier.

int getPropertyId()

Returns the property identifier.

int getStatus()

This method was deprecated in API level 34. This should be added back in next major Android release.

long getTimestamp()

Returns the timestamp in nanoseconds at which the CarPropertyValue happened.

T getValue()

Returns the value for CarPropertyValue.

int hashCode()

Generates hash code for this instance.

void writeToParcel(Parcel dest, int flags)

Inherited methods

Constants

STATUS_AVAILABLE

Added in API level 29
public static final int STATUS_AVAILABLE

CarPropertyValue is available.

Constant Value: 0 (0x00000000)

STATUS_ERROR

Added in API level 29
public static final int STATUS_ERROR

CarPropertyValue has an error.

Constant Value: 2 (0x00000002)

STATUS_UNAVAILABLE

Added in API level 29
public static final int STATUS_UNAVAILABLE

CarPropertyValue is unavailable.

Constant Value: 1 (0x00000001)

Fields

CREATOR

Added in API level 29
public static final Creator<CarPropertyValue<T>> CREATOR

Public methods

describeContents

Added in API level 29
public int describeContents ()

Returns
int

equals

Added in API level 29
public boolean equals (Object object)

Checks equality with passed object.

Parameters
object Object

Returns
boolean

getAreaId

Added in API level 29
public int getAreaId ()

Returns the area identifier.

Returns
int The area identifier of CarPropertyValue, If property is VehicleAreaType.VEHICLE_AREA_TYPE_GLOBAL, it will be 0. Otherwise, it will be on or more OR'd together constants of this property's VehicleAreaType:

getPropertyId

Added in API level 29
public int getPropertyId ()

Returns the property identifier.

Returns
int The property identifier of CarPropertyValue. See constants in VehiclePropertyIds for some system defined possible values.

getStatus

Added in API level 29
Deprecated in API level 34
public int getStatus ()

This method was deprecated in API level 34.
This should be added back in next major Android release.

Returns
int Status of CarPropertyValue Value is STATUS_AVAILABLE, STATUS_UNAVAILABLE, or STATUS_ERROR

getTimestamp

Added in API level 29
public long getTimestamp ()

Returns the timestamp in nanoseconds at which the CarPropertyValue happened. For a given car property, each new CarPropertyValue should be monotonically increasing using the same time base as SystemClock.elapsedRealtimeNanos().

NOTE: Timestamp should be synchronized with other signals from the platform (e.g. Location and SensorEvent instances). Ideally, timestamp synchronization error should be below 1 millisecond.

Returns
long

getValue

Added in API level 29
public T getValue ()

Returns the value for CarPropertyValue.

Note:Caller must check the value of getStatus(). Only use getValue() when getStatus() is STATUS_AVAILABLE. If not, getValue() is meaningless.

Returns
T

hashCode

Added in API level 29
public int hashCode ()

Generates hash code for this instance.

Returns
int

writeToParcel

Added in API level 29
public void writeToParcel (Parcel dest, 
                int flags)

Parameters
dest Parcel

flags int