MCPcopy Create free account
hub / github.com/a943512/PyAibote / AndroidLoadWait

Class AndroidLoadWait

PyAibote/AndroidBotModel/AndroidLoadWait.py:4–65  ·  view source on GitHub ↗

隐式等待和显示等待 Implicit waiting and explicit waiting

Source from the content-addressed store, hash-verified

2import copy
3
4class AndroidLoadWait:
5 """
6 隐式等待和显示等待
7 Implicit waiting and explicit waiting
8 """
9
10 Implicit_Waiting = 0
11 Implicit_Waiting_Frequency = 0
12 Implicit_Waiting_Throwing = False
13 Show_Waiting = 0
14 Show_Waiting_Frequency = 0
15 Show_Waiting_Throwing = False
16
17 def _Send(self,data):
18 if len(data) > 10000:
19 self.debug(rf"->>> {data[:100]}......")
20 else:
21 self.debug(rf"->>> {data}")
22
23 self.request.sendall(data)
24 response = self.request.recv(87654)
25 if response == b"":
26 self.request.close()
27 raise ConnectionAbortedError(f"{self.client_address[0]}:{self.client_address[1]} Client disconnects")
28 data_length, data = response.split(b"/", 1)
29 while int(data_length) > len(data):
30 data += self.request.recv(87654)
31
32 response = data.decode('UTF-8')
33 if len(response) > 10000:
34 self.debug(rf"<-<- {response[:100]}......")
35 else:
36 self.debug(rf"<-<- {response}")
37 return response
38
39 def StarLoadWait(self, data):
40 response = self._Send(data)
41 return response
42
43 def StartShowWait(self, Time: int, RotationTime: int, ThrowException: bool):
44 """
45 进行隐式等待和显示等待模式的切换
46 Switch between implicit waiting and display waiting modes.
47 """
48 self.debug(rf"---- Enter the display waiting mode waiting time:{Time}s")
49 self.Show_Waiting = copy.deepcopy(self.Implicit_Waiting)
50 self.Show_Waiting_Frequency = copy.deepcopy(self.Implicit_Waiting_Frequency)
51 self.Show_Waiting_Throwing = copy.deepcopy(self.Implicit_Waiting_Throwing)
52
53 self.Implicit_Waiting = Time
54 self.Implicit_Waiting_Frequency = RotationTime
55 self.Implicit_Waiting_Throwing = ThrowException
56
57 def EndShowWait(self):
58 """
59 进行隐式等待和显示等待模式的切换
60 Switch between implicit waiting and display waiting modes.
61 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected