VLOG(2) << __func__ << ": " << address;
+ bool connected = hearingDevice->accepting_audio;
hearingDevice->accepting_audio = false;
if (hearingDevice->connecting_actively) {
hearingDevices.Remove(address);
- callbacks->OnConnectionState(ConnectionState::DISCONNECTED, address);
+ if (connected)
+ callbacks->OnConnectionState(ConnectionState::DISCONNECTED, address);
}
void OnGattDisconnected(tGATT_STATUS status, uint16_t conn_id,
#include <base/callback_forward.h>
#include <hardware/bt_hearing_aid.h>
-using bluetooth::Uuid;
/** Implementations of HearingAid will also implement this interface */
class HearingAidAudioReceiver {
#include <bluetooth/uuid.h>
#include <hardware/bluetooth.h>
+#include <hardware/bt_hearing_aid.h>
#include "advertise_data_parser.h"
#include "bt_common.h"
extern bt_status_t btif_sdp_execute_service(bool b_enable);
extern int btif_hh_connect(const RawAddress* bd_addr);
extern bt_status_t btif_hd_execute_service(bool b_enable);
+extern bluetooth::hearing_aid::HearingAidInterface*
+btif_hearing_aid_get_interface();
/******************************************************************************
* Functions
#if (defined(BTA_HD_INCLUDED) && (BTA_HD_INCLUDED == TRUE))
btif_hd_remove_device(bd_addr);
#endif
+ btif_hearing_aid_get_interface()->RemoveDevice(bd_addr);
btif_storage_remove_bonded_device(&bd_addr);
bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_NONE);
break;
Unretained(HearingAid::Get()), volume));
}
+ void RemoveDevice(const RawAddress& address) override {
+ DVLOG(2) << __func__ << " address: " << address;
+ do_in_bta_thread(FROM_HERE, Bind(&HearingAid::Disconnect,
+ Unretained(HearingAid::Get()), address));
+ do_in_jni_thread(FROM_HERE,
+ Bind(&btif_storage_remove_hearing_aid, address));
+ }
+
void Cleanup(void) {
DVLOG(2) << __func__;
do_in_bta_thread(FROM_HERE, Bind(&HearingAid::CleanUp));
/** Closes the interface. */
virtual void Cleanup(void) = 0;
+
+ /* Called when Hearing Aid is unbonded. */
+ virtual void RemoveDevice(const RawAddress& address) = 0;
};
} // namespace hearing_aid