Added in API level 34

CarPropertyManager.SetPropertyRequest

public static final class CarPropertyManager.SetPropertyRequest
extends Object implements CarPropertyManager.AsyncPropertyRequest

java.lang.Object
   ↳ android.car.hardware.property.CarPropertyManager.SetPropertyRequest<T>


A request for CarPropertyManager#setPropertiesAsync(List, long, CancellationSignal, Executor, SetPropertyCallback).

Summary

Public methods

int getAreaId()

Returns the area ID for the property of this request.

int getPropertyId()

Returns the ID for the property of this request.

int getRequestId()

Returns the unique ID for this request.

float getUpdateRateHz()

Gets the update rate for listening for property updates.

T getValue()

Gets the property value to set.

boolean isWaitForPropertyUpdate()

Gets whether to wait for property update event before calling success callback.

void setUpdateRateHz(float updateRateHz)

Sets the update rate in Hz for listening for property updates for continuous property.

void setWaitForPropertyUpdate(boolean waitForPropertyUpdate)

Sets whether to wait for the property update event before calling success callback.

String toString()

Prints out debug message.

Inherited methods

Public methods

getAreaId

Added in API level 34
public int getAreaId ()

Returns the area ID for the property of this request.

Returns
int

getPropertyId

Added in API level 34
public int getPropertyId ()

Returns the ID for the property of this request.

The ID must be one of the VehiclePropertyIds or vendor property IDs.

Returns
int

getRequestId

Added in API level 34
public int getRequestId ()

Returns the unique ID for this request.

Each request must have a unique request ID so the responses can be differentiated.

Returns
int

getUpdateRateHz

Added in API level 34
public float getUpdateRateHz ()

Gets the update rate for listening for property updates.

Returns
float

getValue

Added in API level 34
public T getValue ()

Gets the property value to set.

Returns
T

isWaitForPropertyUpdate

Added in API level 34
public boolean isWaitForPropertyUpdate ()

Gets whether to wait for property update event before calling success callback.

Returns
boolean

setUpdateRateHz

Added in API level 34
public void setUpdateRateHz (float updateRateHz)

Sets the update rate in Hz for listening for property updates for continuous property.

If waitForPropertyUpdate is set to true (by default) and if the property is set to a different value than its current value, the success callback will be called when a property update event for the new value arrived. This option controls how frequent the property update event should be reported for continuous property. This is similar to updateRateHz in CarPropertyManager#registerCallback.

This is ignored for non-continuous properties.

This is ignored if waitForPropertyUpdate is set to false.

Parameters
updateRateHz float

setWaitForPropertyUpdate

Added in API level 34
public void setWaitForPropertyUpdate (boolean waitForPropertyUpdate)

Sets whether to wait for the property update event before calling success callback.

This arguments controls under what conditions the operation is considered succeeded and the success callback will be called.

If this is set to true (by default), the success callback will be called when both of the following coniditions are met:

  • the set operation is successfully delivered to vehicle bus.
  • the mPropertyId+mAreaId's value already equal to mValue or is successfully updated to the mValue through the set operation.

Even if the target value is the same as the current value, we will still send the set operation to the vehicle bus. If caller wants to reduce unnecessary overhead, caller must check existing values before issuing the requests.

If the first condition fails, the error callback will be called. If the second condition fails, which means we don't see the property updated to the target value within a specified timeout, the error callback will be called with CarPropertyManager.STATUS_ERROR_TIMEOUT.

If this is set to false, the success callback will be called after the set operation is successfully delivered to vehicle bus.

Under most cases, client should wait for the property update to verify that the set operation actually succeeded.

For cases when the property is write-only (no way to get property update event) or when the property represents some action, instead of an actual state, e.g. key stroke where the property's current value is not meaningful, caller should set waitForPropertyUpdate to false.

For HVAC_TEMPERATURE_VALUE_SUGGESTION, this must be set to false because the updated property value will not be the same as the value to be set.

Note that even if this is set to true, it is only guaranteed that the property value is the target value after the success callback is called if no other clients are changing the property at the same time. It is always possible that another client changes the property value after the property is updated to the target value, but before the client success callback runs. We only guarantee that at some point during the period after the client issues the request and before the success callback is called, the property value was set to the target value.

Parameters
waitForPropertyUpdate boolean

toString

Added in API level 34
public String toString ()

Prints out debug message.

Returns
String