The CarService interface abstracts a service that exposes properties each with a property and area id. More...
Inherits AutoCloseable.
Inherited by AndroidCarService, and DummyCarService.
Public Member Functions | |
void | close () |
Close the object, and release resources. | |
int | getAreaId (int propertyId, int area) |
Get the supported area id for the given property given a partial area id. | |
boolean | getBooleanProperty (int propertyId, int areaId, boolean defaultValue) |
Gets a boolean property with the given property and area id. | |
float | getFloatProperty (int propertyId, int areaId, float defaultValue) |
Gets a float property with the given property and area id. | |
Integer[] | getIntegerArrayProperty (int propertyId, int areaId, Integer[] defaultValue) |
Gets an integer array property with the given property and area id. | |
int | getIntProperty (int propertyId, int areaId, int defaultValue) |
Gets an integer property with the given property and area id. | |
String | getStringProperty (int propertyId, int areaId, String defaultValue) |
Gets a string property with the given property and area id. | |
boolean | isPropertyAvailable (int propertyId, int areaId) |
Checks whether a property and area id represent an existing property. | |
void | setBooleanProperty (int propertyId, int areaId, boolean value) |
Sets a boolean property with the given property and area id. | |
void | setFloatProperty (int propertyId, int areaId, float value) |
Sets a float property with the given property and area id. | |
void | setIntegerArrayProperty (int propertyId, int areaId, Integer[] value) |
Sets an integer array property with the given property and area id. | |
void | setIntProperty (int propertyId, int areaId, int value) |
Sets an int property with the given property and area id. | |
void | setStringProperty (int propertyId, int areaId, String value) |
Sets a string property with the given property and area id. | |
void | subscribeToPropertyValueChanges (int propertyId, CarPropertyChangeCallback callback) |
Subscribes to receive callbacks when the given property id is updated. | |
void | unsubscribeFromPropertyValueChanges (int propertyId, CarPropertyChangeCallback callback) |
Unsubscribes from a property changed callback. | |
The CarService interface abstracts a service that exposes properties each with a property and area id.
You can use it to get and set each property, and as subscribe for callbacks when property values change.
int getAreaId | ( | int | propertyId, |
int | area ) |
Get the supported area id for the given property given a partial area id.
For Example, if the area argument is 0x0001, but a property has an area of 0x003, this function returns 0x0003. However, if a property has an area of 0x000C, this method throws the IllegalArgumentException because the given area is not part of the configured area.
propertyId | The property id to query. |
area | The partial area to query. |
boolean getBooleanProperty | ( | int | propertyId, |
int | areaId, | ||
boolean | defaultValue ) |
Gets a boolean property with the given property and area id.
propertyId | The property id to retrieve. |
areaId | The area id to retrieve. |
defaultValue | If the service cannot read the current value of the property, the default value of the property. |
float getFloatProperty | ( | int | propertyId, |
int | areaId, | ||
float | defaultValue ) |
Gets a float property with the given property and area id.
propertyId | The property id to retrieve. |
areaId | The area id to retrieve. |
defaultValue | If the service cannot read the current value of the property, the default value of the property. |
Integer[] getIntegerArrayProperty | ( | int | propertyId, |
int | areaId, | ||
Integer[] | defaultValue ) |
Gets an integer array property with the given property and area id.
propertyId | The property id to retrieve. |
areaId | The area id to retrieve. |
defaultValue | If the service cannot read the current value of the property, the default value of the property. |
int getIntProperty | ( | int | propertyId, |
int | areaId, | ||
int | defaultValue ) |
Gets an integer property with the given property and area id.
propertyId | The property id to retrieve. |
areaId | The area id to retrieve. |
defaultValue | If the service cannot read the current value of the property, the default value of the property. |
String getStringProperty | ( | int | propertyId, |
int | areaId, | ||
String | defaultValue ) |
Gets a string property with the given property and area id.
propertyId | The property id to retrieve. |
areaId | The area id to retrieve. |
defaultValue | If the service cannot read the current value of the property, the default value of the property. |
boolean isPropertyAvailable | ( | int | propertyId, |
int | areaId ) |
Checks whether a property and area id represent an existing property.
propertyId | The property id to test. |
areaId | The area id to test. |
void setBooleanProperty | ( | int | propertyId, |
int | areaId, | ||
boolean | value ) |
Sets a boolean property with the given property and area id.
propertyId | The property id to set. |
areaId | The area id to set. |
value | The value to set. |
void setFloatProperty | ( | int | propertyId, |
int | areaId, | ||
float | value ) |
Sets a float property with the given property and area id.
propertyId | The property id to set. |
areaId | The area id to set. |
value | The value to set. |
void setIntegerArrayProperty | ( | int | propertyId, |
int | areaId, | ||
Integer[] | value ) |
Sets an integer array property with the given property and area id.
propertyId | The property id to set. |
areaId | The area id to set. |
value | The value to set. |
void setIntProperty | ( | int | propertyId, |
int | areaId, | ||
int | value ) |
Sets an int property with the given property and area id.
propertyId | The property id to set. |
areaId | The area id to set. |
value | The value to set. |
void setStringProperty | ( | int | propertyId, |
int | areaId, | ||
String | value ) |
Sets a string property with the given property and area id.
propertyId | The property id to set. |
areaId | The area id to set. |
value | The value to set. |
void subscribeToPropertyValueChanges | ( | int | propertyId, |
CarPropertyChangeCallback | callback ) |
Subscribes to receive callbacks when the given property id is updated.
propertyId | The property id to subscribe. |
callback | The callback to call when the property value changes. |
void unsubscribeFromPropertyValueChanges | ( | int | propertyId, |
CarPropertyChangeCallback | callback ) |
Unsubscribes from a property changed callback.
propertyId | The property id to unsubscribe. |
callback | The callback to unsubscribe. |