class_docstr: Python wrapper for launch iOS RPC to simulator.
  
  mode : str
      Server mode. See RPCServerMode.
  
  host : str
      The tracker/proxy address.
  
  port : int
      The tracker/proxy port.
  
  key : str
      The key used to identify the device type in tracker.
class_docstr_tok: ["Python","wrapper","for","launch","iOS","RPC","to","simulator",".","mode",":","str","Server","mode",".","See","RPCServerMode",".","host",":","str","The","tracker\/proxy","address",".","port",":","int","The","tracker\/proxy","port",".","key",":","str","The","key","used","to","identify","the","device","type","in","tracker","."]
docstr: Wait for the iOS RPC server to start.
  
  waiting_time : int
      The maximum waiting time during which it is necessary
      to receive a message from RPC Server.
  
  hz : int
      The frequency of checking (in hertz) messages from RPC Server.
      Checks for messages from the server will occur every 1 / hz second.
  
  should_print_host_and_port : bool
      A flag that indicates that RPC Server should print the host and port
      on which it was started.
      Used for standalone mode.
docstr_tok: ["Wait","for","the","iOS","RPC","server","to","start",".","waiting_time",":","int","The","maximum","waiting","time","during","which","it","is","necessary","to","receive","a","message","from","RPC","Server",".","hz",":","int","The","frequency","of","checking","(","in","hertz",")","messages","from","RPC","Server",".","Checks","for","messages","from","the","server","will","occur","every","1","\/","hz","second",".","should_print_host_and_port",":","bool","A","flag","that","indicates","that","RPC","Server","should","print","the","host","and","port","on","which","it","was","started",".","Used","for","standalone","mode","."]
code: def _wait_launch_complete(
      self, waiting_time, hz, should_print_host_and_port=False
  ):
      # pylint: disable=too-many-locals
      """
      Wait for the iOS RPC server to start.
  
      waiting_time : int
          The maximum waiting time during which it is necessary
          to receive a message from RPC Server.
  
      hz : int
          The frequency of checking (in hertz) messages from RPC Server.
          Checks for messages from the server will occur every 1 / hz second.
  
      should_print_host_and_port : bool
          A flag that indicates that RPC Server should print the host and port
          on which it was started.
          Used for standalone mode.
      """
  
      class Switch:
          """A simple helper class for boolean switching."""
  
          def __init__(self):
              self._on = False
  
          def toggle(self):
              """Toggle flag."""
              self._on = not self._on
  
          @property
          def on(self):
              """Flag of this switch."""
              return self._on
  
      def watchdog():
          for _ in range(waiting_time * hz):
              time.sleep(1.0 / hz)
              if switch_have_data.on:
                  break
          if not switch_have_data.on:
              self.launch_process.terminate()
              switch_process_was_terminated.toggle()
  
      switch_have_data = Switch()
      switch_process_was_terminated = Switch()
      watchdog_thread = threading.Thread(target=watchdog)
  
      host, port = None, None
      watchdog_thread.start()
      for line in self.launch_process.stdout:
          if not switch_have_data.on:
              switch_have_data.toggle()
  
          found = str(line).find(
              ServerIOSLauncher.ConsoleMarkers.STOPPED.value
          )
          if found != -1:
              raise RuntimeError(
                  "[ERROR] Crash during RCP Server launch.. "
              )
  
          found = str(line).find(
              ServerIOSLauncher.ConsoleMarkers.CALLSTACK.value
          )
          if found != -1:
              raise RuntimeError(
                  "[ERROR] Crash during RCP Server launch.. "
              )
  
          found = str(line).find(
              ServerIOSLauncher.ConsoleMarkers.SERVER_IP.value
          )
          if found != -1:
              ip = str(line)[
                  found
                  + len(
                      ServerIOSLauncher.ConsoleMarkers.SERVER_IP.value
                  ) :
              ].rstrip("\n")
              host = ip
  
          found = str(line).find(
              ServerIOSLauncher.ConsoleMarkers.SERVER_PORT.value
          )
          if found != -1:
              port = str(line)[
                  found
                  + len(
                      ServerIOSLauncher.ConsoleMarkers.SERVER_PORT.value
                  ) :
              ].rstrip("\n")
              port = int(port)
  
          if (
              str(line).find(
                  ServerIOSLauncher.ConsoleMarkers.CONNECTED.value
              )
              != -1
          ):
              # rpc server reports that it successfully connected
              break
      watchdog_thread.join()
  
      if switch_process_was_terminated.on:
          raise TimeoutError(
              "Can't get a response from the iOS Server."
          )
      if should_print_host_and_port:
          if host is None or port is None:
              raise RuntimeError(
                  "No messages with actual host and port."
              )
          self.port = port
  
imports: import os
  import json
  import time
  import threading
  import subprocess
  from enum import Enum
  from typing import Dict, List, AnyStr
label_desc: Use image node_id 7 for calling the ServerIOSLauncher obj's underlying member method code with example usage: obj._wait_launch_complete(waiting_time, hz, should_print_host_and_port) and returns: self