airtest.core.ios.mjpeg_cap module

class SocketBuffer(sock: socket)[source]

Bases: SafeSocket

read_until(delimeter: bytes) bytes[source]

return without delimeter

read_bytes(length: int) bytes[source]
write(data: bytes)[source]
class MJpegcap(instruct_helper=None, ip='localhost', port=None, ori_function=None)[source]

Bases: object

setup_stream_server()[source]
init_sock()[source]
get_frame_from_stream()[source]
get_frame()[source]
snapshot(ensure_orientation=True, *args, **kwargs)[source]

Take a screenshot and convert it into a cv2 image object

获取一张屏幕截图,并转化成cv2的图像对象 !!! 注意,该方法拿到的截图可能不是队列中最新的,除非一直在消费队列中的图像,否则可能会是过往图像内容,请谨慎使用

Parameters:

ensure_orientation – True or False whether to keep the orientation same as display

Returns: numpy.ndarray

get_blank_screen()[source]

生成一个黑屏图像,在连接失效时代替屏幕画面返回 Returns:

teardown_stream()[source]