1 Star 0 Fork 1

Mr_老冷/mier_sdk

forked from 弥尔/mier_sdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
connect_manager.py 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
弥尔 提交于 2022-12-02 05:36 . SDK第一次提交
import time
import tidevice
from PyQt5.QtCore import QThread, pyqtSignal
from mier_sdk.work_func import get_uuids
class Connect_Manager(QThread):
'''
xinhaocao
'''
my_signal_device_ios = pyqtSignal(list)
erro_connect = pyqtSignal(list)
def __init__(self,ui):
super().__init__()
self.ui = ui
self.q = self.ui.q
def run(self) -> None:
while 1 :
try:
list_ios = get_uuids()
for ios_device in list_ios:
if ios_device not in self.ui.devices_ios:
try:
#添加设备
print('添加设备')
out = tidevice.Device(ios_device).device_info()
name = out['DeviceName']
self.ui.devices_ios.add(ios_device)
self.my_signal_device_ios.emit([ios_device,name])
except Exception as e:
self.erro_connect.emit([ios_device,3,'连接报错:重启手机或者插紧数据线后重试'])
print('连接iOS设备报错:', e)
time.sleep(0.3)
for udid in self.q.keys():
if not self.q[udid].empty() :
value = self.q[udid].get(True)
if len(value) > 0 :
self.erro_connect.emit(value)
except Exception as e:
print('连接iOS设备报错:', e)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mr_laoleng_admin/mier_codes.git
git@gitee.com:mr_laoleng_admin/mier_codes.git
mr_laoleng_admin
mier_codes
mier_sdk
master

搜索帮助