当前位置: 首页 > backend >正文

Vehicle HAL(1)--整体介绍

AOSP 官网介绍:

https://source.android.com/docs/automotive/vhal

VHAL 简介:

Android Automotive and Physical Car Interaction | Android Automotive OS Book

Vehicle HAL Properties:

https://source.android.com/docs/automotive/vhal/properties

system-properties:

https://source.android.com/docs/automotive/vhal/system-properties

vhal_debug:

https://source.android.com/docs/automotive/vhal/vhal_debug

1. Vehicle HAL 整体介绍

    此处的Vehicle HAL(vhal),主要介绍ard11上用hidl实现的vhal。后面vhal已经在ard13及以上迁移到aidl的实现。

(1)vhal的主要作用,处理clients(CarService, others hal) 的连接请求;

(2)与车辆通过can通信,实现车辆控制与信息反馈。

2. Vehicle HAL 要实现的功能有那些?

(1)实现IVehicle.hal接口,实现由它定义的功能,主要是属性get、set、update、传递;

(2)一个模拟的EmulatedVehicleHal,主体的功能实现部分;

(3)属性的解析和保持、更新;

(4)属性的订阅端管理;

3. Vehicle HAL 实现整体框图

4. Vehicle HAL 主要部分介绍

4.1 VehicleService

    main函数的主体,构建关键对象,启动vhal。

4.2 EmulatedVehicleHal

    EmulatedVehicleHal实现了vhal中关键的VehicleHal抽象类。

EmulatedVehicleHal::initStaticConfig():

EmulatedVehicleHal() > EmulatedVehicleHal::initStaticConfig() > mPropStore->registerProperty()

kVehicleProperties是静态配置好了的。

195  const ConfigDeclaration kVehicleProperties[]

android11/hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h

EmulatedVehicleHal 的关键函数 EmulatedVehicleHal::onPropertyValue(),传递属性变化给上层和模拟car:

351  void EmulatedVehicleHal::onPropertyValue(const VehiclePropValue& value, bool updateStatus) {
352      VehiclePropValuePtr updatedPropValue = getValuePool()->obtain(value);
353  
354      if (mPropStore->writeValue(*updatedPropValue, updateStatus)) {//更新属性
355          getEmulatorOrDie()->doSetValueFromClient(*updatedPropValue);//关键调用,Emulator,client,获取时通过socket走到can的另外一端
356          doHalEvent(std::move(updatedPropValue));//关键调用,返回变化到carservice
357      }
358  }

4.3 VehicleHalManager

   VehicleHalManager实现了IVehiclel接口,hal服务的主体。构建VehicleHalManager的关键过程有3步。

    VehicleHalManager(VehicleHal* vehicleHal): mHal(vehicleHal),//初始化mHalmSubscriptionManager(std::bind(&VehicleHalManager::onAllClientsUnsubscribed,this, std::placeholders::_1)) {//初始化mSubscriptionManagerinit();//调用自己的init()函数}

 

4.4 SubscriptionManager 

    SubscriptionManager 的作用主要是管理属性的订阅clients。

http://www.xdnf.cn/news/10001.html

相关文章:

  • InnoDB中的锁
  • 龙虎榜——20250529
  • 2025年业财一体化如何重塑工程项目管理?
  • 下载jdk教程
  • 基于python 将图像上同一行距离相近的矩形框融合
  • Apifox 的“前置URL”和“请求地址”区别
  • 【网络入侵检测】基于Suricata源码分析FlowManager实现
  • DEEPSEEK帮写的STM32消息流函数,直接可用.已经测试
  • PostgreSQL主从同步双机集群创建与配置
  • 使用 Arthas 查看接口方法执行时间
  • 时间序列噪声模型分析软件推荐与使用经验
  • SQL(Database Modifications)
  • 【达梦】达梦数据库使用TypeHandler读取数据库时,将字段中的数据读取为数组
  • UIAbility组件基础
  • Cadence Allegro中设置主画面最小显示间距
  • 江科大UART串口通讯hal库实现
  • 【大模型/MCP】MCP简介
  • 哈希之旅:从使用到底层建设
  • CCPC shandong 2025 G
  • 【数据集】中国日尺度1 km全天候地表温度数据集(2000-2022)
  • 尚硅谷redis7 74-85 redis集群分片之集群是什么
  • 【区间dp】-----例题5【田忌赛马】(暂时只会贪心解法)
  • Chuanpai、Nihongo wa Muzukashii Desu、K-skip Permutation
  • 3340. 检查平衡字符串
  • 【2025文博会现场直击】多图预警
  • One Year~
  • WES(三)——变异检测
  • Pix4d航测软件正射影像生产流程(一)项目创建及快速空三
  • Baklib企业知识激活解决方案
  • MySQL 数据库中的主键、超键、候选键、外键是什么?