def __init__ (self, proto = RFCOMM, _sockdata = None):
        if not proto in [ RFCOMM, L2CAP ]:
            raise ValueError ("invalid protocol")

        self.proto = proto

        if proto == RFCOMM:
            self.bind            = self.rfcomm_bind
            self.listen          = self.rfcomm_listen
            self.accept          = self.rfcomm_accept
            self.connect         = self.rfcomm_connect
            self.send            = self.rfcomm_send
            self.recv            = self.rfcomm_recv
            self.close           = self.rfcomm_close
            self.getsockname     = self.rfcomm_getsockname
            self.setblocking     = self.rfcomm_setblocking
            self.settimeout      = self.rfcomm_settimeout
            self.gettimeout      = self.rfcomm_gettimeout
            self.dup             = self.rfcomm_dup
            self.makefile        = self.rfcomm_makefile
            self.fileno          = self.rfcomm_fileno
            self.__make_cobjects = self.__rfcomm_make_cobjects
            self._advertise_service = self.__rfcomm_advertise_service

            if _sockdata:
                self._wc, self._if, self.readsock = _sockdata
            else:
                self.__make_cobjects ()

            self.connected = self._wc.is_connected ()

        elif proto == L2CAP:
            dbg ("creating l2cap socket")
            self.bind            = self.l2cap_bind
            self.listen          = self.l2cap_listen
            self.accept          = self.l2cap_accept
            self.connect         = self.l2cap_connect
            self.send            = self.l2cap_send
            self.recv            = self.l2cap_recv
            self.close           = self.l2cap_close
            self.getsockname     = self.l2cap_getsockname
            self.setblocking     = self.l2cap_setblocking
            self.settimeout      = self.l2cap_settimeout
            self.gettimeout      = self.l2cap_gettimeout
            self.dup             = self.l2cap_dup
            self.makefile        = self.l2cap_makefile
            self.fileno          = self.l2cap_fileno
            self.__make_cobjects = self.__l2cap_make_cobjects
            self._advertise_service = self.__l2cap_advertise_service

            if _sockdata:
                self._wc, self._if, self.readsock = _sockdata
                self.connected = True
            else:
                self.__make_cobjects ()
                self.connected = False
        else:
            raise NotImplementedError ()

        self.nonblocking = False
        self.connecting = False
        self.listening = False
        self.bound = False
        self.received_data = []
        self.last_event_code = None
        self.port = 0
        self._sdpservice = None
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/pybluez/bluetooth/widcomm.py/BluetoothSocket.__init__/original