首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在VHAL android Automotive中处理自定义车辆属性?

如何在VHAL android Automotive中处理自定义车辆属性?
EN

Stack Overflow用户
提问于 2020-02-18 12:44:16
回答 2查看 2K关注 0票数 0

如何在android Automotive VHAL中创建自定义车辆属性?

如何生成PropertyID以及如何从CarPropertyManager访问它?

我找到了下面的参考,但我不清楚这一点:

https://source.android.com/devices/automotive/properties#prop_custom](https://source.android.com/devices/automotive/properties#prop_custom]1)

EN

回答 2

Stack Overflow用户

发布于 2020-02-28 11:36:05

检查此https://android.googlesource.com/platform/hardware/interfaces/+/refs/tags/android-9.0.0_r51/automotive/vehicle/2.0/types.hal

带注释

代码语言:javascript
运行
复制
  Vendors are allowed to extend this enum with their own properties 
  In this case they must use VehiclePropertyGroup:VENDOR flag when property is
  declared.

您必须扩展枚举VehicleProperty,然后通过CarPropertyManager使其可用,并通过CarPropertyValue获取值

票数 0
EN

Stack Overflow用户

发布于 2020-11-02 19:46:01

使用以下属性自定义车辆属性:

代码语言:javascript
运行
复制
    EXAMPLE_PROPERTY = (
    0xXXXX
    | VehiclePropertyGroup:VENDOR
    | VehiclePropertyType:STRING
    | VehicleArea:GLOBAL),

可以通过CarPropertyManager访问自定义属性。我们为所有的供应商属性定义了一个权限: Car.PERMISSION_VENDOR_EXTENDSION (Android10)

检查此https://source.android.com/devices/automotive/vhal/properties#handling-custom-properties

在Android11上,vehicle hal支持通过SUPPORT_CUSTOMIZE_VENDOR_PERMISSION定制供应商权限功能

代码语言:javascript
运行
复制
    /**
 * Support customize permissions for vendor properties
 *
 * Implement this property if vehicle hal support customize vendor permissions feature.
 * VehiclePropConfig.configArray is used to indicate vendor properties and permissions
 * which selected for this vendor property. The permission must be one of enum in
 * VehicleVendorPermission.
 * The configArray is set as follows:
 *      configArray[n] = propId : property ID for the vendor property
 *      configArray[n+1] = one of enums in VehicleVendorPermission. It indicates the permission
 *      for reading value of the property.
 *      configArray[n+2] = one of enums in VehicleVendorPermission. It indicates the permission
 *      for writing value of the property.
 *
 * For example:
 * configArray = {
 *      vendor_prop_1, PERMISSION_VENDOR_SEAT_READ, PERMISSION_VENDOR_SEAT_WRITE,
 *      vendor_prop_2, PERMISSION_VENDOR_INFO, PERMISSION_NOT_ACCESSIBLE,
 * }
 * If vendor properties are not in this array, they will have the default vendor permission.
 * If vendor chose PERMISSION_NOT_ACCESSIBLE, android will not have access to the property. In
 * the example, Android can not write value for vendor_prop_2.
 *
 * @change_mode VehiclePropertyChangeMode:STATIC
 * @access VehiclePropertyAccess:READ
 */
SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = (
    0x0F05
    | VehiclePropertyGroup:SYSTEM
    | VehiclePropertyType:BOOLEAN
    | VehicleArea:GLOBAL),
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60273871

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档