from hobot_vio import libsrcampy
import time

W = 1920
H = 1080
FPS = 30

cam0 = libsrcampy.Camera()
cam1 = libsrcampy.Camera()

print("open cam0: pipe0 host0")
ret0 = cam0.open_cam(0, 0, FPS, W, H)
print("cam0 ret =", ret0)

print("open cam1: pipe1 host1")
ret1 = cam1.open_cam(0, 1, FPS, W, H)
print("cam1 ret =", ret1)

time.sleep(5)

if ret1 == 0:
    img1 = cam1.get_img(2)
    print("cam1 img is None ?", img1 is None)

if ret0 == 0:
    img0 = cam0.get_img(2)
    print("cam0 img is None ?", img0 is None)

time.sleep(5)

if ret1 == 0:
    cam1.close_cam()
if ret0 == 0:
    cam0.close_cam()
