Loading system/bta/hearing_aid/hearing_aid.cc +12 −5 Original line number Diff line number Diff line Loading @@ -678,13 +678,20 @@ class HearingAidImpl : public HearingAid { if (tx_phys == PHY_LE_2M && rx_phys == PHY_LE_2M) { LOG_INFO("%s phy update to 2M successful", ADDRESS_TO_LOGGABLE_CSTR(hearingDevice->address)); hearingDevice->phy_update_retry_remain = PHY_UPDATE_RETRY_LIMIT; return; } if (hearingDevice->phy_update_retry_remain > 0) { LOG_INFO( "%s phy update successful but not target phy, try again. tx_phys: " "%u,rx_phys: %u", ADDRESS_TO_LOGGABLE_CSTR(hearingDevice->address), tx_phys, rx_phys); BTM_BleSetPhy(hearingDevice->address, PHY_LE_2M, PHY_LE_2M, 0); hearingDevice->phy_update_retry_remain--; } else { LOG_INFO("no more phy update after %d retry", PHY_UPDATE_RETRY_LIMIT); } } void OnServiceChangeEvent(const RawAddress& address) { Loading system/bta/include/bta_hearing_aid_api.h +9 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ constexpr uint8_t CAPABILITY_SIDE = 0x01; constexpr uint8_t CAPABILITY_BINAURAL = 0x02; constexpr uint8_t CAPABILITY_RESERVED = 0xFC; // Number of retry for phy update. This targets to reduce phy update collision. constexpr uint8_t PHY_UPDATE_RETRY_LIMIT = 5; /** Implementations of HearingAid will also implement this interface */ class HearingAidAudioReceiver { public: Loading Loading @@ -160,6 +163,8 @@ struct HearingDevice { bool gap_opened; int phy_update_retry_remain; HearingDevice(const RawAddress& address, uint8_t capabilities, uint16_t codecs, uint16_t audio_control_point_handle, uint16_t audio_status_handle, uint16_t audio_status_ccc_handle, Loading Loading @@ -188,7 +193,8 @@ struct HearingDevice { playback_started(false), command_acked(false), read_rssi_count(0), gap_opened(false) {} gap_opened(false), phy_update_retry_remain(PHY_UPDATE_RETRY_LIMIT) {} HearingDevice(const RawAddress& address, bool first_connection) : address(address), Loading @@ -211,7 +217,8 @@ struct HearingDevice { playback_started(false), command_acked(false), read_rssi_count(0), gap_opened(false) {} gap_opened(false), phy_update_retry_remain(PHY_UPDATE_RETRY_LIMIT) {} HearingDevice() : HearingDevice(RawAddress::kEmpty, false) {} Loading Loading
system/bta/hearing_aid/hearing_aid.cc +12 −5 Original line number Diff line number Diff line Loading @@ -678,13 +678,20 @@ class HearingAidImpl : public HearingAid { if (tx_phys == PHY_LE_2M && rx_phys == PHY_LE_2M) { LOG_INFO("%s phy update to 2M successful", ADDRESS_TO_LOGGABLE_CSTR(hearingDevice->address)); hearingDevice->phy_update_retry_remain = PHY_UPDATE_RETRY_LIMIT; return; } if (hearingDevice->phy_update_retry_remain > 0) { LOG_INFO( "%s phy update successful but not target phy, try again. tx_phys: " "%u,rx_phys: %u", ADDRESS_TO_LOGGABLE_CSTR(hearingDevice->address), tx_phys, rx_phys); BTM_BleSetPhy(hearingDevice->address, PHY_LE_2M, PHY_LE_2M, 0); hearingDevice->phy_update_retry_remain--; } else { LOG_INFO("no more phy update after %d retry", PHY_UPDATE_RETRY_LIMIT); } } void OnServiceChangeEvent(const RawAddress& address) { Loading
system/bta/include/bta_hearing_aid_api.h +9 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ constexpr uint8_t CAPABILITY_SIDE = 0x01; constexpr uint8_t CAPABILITY_BINAURAL = 0x02; constexpr uint8_t CAPABILITY_RESERVED = 0xFC; // Number of retry for phy update. This targets to reduce phy update collision. constexpr uint8_t PHY_UPDATE_RETRY_LIMIT = 5; /** Implementations of HearingAid will also implement this interface */ class HearingAidAudioReceiver { public: Loading Loading @@ -160,6 +163,8 @@ struct HearingDevice { bool gap_opened; int phy_update_retry_remain; HearingDevice(const RawAddress& address, uint8_t capabilities, uint16_t codecs, uint16_t audio_control_point_handle, uint16_t audio_status_handle, uint16_t audio_status_ccc_handle, Loading Loading @@ -188,7 +193,8 @@ struct HearingDevice { playback_started(false), command_acked(false), read_rssi_count(0), gap_opened(false) {} gap_opened(false), phy_update_retry_remain(PHY_UPDATE_RETRY_LIMIT) {} HearingDevice(const RawAddress& address, bool first_connection) : address(address), Loading @@ -211,7 +217,8 @@ struct HearingDevice { playback_started(false), command_acked(false), read_rssi_count(0), gap_opened(false) {} gap_opened(false), phy_update_retry_remain(PHY_UPDATE_RETRY_LIMIT) {} HearingDevice() : HearingDevice(RawAddress::kEmpty, false) {} Loading