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

Vehicle HAL(5)--vhal 实现设置属性的流程

目录

1. ard11 vhal 设置属性的时序图 CarService > vhal > CarService

2. EmulatedVehicleHal::set(xxx) 的实现


本文介绍ard11的vhal属性设置流程图。

1. ard11 vhal 设置属性的时序图 CarService > vhal > CarService

2. EmulatedVehicleHal::set(xxx) 的实现

从client端来的set调用最后会调用到EmulatedVehicleHal中。再由它转到其他地方(车身、ECU),和传回CarService。

android11/hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp

163  StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
164      constexpr bool updateStatus = false;
165 
166      if (propValue.prop == kGenerateFakeDataControllingProperty) {
167          // Send the generator controlling request to the server.
168          // 'updateStatus' flag is only for the value sent by setProperty (propValue in this case)
169          // instead of the generated values triggered by it. 'propValue' works as a control signal
170          // here, since we never send the control signal back, the value of 'updateStatus' flag
171          // does not matter here.
172          auto status = mVehicleClient->setProperty(propValue, updateStatus);
173          return status;
174      } else if (mHvacPowerProps.count(propValue.prop)) {
175          auto hvacPowerOn = mPropStore->readValueOrNull(
176              toInt(VehicleProperty::HVAC_POWER_ON),
177              (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT |
178               VehicleAreaSeat::ROW_2_LEFT | VehicleAreaSeat::ROW_2_CENTER |
179               VehicleAreaSeat::ROW_2_RIGHT));
180 
181          if (hvacPowerOn && hvacPowerOn->value.int32Values.size() == 1
182                  && hvacPowerOn->value.int32Values[0] == 0) {
183              return StatusCode::NOT_AVAILABLE;
184          }
185      } else {
186          // Handle property specific code
187          switch (propValue.prop) {
188              case OBD2_FREEZE_FRAME_CLEAR:
189                  return clearObd2FreezeFrames(propValue);
190              case VEHICLE_MAP_SERVICE:
191                  // Placeholder for future implementation of VMS property in the default hal. For
192                  // now, just returns OK; otherwise, hal clients crash with property not supported.
193                  return StatusCode::OK;
194          }
195      }
196 
197      if (propValue.status != VehiclePropertyStatus::AVAILABLE) {
198          // Android side cannot set property status - this value is the
199          // purview of the HAL implementation to reflect the state of
200          // its underlying hardware
201          return StatusCode::INVALID_ARG;
202      }
203      auto currentPropValue = mPropStore->readValueOrNull(propValue);
204 
205      if (currentPropValue == nullptr) {
206          return StatusCode::INVALID_ARG;
207      }
208      if (currentPropValue->status != VehiclePropertyStatus::AVAILABLE) {
209          // do not allow Android side to set() a disabled/error property
210          return StatusCode::NOT_AVAILABLE;
211      }
212 
213      /**
214       * After checking all conditions, such as the property is available, a real vhal will
215       * sent the events to Car ECU to take actions.
216       */
217 
218      // Send the value to the vehicle server, the server will talk to the (real or emulated) car
219      auto setValueStatus = mVehicleClient->setProperty(propValue, updateStatus);//关键代码
220      if (setValueStatus != StatusCode::OK) {
221          return setValueStatus;
222      }
223 
224      return StatusCode::OK;
225  }

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

相关文章:

  • Silicon EFR32xG22 错误问题和解决办法汇总
  • Linux目录结构
  • ROS2里面与话题 /move_base_simple/goal 和 /move_base/status 相对应的话题名字及其含义
  • 整理几个概念:DCU DTK HIP hipcc ROCm LLVM Triton MIGraphX 怎么增加GStreamer插件
  • 可穿戴设备:健康监测的未来之眼
  • 2025年阿里最新软件测试面试题:Web 测试+接口测试+App 测试
  • DAY 22 复习日
  • 获取第三方图片接口文件流并保存服务器
  • 8天Python从入门到精通【itheima】-71~72(数据容器“序列”+案例练习)
  • 串:BF算法(朴素的魔术匹配算法)
  • 【深度学习-Day 23】框架实战:模型训练与评估核心环节详解 (MNIST实战)
  • MQTTX连接移动云的例子
  • JMeter 实现 MQTT 协议压力测试 !
  • 云服务器Xshell登录拒绝访问排查
  • 使用 Deleaker 精准定位内存与 GDI 资源泄漏
  • Matplotlib 库来可视化频谱泄漏和加窗的效果
  • 【如何做好应用架构?】
  • RTOS:创建队列(含源码分析)
  • 搭建DNS域名解析服务器(正向解析资源文件)
  • 数据结构:递归:泰勒展开式(Taylor Series Expansion)
  • 如何搭建自动化测试框架?
  • simulink有无现成模块可以实现将三个分开的输入合并为一个[1*3]的行向量输出?
  • nginx 服务启动失败问题记录
  • 华新精科IPO“上会” 四大疑惑待解
  • LeetCode | 滑动窗口的原理及真题解析
  • JavaScript 数组与流程控制:从基础操作到实战应用
  • 八皇后问题深度解析
  • 05【Linux经典命令】Linux 用户管理全面指南:从基础到高级操作
  • 深入浅出工厂模式:从入门到精通(2025最新版)
  • Linux多线程