def rfcomm_connect (self, addrport):
        addr, port = addrport
        dbg ("connecting to %s port %d" % (addr, port))
        if not is_valid_address (addr):
            raise ValueError ("invalid address %s" % addr)

        self._if.assign_scn_value (RFCOMM_UUID, port)
        self._if.set_security_level ("", _widcomm.BTM_SEC_NONE, False)

        result = self._wc.open_client (port, str_to_BD_ADDR (addr), DEFAULT_MTU)
        if result != _widcomm.RFCOMM_SUCCESS:
            raise BluetoothError (_port_return_code_to_str (result))

        self.connecting = True
        while self.connecting:
            self.rfcomm_read_msg ()

        if not self._wc.is_connected ():
            raise BluetoothError ("connection failed")
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/pybluez/bluetooth/widcomm.py/BluetoothSocket.rfcomm_connect/original