src/connectivity/bluetooth/core/bt-host/fidl/host_server.cc
// Initiate an outgoing Br/Edr connection, unless already connected
// Br/Edr connections are host-wide, and stored in BrEdrConnectionManager
Initiate an outgoing Br/Edr connection, unless already connected
Br/Edr connections are host-wide, and stored in BrEdrConnectionManager
Initiate an outgoing Br / Edr connection unless already connected Br / Edr connections are host - wide and stored in BrEdrConnectionManager
void HostServer::ConnectBrEdr(PeerId peer_id, ConnectCallback callback) {
  auto on_complete = [callback = std::move(callback), peer_id](auto status, auto connection) {
    if (!status) {
      ZX_ASSERT(!connection);
      bt_log(DEBUG, "bt-host", "failed to connect BR/EDR transport to peer (id %s)",
             bt_str(peer_id));
      callback(fit::error(HostErrorToFidl(status.error())));
      return;
    }
    ZX_ASSERT(connection);
    ZX_ASSERT(peer_id == connection->peer_id());
    callback(fit::ok());
  };
  if (!adapter()->bredr_connection_manager()->Connect(peer_id, std::move(on_complete))) {
    callback(fit::error(fsys::Error::FAILED));
  }
}
void HostServer :: ConnectBrEdr ( PeerId peer_id , ConnectCallback callback ) { auto on_complete = [ callback = std :: move ( callback ) , peer_id ] ( auto status , auto connection ) { if ( ! status ) { ZX_ASSERT ( ! connection ) ; bt_log ( DEBUG , " " , " " , bt_str ( peer_id ) ) ; callback ( fit :: error ( HostErrorToFidl ( status . error ( ) ) ) ) ; return ; } ZX_ASSERT ( connection ) ; ZX_ASSERT ( peer_id == connection -> peer_id ( ) ) ; callback ( fit :: ok ( ) ) ; } ; if ( ! adapter ( ) -> bredr_connection_manager ( ) -> Connect ( peer_id , std :: move ( on_complete ) ) ) { callback ( fit :: error ( fsys :: Error :: FAILED ) ) ; } }
Initiate an outgoing Br/Edr connection, unless already connected
Br/Edr connections are host-wide, and stored in BrEdrConnectionManager
Initiate an outgoing Br / Edr connection unless already connected Br / Edr connections are host - wide and stored in BrEdrConnectionManager
// We must be connected and to the right peer