| 23 | |
| 24 | |
| 25 | class AndroidBotMain( |
| 26 | ABC, |
| 27 | LoggerRecord, |
| 28 | ThreadingTCPServer, |
| 29 | AndroidLoadWait, |
| 30 | Driver, |
| 31 | SendClientData, |
| 32 | UniversalFunction, |
| 33 | CoordinateOperation, |
| 34 | ElementOperation, |
| 35 | EquipmentOperation, |
| 36 | ScreenProjectionOperation, |
| 37 | FileTransfer, |
| 38 | Control, |
| 39 | OcrCorrelation, |
| 40 | YoloService, |
| 41 | UrlRequest, |
| 42 | ColorFindingOperation, |
| 43 | MapFindingOperation, |
| 44 | ScreenshotOperation, |
| 45 | AndroidHidCorrelation, |
| 46 | VerificationCodeOperation, |
| 47 | ChatGenerative, |
| 48 | DataBaseHandle, |
| 49 | Sqlite3DataBaseHandle, |
| 50 | WebSocketServerUse |
| 51 | ): |
| 52 | |
| 53 | @abstractmethod |
| 54 | def script_main(self): |
| 55 | pass |
| 56 | |
| 57 | def handle(self): |
| 58 | self.info(f"<-<- Client connection at {self.client_address[0]}: {self.client_address[1]}") |
| 59 | self.debug(f"<-<- Client connection at {self.client_address[0]}: {self.client_address[1]}") |
| 60 | self.script_main() |
| 61 | |
| 62 | |
| 63 | @classmethod |
| 64 | def execute(self, IP: str, Port, Qt = None, WebsocketSwitch = False, WebsocketPort = 8888): |
| 65 | if Qt: |
| 66 | self.Qt = Qt |
| 67 | |
| 68 | if WebsocketSwitch: |
| 69 | server = WebSocketServerThread(IP, WebsocketPort, self.Websocket_Log_Level) |
| 70 | server.start() |
| 71 | |
| 72 | ThreadingTCPServer.StartThreadingTCPServer(self, IP, Port) |
| 73 | |
| 74 | |
| 75 | @classmethod |
| 76 | def StopSrver(self): |
| 77 | try: |
| 78 | self.server.shutdown() # 停止接受新的连接 |
| 79 | self.server.socket.close() # 关闭服务器套接字 |
| 80 | except Exception as e: |
| 81 | pass |
| 82 |
nothing calls this directly
no outgoing calls
no test coverage detected