src/connectivity/bluetooth/core/bt-host/fidl/host_server.cc
// Attempt to connect to peer identified by |peer_id|. The peer must be
// in our peer cache. We will attempt to connect technologies (LowEnergy,
// Classic or Dual-Mode) as the peer claims to support when discovered
Attempt to connect to peer identified by |peer_id|. The peer must be
in our peer cache. We will attempt to connect technologies (LowEnergy,
Classic or Dual-Mode) as the peer claims to support when discovered
Attempt to connect to peer identified by |peer_id| . The peer must be in our peer cache . We will attempt to connect technologies ( LowEnergy Classic or Dual - Mode ) as the peer claims to support when discovered
void HostServer::Connect(fbt::PeerId peer_id, ConnectCallback callback) {
  bt::PeerId id{peer_id.value};
  auto peer = adapter()->peer_cache()->FindById(id);
  if (!peer) {
    callback(fit::error(fsys::Error::PEER_NOT_FOUND));
    return;
  }
  if (peer->bredr()) {
    ConnectBrEdr(id, std::move(callback));
    return;
  }
  ConnectLowEnergy(id, std::move(callback));
}
void HostServer :: Connect ( fbt :: PeerId peer_id , ConnectCallback callback ) { bt :: PeerId id { peer_id . value } ; auto peer = adapter ( ) -> peer_cache ( ) -> FindById ( id ) ; if ( ! peer ) { callback ( fit :: error ( fsys :: Error :: PEER_NOT_FOUND ) ) ; return ; } if ( peer -> bredr ( ) ) { ConnectBrEdr ( id , std :: move ( callback ) ) ; return ; } ConnectLowEnergy ( id , std :: move ( callback ) ) ; }
Attempt to connect to peer identified by |peer_id|.
Attempt to connect to peer identified by |peer_id| .
// We don't support connecting to peers that are not in our cache // TODO(fxbug.dev/1242): Dual-mode currently not supported; if the peer supports // BR/EDR we prefer BR/EDR. If a dual-mode peer, we should attempt to connect // both protocols.