blob: 4c02447bf695d476822ab279bacd49638b233df4 [file] [log] [blame]
Pavel Maltseva2f426a2016-10-04 10:17:05 -07001/*
2 * Copyright (C) 2016 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
17package android.hardware.vehicle@2.0;
18
19import IVehicleCallback;
20
21interface IVehicle {
22 /**
23 * Returns a list of all property configurations supported by this vehicle
24 * HAL.
25 */
26 getAllPropConfigs() generates (vec<VehiclePropConfig> propConfigs);
27
28 /*
29 * Returns a list of property configurations for given properties.
30 */
31 getPropConfigs(vec<VehicleProperty> props)
32 generates (vec<VehiclePropConfig> propConfigs);
33
34 /**
35 * Get a vehicle property value.
36 *
37 * For VehiclePropertyChangeMode::STATIC properties, this method must always
38 * return the same value always.
39 * For VehiclePropertyChangeMode::ON_CHANGE properties, it must return the
40 * latest available value.
41 *
42 * If there is no data available yet, which can happen during initial stage,
43 * this call must return immediately with an error code of
44 * StatusCode::TRY_AGAIN.
45 */
46 get(VehicleProperty propId, int32_t areaId)
47 generates (StatusCode status, VehiclePropValue propValue);
48
49 /**
50 * Set a vehicle property value.
51 *
52 * Timestamp of data must be ignored for set operation.
53 *
54 * Setting some properties require having initial state available. If initial
55 * data is not available yet this call must return StatusCode::TRY_AGAIN.
56 * For a property with separate power control this call must return
57 * StatusCode::NOT_AVAILABLE error if property is not powered on.
58 */
59 set(VehiclePropValue propValue) generates (StatusCode status);
60
61 /**
62 * Subscribes to property events.
63 *
64 * Clients must be able to subscribe to multiple properties at a time
65 * depending on data provided in options argument.
66 *
Pavel Maltseve2603e32016-10-25 16:03:23 -070067 * @param listener This client must be called on appropriate event.
Pavel Maltseva2f426a2016-10-04 10:17:05 -070068 * @param options List of options to subscribe. SubscribeOption contains
Pavel Maltseve2603e32016-10-25 16:03:23 -070069 * information such as property Id, area Id, sample rate, etc.
Pavel Maltseva2f426a2016-10-04 10:17:05 -070070 */
Pavel Maltseve2603e32016-10-25 16:03:23 -070071 subscribe(IVehicleCallback callback, vec<SubscribeOptions> options)
Pavel Maltseva2f426a2016-10-04 10:17:05 -070072 generates (StatusCode status);
73
74 /**
75 * Unsubscribes from property events.
76 *
77 * If this client wasn't subscribed to the given property, this method
78 * must return StatusCode::INVALID_ARGUMENT.
79 */
Pavel Maltseve2603e32016-10-25 16:03:23 -070080 unsubscribe(IVehicleCallback callback, VehicleProperty propId)
81 generates (StatusCode status);
Pavel Maltseva2f426a2016-10-04 10:17:05 -070082
83 /**
84 * Print out debugging state for the vehicle hal.
85 *
86 * The text must be in ASCII encoding only.
87 *
88 * Performance requirements:
89 *
90 * The HAL must return from this call in less than 10ms. This call must avoid
91 * deadlocks, as it may be called at any point of operation. Any synchronization
92 * primitives used (such as mutex locks or semaphores) must be acquired
93 * with a timeout.
94 *
Pavel Maltseve2603e32016-10-25 16:03:23 -070095 * TODO(pavelm): we cannot use handle here due to Java compatibility, it's
Pavel Maltseva2f426a2016-10-04 10:17:05 -070096 * better to pass file descriptor and write debug data directly in vehicle HAL
97 * rather than passing back a string.
98 */
99 debugDump() generates (string s);
100};