Home | History | Annotate | Download | only in 2.0
      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.automotive.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.
     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
     34    */
     35   getPropConfigs(vec<int32_t> props)
     36           generates (StatusCode status, vec<VehiclePropConfig> propConfigs);
     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    *
     46    * Some properties like RADIO_PRESET requires to pass additional data in
     47    * GET request in VehiclePropValue object.
     48    *
     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    */
     53   get(VehiclePropValue requestedPropValue)
     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    *
     74    * @param listener This client must be called on appropriate event.
     75    * @param options List of options to subscribe. SubscribeOption contains
     76    *                information such as property Id, area Id, sample rate, etc.
     77    */
     78   subscribe(IVehicleCallback callback, vec<SubscribeOptions> options)
     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
     85    * must return StatusCode::INVALID_ARG.
     86    */
     87   unsubscribe(IVehicleCallback callback, int32_t propId)
     88           generates (StatusCode status);
     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    *
    102    */
    103   debugDump() generates (string s);
    104 };
    105