Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e30fb981 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Initial HIDL vehicle HAL"

parents da9db484 a2f426ab
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ subdirs = [
    "tests/msgq/1.0",
    "tests/pointer/1.0",
    "vibrator/1.0",
    "vehicle/2.0",
    "wifi/1.0",
    "wifi/supplicant/1.0",
]

vehicle/2.0/Android.bp

0 → 100644
+54 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen. Do not edit manually.

genrule {
    name: "android.hardware.vehicle@2.0_genc++",
    tool: "hidl-gen",
    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
    srcs: [
        "types.hal",
        "IVehicle.hal",
        "IVehicleCallback.hal",
    ],
    out: [
        "android/hardware/vehicle/2.0/types.cpp",
        "android/hardware/vehicle/2.0/VehicleAll.cpp",
        "android/hardware/vehicle/2.0/VehicleCallbackAll.cpp",
    ],
}

genrule {
    name: "android.hardware.vehicle@2.0_genc++_headers",
    tool: "hidl-gen",
    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
    srcs: [
        "types.hal",
        "IVehicle.hal",
        "IVehicleCallback.hal",
    ],
    out: [
        "android/hardware/vehicle/2.0/types.h",
        "android/hardware/vehicle/2.0/IVehicle.h",
        "android/hardware/vehicle/2.0/IHwVehicle.h",
        "android/hardware/vehicle/2.0/BnVehicle.h",
        "android/hardware/vehicle/2.0/BpVehicle.h",
        "android/hardware/vehicle/2.0/BsVehicle.h",
        "android/hardware/vehicle/2.0/IVehicleCallback.h",
        "android/hardware/vehicle/2.0/IHwVehicleCallback.h",
        "android/hardware/vehicle/2.0/BnVehicleCallback.h",
        "android/hardware/vehicle/2.0/BpVehicleCallback.h",
        "android/hardware/vehicle/2.0/BsVehicleCallback.h",
    ],
}

cc_library_shared {
    name: "android.hardware.vehicle@2.0",
    generated_sources: ["android.hardware.vehicle@2.0_genc++"],
    generated_headers: ["android.hardware.vehicle@2.0_genc++_headers"],
    export_generated_headers: ["android.hardware.vehicle@2.0_genc++_headers"],
    shared_libs: [
        "libhidl",
        "libhwbinder",
        "libutils",
        "libcutils",
    ],
}

vehicle/2.0/Android.mk

0 → 100644
+1708 −0

File added.

Preview size limit exceeded, changes collapsed.

+99 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.vehicle@2.0;

import IVehicleCallback;

interface IVehicle {
  /**
   * Returns a list of all property configurations supported by this vehicle
   * HAL.
   */
  getAllPropConfigs() generates (vec<VehiclePropConfig> propConfigs);

  /*
   * Returns a list of property configurations for given properties.
   */
  getPropConfigs(vec<VehicleProperty> props)
          generates (vec<VehiclePropConfig> propConfigs);

  /**
   * Get a vehicle property value.
   *
   * For VehiclePropertyChangeMode::STATIC properties, this method must always
   * return the same value always.
   * For VehiclePropertyChangeMode::ON_CHANGE properties, it must return the
   * latest available value.
   *
   * If there is no data available yet, which can happen during initial stage,
   * this call must return immediately with an error code of
   * StatusCode::TRY_AGAIN.
   */
  get(VehicleProperty propId, int32_t areaId)
          generates (StatusCode status, VehiclePropValue propValue);

  /**
   * Set a vehicle property value.
   *
   * Timestamp of data must be ignored for set operation.
   *
   * Setting some properties require having initial state available. If initial
   * data is not available yet this call must return StatusCode::TRY_AGAIN.
   * For a property with separate power control this call must return
   * StatusCode::NOT_AVAILABLE error if property is not powered on.
   */
  set(VehiclePropValue propValue) generates (StatusCode status);

  /**
   * Subscribes to property events.
   *
   * Clients must be able to subscribe to multiple properties at a time
   * depending on data provided in options argument.
   *
   * @param listener This client must be called on aproperiate event.
   * @param options List of options to subscribe. SubscribeOption contains
   *                information such as propery Id, area Id, sample rate, etc.
   */
  subscribe(IVehicleCallback listener, vec<SubscribeOptions> options)
          generates (StatusCode status);

  /**
   * Unsubscribes from property events.
   *
   * If this client wasn't subscribed to the given property, this method
   * must return StatusCode::INVALID_ARGUMENT.
   */
  unsubscribe(VehicleProperty propId) generates (StatusCode status);

  /**
   * Print out debugging state for the vehicle hal.
   *
   * The text must be in ASCII encoding only.
   *
   * Performance requirements:
   *
   * The HAL must return from this call in less than 10ms. This call must avoid
   * deadlocks, as it may be called at any point of operation. Any synchronization
   * primitives used (such as mutex locks or semaphores) must be acquired
   * with a timeout.
   *
   * TODO(pavelm): we cannot use handle here due to Java compatability, it's
   * better to pass file descriptor and write debug data directly in vehicle HAL
   * rather than passing back a string.
   */
  debugDump() generates (string s);
};
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.vehicle@2.0;

interface IVehicleCallback {

    /*
     * Event callback happens whenever a variable that the API user has
     * subscribed to needs to be reported. This may be based purely on
     * threshold and frequency (a regular subscription, see subscribe call's
     * arguments) or when the IVehicle#set method was called and the actual
     * change needs to be reported.
     *
     * These callbacks are chunked.
     *
     * @param values that has been updated.
     */
    onPropertyEvent(vec<VehiclePropValue> propValues);

    /*
     * This method gets called if the client was susbscribed to a property using
     * SubscribeFlags::SET_CALL flag and IVehicle#set(...) method was called.
     *
     * These events must be delivered to subscriber immediately without any
     * batching.
     *
     * @param value Value that was set by a client.
     */
    onPropertySet(VehiclePropValue propValue);

    /*
     * Called by HAL server when error condition has occurred.
     *
     * @param errorCode - any value from StatusCode enum.
     * @parm property - a property where error has happened. If this is
     * a generic error, this value should be VehicleProperty::INVALID.
     * @param operation Represent the operation where the error has happened.
     */
    onError(StatusCode errorCode,
            VehicleProperty propId,
            VehiclePropertyOperation operation);
};
Loading