Connect to the drone.

        :raises RuntimeError: if the drone is connected or closed already.
166581
def connect(self):
        '''
        
        '''
        if self.connected:
            raise RuntimeError(
                '{} is connected already'.format(self.__class__.__name__))
        if self.closed:
            raise RuntimeError(
                '{} is closed already'.format(self.__class__.__name__))
        self.connected = True
        self._connect()
300976
def serial_connect(self):
		
		self.serial_get()
		try:
			self.serial_connection.start()
		except c1218.errors.C1218IOError as error:
			self.logger.error('serial connection has been opened but the meter is unresponsive')
			raise error
		self._serial_connected = True
		return True
423789
def connect(self):
        
        self.end_live_capture = False
        if not self.ommit_ping and not self.helper.test_ping():
            raise ZKNetworkError("can't reach device (ping %s)" % self.__address[0])
        if not self.force_udp and self.helper.test_tcp() == 0:
            self.user_packet_size = 72 # default zk8
        self.__create_socket()
        self.__session_id = 0
        self.__reply_id = const.USHRT_MAX - 1
        cmd_response = self.__send_command(const.CMD_CONNECT)
        self.__session_id = self.__header[2]
        if cmd_response.get('code') == const.CMD_ACK_UNAUTH:
            if self.verbose: print ("try auth")
            command_string = make_commkey(self.__password, self.__session_id)
            cmd_response = self.__send_command(const.CMD_AUTH, command_string)
        if cmd_response.get('status'):
            self.is_connect = True
            return self
        else:
            if cmd_response["code"] == const.CMD_ACK_UNAUTH:
                raise ZKErrorResponse("Unauthenticated")
            if self.verbose: print ("connect err response {} ".format(cmd_response["code"]))
            raise ZKErrorResponse("Invalid response: Can't connect")
1024561
def do_connect(self, arg):
        '''  '''
        if self.arm.is_connected():
            print(self.style.error('Error: ', 'Arm is already connected.'))
        else:
            try:
                port = self.arm.connect()
                print(self.style.success('Success: ',
                                         'Connected to \'{}\'.'.format(port)))
            except r12.ArmException as e:
                print(self.style.error('Error: ', str(e)))
52966
def connect(self, their_unl, events, force_master=1, hairpin=1,
                nonce="0" * 64):
        
        parms = (their_unl, events, force_master, hairpin, nonce)
        t = Thread(target=self.connect_handler, args=parms)
        t.start()
        self.unl_threads.append(t)
376451
def connect(self):
        """"""
        if not self.connect_attempted:
            self.connect_attempted = True
            self.client.connect(self.host, port=self.port)
            self.client.loop_start()

            while not self.connected:
                log.info('waiting for MQTT connection...')
                time.sleep(1)
352928
def connect(self):
        """"""
        self._client = Telnet(self.hostname, self.port)
        self.closed = False
        query = {
            "MPRPC": self.VERSION,
            "AUTH": {
                "USERNAME": self.username,
                "PASSWORD": self.password
            }
        }
        queryb = self.encoder(query)
        if self.debug is True:
            print("send auth {}".format(queryb))
        self._client.write(queryb)
        self.remote_info = self._responsehandler()
508726
def connect(self):
        
        print('Connecting to %s' % self._link_uri)
        self._cf.open_link(self._link_uri)
1142963
def connect(self):
        
        retries = 0
        while retries < MAX_CONNECTION_RETRIES:
            try:
                self._connection.connect()
                logger.info('Connected to APNs')
                return
            except Exception:  # pylint: disable=broad-except
                # close the connnection, otherwise next connect() call would do nothing
                self._connection.close()
                retries += 1
                logger.exception('Failed connecting to APNs (attempt %s of %s)', retries, MAX_CONNECTION_RETRIES)

        raise ConnectionFailed()
242891
def connect(self):
    """"""
    if self._connected or self.is_alive():
      raise ConnectionExistsError("Already connected")
    # After starting the thread we wait for it to post us
    # an event signifying that connection is established. This
    # ensures that the caller only resumes when we are fully connected.
    self.start()
    with self._lock:
      self._connect_cond.wait_for(lambda: self._connected)
542025
def connect(self):
        
        logger.info("Connecting to %s:%s", self._host, self._port)
        reader, writer = yield from asyncio.open_connection(
                self._host, self._port, loop=self._loop)
        self._ioloop_future = ensure_future(
                self._ioloop(reader, writer), loop=self._loop)
        logger.info("Connected")
671098
def open(self):
        

        if not self._is_connected:
            
            print("Connecting to arduino on {}... ".format(self.device),end="")

            self.comm = serial.Serial()
            self.comm.port = self.device
            self.comm.baudrate = self.baud_rate
            self.comm.timeout = self.timeout
            self.dtr = self.enable_dtr
            self.comm.open()

            time.sleep(self.settle_time)
            self._is_connected = True

            print("done.")
1188738
def _do_connect(self):
        """"""
        _, self._protocol = yield from self._loop.create_connection(
            lambda: SnapcastProtocol(self._callbacks), self._host, self._port)
1016864
def connect(self, origin=None):
        
        self.logger.debug('Establish connection...')

        if self.connected:
            self.logger.warning('Connection already established. Return...')
            return

        if origin is not None:
            self.origin = origin

        self.auto_reconnect = True

        self.ws_thread = threading.Thread(
            name="APIConnectionThread_{}".format(uuid.uuid1()),
            target=self._run_forever)
        self.ws_thread.daemon = True
        self.ws_thread.start()
86149
def connect(self):
        
        if self._sock:
            return
        try:
            sock = self._connect()
        except socket.error:
            e = sys.exc_info()[1]
            raise ConnectionError(self._error_message(e))

        self._sock = sock
        try:
            self.on_connect()
        except SSDBError:
            # clean up after any error in on_connect
            self.disconnect()
            raise

        # run any user callbacks. right now the only internal callback
        # is for pubsub channel/pattern resubscription
        for callback in self._connect_callbacks:
            callback(self)
1181804
def sync_connect(self):
        """"""
        loop = asyncio.get_event_loop()
        task = loop.create_task(self.connect())
        loop.run_until_complete(task)
431599
def _connect(self):
        
        future = concurrent.Future()

        # Attempt to get a cached connection from the connection pool
        try:
            connection = self._pool_manager.get(self.pid, self)
            self._connections[connection.fileno()] = connection
            future.set_result(connection)

            # Add the connection to the IOLoop
            self._ioloop.add_handler(connection.fileno(),
                                     self._on_io_events,
                                     ioloop.IOLoop.WRITE)
        except pool.NoIdleConnectionsError:
            self._create_connection(future)

        return future