Vehicle Properties 1.0.0-beta5
CarService Interface Reference

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.
 

Detailed Description

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.

Member Function Documentation

◆ getAreaId()

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.

Parameters
propertyIdThe property id to query.
areaThe partial area to query.
Returns
The areaId as configured on the current device that contains the provided area.

◆ getBooleanProperty()

boolean getBooleanProperty ( int propertyId,
int areaId,
boolean defaultValue )

Gets a boolean property with the given property and area id.

Parameters
propertyIdThe property id to retrieve.
areaIdThe area id to retrieve.
defaultValueIf the service cannot read the current value of the property, the default value of the property.
Returns
The boolean value of the property.

◆ getFloatProperty()

float getFloatProperty ( int propertyId,
int areaId,
float defaultValue )

Gets a float property with the given property and area id.

Parameters
propertyIdThe property id to retrieve.
areaIdThe area id to retrieve.
defaultValueIf the service cannot read the current value of the property, the default value of the property.
Returns
The float value of the property.

◆ getIntegerArrayProperty()

Integer[] getIntegerArrayProperty ( int propertyId,
int areaId,
Integer[] defaultValue )

Gets an integer array property with the given property and area id.

Parameters
propertyIdThe property id to retrieve.
areaIdThe area id to retrieve.
defaultValueIf the service cannot read the current value of the property, the default value of the property.
Returns
The integer array value of the property.

◆ getIntProperty()

int getIntProperty ( int propertyId,
int areaId,
int defaultValue )

Gets an integer property with the given property and area id.

Parameters
propertyIdThe property id to retrieve.
areaIdThe area id to retrieve.
defaultValueIf the service cannot read the current value of the property, the default value of the property.
Returns
The int value of the property.

◆ getStringProperty()

String getStringProperty ( int propertyId,
int areaId,
String defaultValue )

Gets a string property with the given property and area id.

Parameters
propertyIdThe property id to retrieve.
areaIdThe area id to retrieve.
defaultValueIf the service cannot read the current value of the property, the default value of the property.
Returns
The string value of the property.

◆ isPropertyAvailable()

boolean isPropertyAvailable ( int propertyId,
int areaId )

Checks whether a property and area id represent an existing property.

Parameters
propertyIdThe property id to test.
areaIdThe area id to test.
Returns
If the property and area refer to a property defined by the service, true, otherwise false.

◆ setBooleanProperty()

void setBooleanProperty ( int propertyId,
int areaId,
boolean value )

Sets a boolean property with the given property and area id.

Parameters
propertyIdThe property id to set.
areaIdThe area id to set.
valueThe value to set.

◆ setFloatProperty()

void setFloatProperty ( int propertyId,
int areaId,
float value )

Sets a float property with the given property and area id.

Parameters
propertyIdThe property id to set.
areaIdThe area id to set.
valueThe value to set.

◆ setIntegerArrayProperty()

void setIntegerArrayProperty ( int propertyId,
int areaId,
Integer[] value )

Sets an integer array property with the given property and area id.

Parameters
propertyIdThe property id to set.
areaIdThe area id to set.
valueThe value to set.

◆ setIntProperty()

void setIntProperty ( int propertyId,
int areaId,
int value )

Sets an int property with the given property and area id.

Parameters
propertyIdThe property id to set.
areaIdThe area id to set.
valueThe value to set.

◆ setStringProperty()

void setStringProperty ( int propertyId,
int areaId,
String value )

Sets a string property with the given property and area id.

Parameters
propertyIdThe property id to set.
areaIdThe area id to set.
valueThe value to set.

◆ subscribeToPropertyValueChanges()

void subscribeToPropertyValueChanges ( int propertyId,
CarPropertyChangeCallback callback )

Subscribes to receive callbacks when the given property id is updated.

Parameters
propertyIdThe property id to subscribe.
callbackThe callback to call when the property value changes.

◆ unsubscribeFromPropertyValueChanges()

void unsubscribeFromPropertyValueChanges ( int propertyId,
CarPropertyChangeCallback callback )

Unsubscribes from a property changed callback.

Parameters
propertyIdThe property id to unsubscribe.
callbackThe callback to unsubscribe.