blob: 088553931f7565491e23bd4a040da77e256c4484 [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 *
67 * @param listener This client must be called on aproperiate event.
68 * @param options List of options to subscribe. SubscribeOption contains
69 * information such as propery Id, area Id, sample rate, etc.
70 */
71 subscribe(IVehicleCallback listener, vec<SubscribeOptions> options)
72 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 */
80 unsubscribe(VehicleProperty propId) generates (StatusCode status);
81
82 /**
83 * Print out debugging state for the vehicle hal.
84 *
85 * The text must be in ASCII encoding only.
86 *
87 * Performance requirements:
88 *
89 * The HAL must return from this call in less than 10ms. This call must avoid
90 * deadlocks, as it may be called at any point of operation. Any synchronization
91 * primitives used (such as mutex locks or semaphores) must be acquired
92 * with a timeout.
93 *
94 * TODO(pavelm): we cannot use handle here due to Java compatability, it's
95 * better to pass file descriptor and write debug data directly in vehicle HAL
96 * rather than passing back a string.
97 */
98 debugDump() generates (string s);
99};