【问题标题】:How would I go about writing code that uses android.hardware.automotive.vehicle@2.0 Library?我将如何编写使用 android.hardware.automotive.vehicle@2.0 库的代码?
【发布时间】:2020-12-14 03:39:04
【问题描述】:

我正在尝试学习编写硬件抽象层 (HAL)。 这是我到目前为止所采取的路径,如果我有任何错误,请纠正我。

  1. 已下载 AOSP 并成功构建 (86%)
  2. 定位的车辆 Hal 支持库
  3. 位于 android.hardware.automotive.vehicle C++ 代码。

之后我尝试了以下步骤,但未能成功识别上述类。

  1. 在 Android Studio 中为面向 29 Api 级别的典型 Android 应用导入 android.hardware.automotive.vehicle 类。
  2. 添加 android.car 应用的元标记
  3. 复制/粘贴 AOSP /packages/services/Car/ 下的所有源代码
  4. 部分考虑添加 android.hardware.automotive.vehicle@2.0.so 库并尝试通过 JNI 访问它(对此不太确定)。

请给我定位,我看到 github 上的一些存储库没有做任何特别的事情,而且他们能够以某种方式将包导入到这样的 java 类中。

import android.hardware.automotive.vehicle.V2_0.VehicleHwKeyInputAction;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;

Here

他们究竟是如何访问这些课程的?

谢谢

【问题讨论】:

标签: android-source android-automotive


【解决方案1】:

Vehicle HAL 不能直接从应用访问。汽车服务会为您做到这一点。

根据您实际想要完成的任务,您有几个选择:

  1. 学习编写 HAL 服务 - 这就像为给定硬件编写驱动程序(在本例中,是向 Car Service 提供汽车数据的东西)。

  2. 学习编写 HAL 客户端 - 首先尝试修改 EmbeddedKitchenSink 应用程序。请注意,您需要使用 AOSP 而不是在 AmdroidStudio 中构建它,因为这是一个系统应用程序(并且常规应用程序无法访问 HAL)

  3. 学习车辆 API - 这就是您需要汽车库的目的。详细使用方法:https://stackoverflow.com/a/63321234/14759774

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多