#!/usr/bin/python
# -*- coding: GBK -*-
import os
import time
import datetime
import uiautomator2 as u2
import subprocess
from threading import Timer
import numpy as np
from PIL import ImageGrab
pi = subprocess.Popen("adb devices", shell=True, stdout=subprocess.PIPE)
devicesId = str(pi.stdout.read())[30:38]
d = u2.connect_usb(devicesId)
engineering_camera_waitTime = 1
screenshot_waitTime = 3
Power_waitTime = 6
bat_path = "bat" + os.sep
def is_awake():
d.screen_on()
time.sleep(1)
d.swipe_points([(0.497, 0.885), (0.515, 0.191)], 0.01) # 滑动解锁界面
print("解锁成功")
def kill_command(p):
"""终止命令的函数"""
p.kill()
print("终止命令的函数进程")
def execute(command, timeout):
# 执行shell命令
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# 设置定时器去终止这个命令
timer = Timer(timeout, kill_command, [p])
try:
tim
|