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.
| 239 | |
| 240 | |
| 241 | class ServerIOSLauncher: |
| 242 | """ |
| 243 | Python wrapper for launch iOS RPC to simulator. |
| 244 | |
| 245 | mode : str |
| 246 | Server mode. See RPCServerMode. |
| 247 | |
| 248 | host : str |
| 249 | The tracker/proxy address. |
| 250 | |
| 251 | port : int |
| 252 | The tracker/proxy port. |
| 253 | |
| 254 | key : str |
| 255 | The key used to identify the device type in tracker. |
| 256 | """ |
| 257 | |
| 258 | booted_devices = [] |
| 259 | bundle_id = os.environ.get("BUNDLE_ID") |
| 260 | bundle_path = os.environ.get("BUNDLE_PATH") |
| 261 | |
| 262 | class ConsoleMarkers(Enum): |
| 263 | """ |
| 264 | Marker-messages that iOS RPC Server should print to the console output |
| 265 | when its states change (see apps/ios_rpc/tvmrpc/RPCServer.mm). |
| 266 | |
| 267 | STOPPED : str |
| 268 | iOS RPC Server process was stopped |
| 269 | |
| 270 | CALLSTACK : str |
| 271 | Call stack if RPC Server was stopped with an error. |
| 272 | |
| 273 | CONNECTED : str |
| 274 | RPC Server reports that it successfully connected. |
| 275 | |
| 276 | SERVER_IP : str |
| 277 | IP on which RPC Server started (for standalone mode). |
| 278 | |
| 279 | SERVER_PORT : str |
| 280 | HOST on which RPC Server started (for standalone mode). |
| 281 | """ |
| 282 | |
| 283 | STOPPED = "PROCESS_STOPPED" |
| 284 | CALLSTACK = "First throw call stack" |
| 285 | CONNECTED = "[IOS-RPC] STATE: 2" |
| 286 | SERVER_IP = "[IOS-RPC] IP: " |
| 287 | SERVER_PORT = "[IOS-RPC] PORT: " |
| 288 | |
| 289 | def __init__(self, mode, host, port, key): |
| 290 | if not ServerIOSLauncher.is_compatible_environment(): |
| 291 | raise RuntimeError( |
| 292 | "Can't create ServerIOSLauncher instance." |
| 293 | " No environment variables set for iOS RPC Server." |
| 294 | ) |
| 295 | |
| 296 | self.host = host |
| 297 | self.port = port |
| 298 |