Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.vehicle@2.0; |
| 18 | |
| 19 | import IVehicleCallback; |
| 20 | |
| 21 | interface 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. |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 30 | * |
| 31 | * If requested VehicleProperty wasn't found it must return |
| 32 | * StatusCode::INVALID_ARG, otherwise a list of vehicle property |
| 33 | * configurations with StatusCode::OK |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 34 | */ |
Pavel Maltsev | 8e624b3 | 2017-02-01 16:30:25 -0800 | [diff] [blame^] | 35 | getPropConfigs(vec<int32_t> props) |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 36 | generates (StatusCode status, vec<VehiclePropConfig> propConfigs); |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Get a vehicle property value. |
| 40 | * |
| 41 | * For VehiclePropertyChangeMode::STATIC properties, this method must always |
| 42 | * return the same value always. |
| 43 | * For VehiclePropertyChangeMode::ON_CHANGE properties, it must return the |
| 44 | * latest available value. |
| 45 | * |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 46 | * Some properties like AUDIO_VOLUME requires to pass additional data in |
| 47 | * GET request in VehiclePropValue object. |
| 48 | * |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 49 | * If there is no data available yet, which can happen during initial stage, |
| 50 | * this call must return immediately with an error code of |
| 51 | * StatusCode::TRY_AGAIN. |
| 52 | */ |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 53 | get(VehiclePropValue requestedPropValue) |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 54 | generates (StatusCode status, VehiclePropValue propValue); |
| 55 | |
| 56 | /** |
| 57 | * Set a vehicle property value. |
| 58 | * |
| 59 | * Timestamp of data must be ignored for set operation. |
| 60 | * |
| 61 | * Setting some properties require having initial state available. If initial |
| 62 | * data is not available yet this call must return StatusCode::TRY_AGAIN. |
| 63 | * For a property with separate power control this call must return |
| 64 | * StatusCode::NOT_AVAILABLE error if property is not powered on. |
| 65 | */ |
| 66 | set(VehiclePropValue propValue) generates (StatusCode status); |
| 67 | |
| 68 | /** |
| 69 | * Subscribes to property events. |
| 70 | * |
| 71 | * Clients must be able to subscribe to multiple properties at a time |
| 72 | * depending on data provided in options argument. |
| 73 | * |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 74 | * @param listener This client must be called on appropriate event. |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 75 | * @param options List of options to subscribe. SubscribeOption contains |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 76 | * information such as property Id, area Id, sample rate, etc. |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 77 | */ |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 78 | subscribe(IVehicleCallback callback, vec<SubscribeOptions> options) |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 79 | generates (StatusCode status); |
| 80 | |
| 81 | /** |
| 82 | * Unsubscribes from property events. |
| 83 | * |
| 84 | * If this client wasn't subscribed to the given property, this method |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 85 | * must return StatusCode::INVALID_ARG. |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 86 | */ |
Pavel Maltsev | 8e624b3 | 2017-02-01 16:30:25 -0800 | [diff] [blame^] | 87 | unsubscribe(IVehicleCallback callback, int32_t propId) |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 88 | generates (StatusCode status); |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Print out debugging state for the vehicle hal. |
| 92 | * |
| 93 | * The text must be in ASCII encoding only. |
| 94 | * |
| 95 | * Performance requirements: |
| 96 | * |
| 97 | * The HAL must return from this call in less than 10ms. This call must avoid |
| 98 | * deadlocks, as it may be called at any point of operation. Any synchronization |
| 99 | * primitives used (such as mutex locks or semaphores) must be acquired |
| 100 | * with a timeout. |
| 101 | * |
Pavel Maltsev | a2f426a | 2016-10-04 10:17:05 -0700 | [diff] [blame] | 102 | */ |
| 103 | debugDump() generates (string s); |
| 104 | }; |