CarValue

@CarProtocol
@RequiresCarApi(value = 3)
class CarValue<T>


A data value object returned from car hardware with associated metadata including status, timestamp, and the actual value.

Parameters
<T>

data type which is returned by the CarValue

Summary

Constants

const Int

CarValue was obtained successfully.

const Int

CarValue attempted for unavailable property, sensor, or action.

const Int

CarValue attempted for unimplemented property, sensor, or action.

const Int

CarValue has unknown status.

Public constructors

CarValue(value: T?, timestampMillis: Long, status: Int)

Constructs a new instance of a CarValue.

@ExperimentalCarApi
CarValue(
    value: T?,
    timestampMillis: Long,
    status: Int,
    zones: (Mutable)List<CarZone!>
)

Constructs a new instance of a CarValue.

Public functions

Boolean
equals(other: Any?)
(Mutable)List<CarZone!>

Returns a list of car zones associated with this CarValue.

Int

Returns the status of this particular result such as success, unavailable, or unimplemented.

Long

Returns the time in milliseconds at which the event happened.

T?

Returns a the data value or null if the status is not successful.

Int
String

Constants

STATUS_SUCCESS

Added in 1.1.0
const val STATUS_SUCCESS = 1: Int

CarValue was obtained successfully.

STATUS_UNAVAILABLE

Added in 1.1.0
const val STATUS_UNAVAILABLE = 3: Int

CarValue attempted for unavailable property, sensor, or action.

For example, the car hardware might not be able to return a value such as climate at the current time because the engine is off and will set the status to this value.

STATUS_UNIMPLEMENTED

Added in 1.1.0
const val STATUS_UNIMPLEMENTED = 2: Int

CarValue attempted for unimplemented property, sensor, or action.

For example, the car hardware might not be able to return a value such as speed or energy level and will set the status to this value.

STATUS_UNKNOWN

Added in 1.1.0
const val STATUS_UNKNOWN = 0: Int

CarValue has unknown status.

Public constructors

CarValue

Added in 1.1.0
CarValue(value: T?, timestampMillis: Long, status: Int)

Constructs a new instance of a CarValue. Uses CAR_ZONE_GLOBAL as the zone for this instance.

Parameters
value: T?

data to be returned with the result

timestampMillis: Long

the time in milliseconds when the value was generated (see getTimestampMillis)

status: Int

the status code associated with this value

CarValue

Added in 1.3.0
@ExperimentalCarApi
CarValue(
    value: T?,
    timestampMillis: Long,
    status: Int,
    zones: (Mutable)List<CarZone!>
)

Constructs a new instance of a CarValue.

Parameters
value: T?

data to be returned with the result

timestampMillis: Long

the time in milliseconds when the value was generated (see getTimestampMillis)

status: Int

the status code associated with this value

zones: (Mutable)List<CarZone!>

the car zones associated with this value

Public functions

equals

Added in 1.4.0-rc02
fun equals(other: Any?): Boolean

getCarZones

Added in 1.3.0
@ExperimentalCarApi
fun getCarZones(): (Mutable)List<CarZone!>

Returns a list of car zones associated with this CarValue.

For a global vehicle function, the list will only contain GLOBAL_ZONE. Returns an empty list when getStatus is STATUS_UNIMPLEMENTED.

getStatus

Added in 1.1.0
fun getStatus(): Int

Returns the status of this particular result such as success, unavailable, or unimplemented.

getTimestampMillis

Added in 1.1.0
fun getTimestampMillis(): Long

Returns the time in milliseconds at which the event happened.

For a given property, sensor, or action, each new value's timestamp should be monotonically increasing using the same time base as SystemClock.elapsedRealtime().

getValue

Added in 1.1.0
fun getValue(): T?

Returns a the data value or null if the status is not successful.

See also
getStatus

hashCode

Added in 1.4.0-rc02
fun hashCode(): Int

toString

Added in 1.4.0-rc02
fun toString(): String