async fn connect(&mut self, mut params: bredr::ConnectParameters) -> Result<(), anyhow::Error> {
        if self.connection.connected() {
            info!("Already connected to peer: {}.", self.id);
            return Ok(());
        }
        info!("Initiating connection to peer: {}", self.id);
        let channel = self
            .profile_proxy
            .connect(&mut self.id.into(), &mut params)
            .await?
            .map_err(|e| format_err!("Profile connection request error: {:?}", e))?;
        self.connection.connect(channel.try_into()?);
        if let Some(id) = self.manager_id {
            self.notify_peer_connected(id).await;
            self.setup_handler()
                .await
                .map_err(|e| format_err!("Error setting up peer handler: {}", e))?;
        }
        Ok(())
    }
/// Make a connection to the peer only if there is not an existing connection.
Make a connection to the peer only if there is not an existing connection.
Make a connection to the peer only if there is not an existing connection .
async fn connect(&mut self, mut params: bredr::ConnectParameters) -> Result<(), anyhow::Error> {
        if self.connection.connected() {
            info!("Already connected to peer: {}.", self.id);
            return Ok(());
        }
        info!("Initiating connection to peer: {}", self.id);
        let channel = self
            .profile_proxy
            .connect(&mut self.id.into(), &mut params)
            .await?
            .map_err(|e| format_err!("Profile connection request error: {:?}", e))?;
        self.connection.connect(channel.try_into()?);
        if let Some(id) = self.manager_id {
            self.notify_peer_connected(id).await;
            self.setup_handler()
                .await
                .map_err(|e| format_err!("Error setting up peer handler: {}", e))?;
        }
        Ok(())
    }
async fn connect ( & mut self , mut params : bredr :: ConnectParameters ) -> Result < ( ) , anyhow :: Error > { if self . connection . connected ( ) { info ! ( " " self id ) ; return Ok ( ( ) ) ; } info ! ( " " self id ) ; let channel = self . profile_proxy . connect ( & mut self . id . into ( ) , & mut params ) . await ? . map_err ( | e | format_err ! ( " " e ) ) ? ; self . connection . connect ( channel . try_into ( ) ? ) ; if let Some ( id ) = self . manager_id { self . notify_peer_connected ( id ) . await ; self . setup_handler ( ) . await . map_err ( | e | format_err ! ( " " e ) ) ? ; } Ok ( ( ) ) }
Make a connection to the peer only if there is not an existing connection.
Make a connection to the peer only if there is not an existing connection .
&mut self
params
bredr::ConnectParameters
&mut self
params
bredr::ConnectParameters