Loading system/bta/hearing_aid/hearing_aid.cc +13 −5 Original line number Diff line number Diff line Loading @@ -45,6 +45,9 @@ constexpr uint16_t CONNECTION_INTERVAL_10MS_PARAM = 0x0008; constexpr uint16_t CONNECTION_INTERVAL_20MS_PARAM = 0x0010; void btif_storage_add_hearing_aid(const HearingDevice& dev_info); bool btif_storage_get_hearing_aid_prop( const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id, uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs); constexpr uint8_t CODEC_G722_16KHZ = 0x01; constexpr uint8_t CODEC_G722_24KHZ = 0x02; Loading Loading @@ -626,11 +629,16 @@ class HearingAidImpl : public HearingAid { for (const gatt::Characteristic& charac : service->characteristics) { if (charac.uuid == READ_ONLY_PROPERTIES_UUID) { DVLOG(2) << "Reading read only properties " if (!btif_storage_get_hearing_aid_prop( hearingDevice->address, &hearingDevice->capabilities, &hearingDevice->hi_sync_id, &hearingDevice->render_delay, &hearingDevice->preparation_delay, &hearingDevice->codecs)) { VLOG(2) << "Reading read only properties " << loghex(charac.value_handle); BtaGattQueue::ReadCharacteristic( conn_id, charac.value_handle, HearingAidImpl::OnReadOnlyPropertiesReadStatic, nullptr); } } else if (charac.uuid == AUDIO_CONTROL_POINT_UUID) { hearingDevice->audio_control_point_handle = charac.value_handle; // store audio control point! Loading system/bta/include/bta_hearing_aid_api.h +5 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,11 @@ struct HearingDevice { audio_status_ccc_handle(0), service_changed_ccc_handle(0), read_psm_handle(0), capabilities(0), hi_sync_id(0), render_delay(0), preparation_delay(0), codecs(0), playback_started(false), command_acked(false), read_rssi_count(0) {} Loading system/btif/include/btif_storage.h +5 −0 Original line number Diff line number Diff line Loading @@ -231,6 +231,11 @@ void btif_storage_remove_hearing_aid(const RawAddress& address); void btif_storage_set_hearing_aid_white_list(const RawAddress& address, bool add_to_whitelist); /** Get the hearing aid device properties. */ bool btif_storage_get_hearing_aid_prop( const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id, uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs); /******************************************************************************* * * Function btif_storage_is_retricted_device Loading system/btif/src/btif_storage.cc +41 −0 Original line number Diff line number Diff line Loading @@ -1643,6 +1643,47 @@ void btif_storage_set_hearing_aid_white_list(const RawAddress& address, btif_config_save(); } /** Get the hearing aid device properties. */ bool btif_storage_get_hearing_aid_prop( const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id, uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs) { std::string addrstr = address.ToString(); int value; if (btif_config_get_int(addrstr, HEARING_AID_CAPABILITIES, &value)) { *capabilities = value; } else { return false; } if (btif_config_get_int(addrstr, HEARING_AID_CODECS, &value)) { *codecs = value; } else { return false; } if (btif_config_get_int(addrstr, HEARING_AID_RENDER_DELAY, &value)) { *render_delay = value; } else { return false; } if (btif_config_get_int(addrstr, HEARING_AID_PREPARATION_DELAY, &value)) { *preparation_delay = value; } else { return false; } uint64_t lvalue; if (btif_config_get_uint64(addrstr, HEARING_AID_SYNC_ID, &lvalue)) { *hi_sync_id = lvalue; } else { return false; } return true; } /******************************************************************************* * * Function btif_storage_is_restricted_device Loading Loading
system/bta/hearing_aid/hearing_aid.cc +13 −5 Original line number Diff line number Diff line Loading @@ -45,6 +45,9 @@ constexpr uint16_t CONNECTION_INTERVAL_10MS_PARAM = 0x0008; constexpr uint16_t CONNECTION_INTERVAL_20MS_PARAM = 0x0010; void btif_storage_add_hearing_aid(const HearingDevice& dev_info); bool btif_storage_get_hearing_aid_prop( const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id, uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs); constexpr uint8_t CODEC_G722_16KHZ = 0x01; constexpr uint8_t CODEC_G722_24KHZ = 0x02; Loading Loading @@ -626,11 +629,16 @@ class HearingAidImpl : public HearingAid { for (const gatt::Characteristic& charac : service->characteristics) { if (charac.uuid == READ_ONLY_PROPERTIES_UUID) { DVLOG(2) << "Reading read only properties " if (!btif_storage_get_hearing_aid_prop( hearingDevice->address, &hearingDevice->capabilities, &hearingDevice->hi_sync_id, &hearingDevice->render_delay, &hearingDevice->preparation_delay, &hearingDevice->codecs)) { VLOG(2) << "Reading read only properties " << loghex(charac.value_handle); BtaGattQueue::ReadCharacteristic( conn_id, charac.value_handle, HearingAidImpl::OnReadOnlyPropertiesReadStatic, nullptr); } } else if (charac.uuid == AUDIO_CONTROL_POINT_UUID) { hearingDevice->audio_control_point_handle = charac.value_handle; // store audio control point! Loading
system/bta/include/bta_hearing_aid_api.h +5 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,11 @@ struct HearingDevice { audio_status_ccc_handle(0), service_changed_ccc_handle(0), read_psm_handle(0), capabilities(0), hi_sync_id(0), render_delay(0), preparation_delay(0), codecs(0), playback_started(false), command_acked(false), read_rssi_count(0) {} Loading
system/btif/include/btif_storage.h +5 −0 Original line number Diff line number Diff line Loading @@ -231,6 +231,11 @@ void btif_storage_remove_hearing_aid(const RawAddress& address); void btif_storage_set_hearing_aid_white_list(const RawAddress& address, bool add_to_whitelist); /** Get the hearing aid device properties. */ bool btif_storage_get_hearing_aid_prop( const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id, uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs); /******************************************************************************* * * Function btif_storage_is_retricted_device Loading
system/btif/src/btif_storage.cc +41 −0 Original line number Diff line number Diff line Loading @@ -1643,6 +1643,47 @@ void btif_storage_set_hearing_aid_white_list(const RawAddress& address, btif_config_save(); } /** Get the hearing aid device properties. */ bool btif_storage_get_hearing_aid_prop( const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id, uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs) { std::string addrstr = address.ToString(); int value; if (btif_config_get_int(addrstr, HEARING_AID_CAPABILITIES, &value)) { *capabilities = value; } else { return false; } if (btif_config_get_int(addrstr, HEARING_AID_CODECS, &value)) { *codecs = value; } else { return false; } if (btif_config_get_int(addrstr, HEARING_AID_RENDER_DELAY, &value)) { *render_delay = value; } else { return false; } if (btif_config_get_int(addrstr, HEARING_AID_PREPARATION_DELAY, &value)) { *preparation_delay = value; } else { return false; } uint64_t lvalue; if (btif_config_get_uint64(addrstr, HEARING_AID_SYNC_ID, &lvalue)) { *hi_sync_id = lvalue; } else { return false; } return true; } /******************************************************************************* * * Function btif_storage_is_restricted_device Loading