Android AOSP:如何在Vehicle hal中初始化VehicleProperty::AUDIO_VOLUME属性(.DefaultConfig.h中的initialValues)?
试图将音频音量属性添加到演示车辆hal代码中,该代码位于Android AOSP:如何在Vehicle hal中初始化VehicleProperty::AUDIO_VOLUME属性(.DefaultConfig.h中的initialValues)?,android,android-source,android-8.0-oreo,hal,Android,Android Source,Android 8.0 Oreo,Hal,试图将音频音量属性添加到演示车辆hal代码中,该代码位于/hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal\u v2\u 0/ 文件名:DefaultConfig.h 尝试像下面这样添加,但它正在崩溃 {.config = { .prop = toInt(VehicleProperty::AUDIO_VOLUME), .access = VehicleP
/hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal\u v2\u 0/
文件名:DefaultConfig.h
尝试像下面这样添加,但它正在崩溃
{.config =
{
.prop = toInt(VehicleProperty::AUDIO_VOLUME),
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = { toInt(VehicleAudioContextFlag::MUSIC_FLAG), toInt(VehicleAudioVolumeCapabilityFlag::MASTER_VOLUME_ONLY),0,0,100 },
},
.initialValue = {.int32Values = { toInt(VehicleAudioContextFlag::MUSIC_FLAG), 80, toInt(VehicleAudioVolumeState::STATE_OK) } }
},
中定义的音频音量属性
/hardware/interfaces/automotive/vehicle/2.0/types.hal
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
* @config_flags all audio contexts supported.
*/
AUDIO_VOLUME = (
0x0901
| VehiclePropertyGroup:SYSTEM
| VehiclePropertyType:INT32_VEC
| VehicleArea:GLOBAL),
参考OSP代码可在中使用hidl\u vec来打包初始值 例如:
{.config =
{
.prop = toInt(VehicleProperty::AUDIO_VOLUME),
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = { toInt(VehicleAudioContextFlag::MUSIC_FLAG), toInt(VehicleAudioVolumeCapabilityFlag::MASTER_VOLUME_ONLY),0,0,100 },
},
.initialValue = {.int32Values = hidl_vec<int32_t> {toInt(VehicleAudioContextFlag::MUSIC_FLAG), 80, toInt(VehicleAudioVolumeState::STATE_OK) }}
},
{.config=
{
.prop=toInt(车辆属性::音频音量),
.access=VehiclePropertyAccess::读写,
.changeMode=车辆属性changeMode::在更改时,
.configArray={toInt(车辆音频通信extFlag::MUSIC\u FLAG),toInt(车辆音频通信容量FLAG::仅限主音量),0,0100},
},
.initialValue={.int32Values=hidl_vec{toInt(车辆音频接口标志::音乐标志),80,toInt(车辆音频接口标志::状态确定)}
},
因为此属性需要INT32_VEC值。什么是
hidl_VEC
?