Skip to content

Commit a53a3d2

Browse files
committed
update dev and add driver generate
update dev and add driver generate
1 parent 2f89e8e commit a53a3d2

File tree

5 files changed

+41
-33
lines changed

5 files changed

+41
-33
lines changed

.idea/workspace.xml

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from je_auto_control import start_autocontrol_socket_server
2+
3+
if "__main__" == __name__:
4+
server = start_autocontrol_socket_server()
5+
while not server.close_flag:
6+
pass

dev_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="je_auto_control_dev",
8-
version="0.0.35",
8+
version="0.0.36",
99
author="JE-Chen",
1010
author_email="zenmailman@gmail.com",
1111
description="auto testing",

je_auto_control/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@
7474
# file process
7575
from je_auto_control.utils.file_process.get_dir_file_list import get_dir_files_as_list
7676
from je_auto_control.utils.file_process.create_project_structure import create_template_dir
77+
# socket server
78+
from je_auto_control.utils.socket_server.AutoControlSocketServer import start_autocontrol_socket_server

je_auto_control/utils/socket_server/AutoControlSocketServer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ class TCPServerHandler(socketserver.BaseRequestHandler):
99

1010
def handle(self):
1111
command_string = str(self.request.recv(8192).strip(), encoding="utf-8")
12-
print(command_string)
12+
print("command is: " + command_string)
1313
if command_string == "quit_server":
1414
self.server.shutdown()
15+
self.server.close_flag = True
16+
print("Now quit server")
1517
else:
1618
try:
1719
execute_str = json.loads(command_string)
@@ -21,7 +23,10 @@ def handle(self):
2123

2224

2325
class TCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
24-
pass
26+
27+
def __init__(self, server_address, RequestHandlerClass):
28+
super().__init__(server_address, RequestHandlerClass)
29+
self.close_flag: bool = False
2530

2631

2732
def start_autocontrol_socket_server(host: str = "localhost", port: int = 9938):
@@ -31,8 +36,3 @@ def start_autocontrol_socket_server(host: str = "localhost", port: int = 9938):
3136
server_thread.start()
3237
return server
3338

34-
35-
if "__main__" == __name__:
36-
start_autocontrol_socket_server()
37-
while True:
38-
pass

0 commit comments

Comments
 (0)