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

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。

相关文章:

  • Unity-QFramework框架学习-MVC、Command、Event、Utility、System、BindableProperty
  • Unity3D多场景管理框架设计
  • 各国竞争的下一代液晶技术:中国铁电液晶取得重大突破突破
  • ubuntu mysql 8.0.42 基于二进制日志文件位置和GTID主从复制配置
  • 机顶盒CM311-5s纯手机免拆刷机,全网通,当贝桌面
  • VR 电缆故障测试系统:技术革新​
  • Kotlin 活动事件通讯跳转深度讲解
  • (LeetCode 每日一题)3373. 连接两棵树后最大目标节点数目 II(贪心+深度优先搜索dfs)
  • 知识课堂|sCMOS相机可编程快门模式解析
  • [网页五子棋][匹配模块]处理开始匹配/停止匹配请求(匹配算法,匹配器的实现)
  • 【AI智能体】Coze 插件从使用到实战详解
  • 机器视觉2,硬件选型
  • canvas 实现全屏倾斜重复水印
  • Linux应用开发之网络套接字编程
  • 本地部署消息代理软件 RabbitMQ 并实现外部访问( Windows 版本 )
  • .NET8入门:14.ASP.NET Core MVC进阶——Model
  • MMR搜索和LangChain整合Milvus实战
  • 使用 Flutter 开发 App 时,想要根据 Figma 设计稿开发出响应式 UI 界面
  • 将 Figma 设计稿通过编码一比一还原成 App 界面
  • 数学复习笔记 21
  • 忍不住在楼道里面做免费网站/电脑清理软件十大排名
  • 可以做招商的网站/抖音怎么推广
  • 科技有限公司经营范围有哪些/安徽seo推广公司
  • 天猫网站建设的理由/网络外包运营公司
  • 学习html的网站/微信指数查询
  • 网站做301跳转需解析/网络营销工程师