def _on_connection_finished(self, success, result, failure_reason, context):
        """Callback called when the connection attempt to a BLE device has finished.
        It is executed in the baBLE working thread: should not be blocking.

        Args:
            success (bool): A bool indicating that the operation is successful or not
            result (dict): The connection information (if successful)
              - connection_handle (int): The connection handle
              - address (str): The device BT address
              - address_type (str): The device address type (either 'random' or 'public')
            failure_reason (any): An object indicating the reason why the operation is not successful (else None)
        """
        connection_id = context['connection_id']

        if not success:
            self._logger.error("Error while connecting to the device err=%s", failure_reason)

            # If connection failed to be established, we just should retry to connect
            if failure_reason.packet.native_class == 'HCI' and failure_reason.packet.native_status == 0x3e:
                context['retry_connect'] = True

            self._on_connection_failed(connection_id, self.id, success, failure_reason)
            return

        context['connection_handle'] = result['connection_handle']

        # After connection has been done, probe GATT services
        self.bable.probe_services(
            connection_handle=context['connection_handle'],
            on_services_probed=[self._on_services_probed, context]
        )
def _on_connection_finished ( self , success , result , failure_reason , context ) : connection_id = context [ 'connection_id' ] if not success : self . _logger . error ( "Error while connecting to the device err=%s" , failure_reason ) if failure_reason . packet . native_class == 'HCI' and failure_reason . packet . native_status == 0x3e : context [ 'retry_connect' ] = True self . _on_connection_failed ( connection_id , self . id , success , failure_reason ) return context [ 'connection_handle' ] = result [ 'connection_handle' ] self . bable . probe_services ( connection_handle = context [ 'connection_handle' ] , on_services_probed = [ self . _on_services_probed , context ] )
Callback called when the connection attempt to a BLE device has finished.
        It is executed in the baBLE working thread: should not be blocking.

        Args:
            success (bool): A bool indicating that the operation is successful or not
            result (dict): The connection information (if successful)
              - connection_handle (int): The connection handle
              - address (str): The device BT address
              - address_type (str): The device address type (either 'random' or 'public')
            failure_reason (any): An object indicating the reason why the operation is not successful (else None)