• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.car.testapi;
18 
19 import android.annotation.Nullable;
20 import android.car.hardware.CarPropertyConfig;
21 import android.car.hardware.CarPropertyValue;
22 import android.car.hardware.property.CarPropertyManager;
23 
24 import java.util.List;
25 
26 /**
27  * Controller to modify car properties. Get instance of this interface via
28  * {@link FakeCar#getCarPropertyController()}
29  */
30 public interface CarPropertyController {
31     /**
32      * Adds property to {@link FakeCar}.
33      *
34      * <p>See {@link android.car.VehiclePropertyIds} for a
35      * defined list of property IDs. Custom properties are also allowed, however they need
36      * to follow the same bit format as vehicle HAL (encoding data type, area type, etc in the)
37      * property id itself.
38      */
addProperty(Integer propId, @Nullable Object value)39     CarPropertyController addProperty(Integer propId, @Nullable Object value);
40 
41     /** Adds configured property to {@link FakeCar} */
addProperty(CarPropertyConfig<?> config, @Nullable CarPropertyValue<?> value)42     CarPropertyController addProperty(CarPropertyConfig<?> config,
43             @Nullable CarPropertyValue<?> value);
44 
45     /**
46      * Updates values of supported properties and optionally sends change events to
47      * listeners
48      */
updateValues(boolean triggerListeners, CarPropertyValue<?>... propValues)49     void updateValues(boolean triggerListeners, CarPropertyValue<?>... propValues);
50 
51     /** Returns the list of values that have been set from {@link CarPropertyManager} */
getSetValues()52     List<CarPropertyValue<?>> getSetValues();
53 }
54