CarPropertyManager.CarPropertyEventCallback

public static interface CarPropertyManager.CarPropertyEventCallback

android.car.hardware.property.CarPropertyManager.CarPropertyEventCallback


Application registers CarPropertyEventCallback object to receive updates and changes to subscribed Vehicle specific properties.

Summary

Public methods

abstract void onChangeEvent(CarPropertyValue<T> value)

Called when a property is updated.

default void onErrorEvent(int propertyId, int areaId, int errorCode)

Called when an error happens for a recent CarPropertyManager#setProperty.

abstract void onErrorEvent(int propertyId, int areaId)

Called when an error happens for a recent CarPropertyManager#setProperty.

Public methods

onChangeEvent

public abstract void onChangeEvent (CarPropertyValue<T> value)

Called when a property is updated.

For an on-change property or a continuous property with Variable Update Rate enabled (by default), this is called when a property's value or status changes.

For a continuous property with VUR disabled, this is called periodically based on the update rate.

This will also be called once to deliver the initial value (or a value with unavailable or error status) for every new subscription.

Parameters
value CarPropertyValue: the new value of the property

onErrorEvent

public void onErrorEvent (int propertyId, 
                int areaId, 
                int errorCode)

Called when an error happens for a recent CarPropertyManager#setProperty.

Note that CarPropertyManager#setPropertiesAsync will not trigger this. In the case of failure, CarPropertyManager.SetPropertyCallback#onFailure will be called.

Clients which changed the property value in the areaId most recently will receive this callback. If multiple clients set a property for the same area ID simultaneously, which one takes precedence is undefined. Typically, the last set operation (in the order that they are issued to car's ECU) overrides the previous set operations. The delivered error reflects the error happened in the last set operation.

If clients override this, implementation does not have to call CarPropertyEventCallback#onErrorEvent(int, int) inside this function. CarPropertyEventCallback#onErrorEvent(int, int) should be overridden as no-op.

Parameters
propertyId int: the property ID which is detected an error

areaId int: the area ID which is detected an error

errorCode int: the error code is raised in the car Value is CarPropertyManager.CAR_SET_PROPERTY_ERROR_CODE_TRY_AGAIN, CarPropertyManager.CAR_SET_PROPERTY_ERROR_CODE_INVALID_ARG, CarPropertyManager.CAR_SET_PROPERTY_ERROR_CODE_PROPERTY_NOT_AVAILABLE, CarPropertyManager.CAR_SET_PROPERTY_ERROR_CODE_ACCESS_DENIED, or CarPropertyManager.CAR_SET_PROPERTY_ERROR_CODE_UNKNOWN

onErrorEvent

public abstract void onErrorEvent (int propertyId, 
                int areaId)

Called when an error happens for a recent CarPropertyManager#setProperty.

Parameters
propertyId int: the property ID which has detected an error

areaId int: the area ID which has detected an error

Client is recommended to override CarPropertyEventCallback#onErrorEvent(int, int, int) and override this as no-op.

For legacy clients, CarPropertyEventCallback#onErrorEvent(int, int, int) should use the default implementation, which will internally call this.