9 import pybackend2
as rs
13 print (
"Received %d bytes" % f.frame_size)
17 print (
"First 10 bytes are: ")
24 backend = rs.create_backend()
25 infos = backend.query_uvc_devices()
26 print(
"There are %d connected UVC devices" % len(infos))
27 if len(infos)
is 0:
exit(1)
29 dev = backend.create_uvc_device(info)
31 print (
"VID=%d, PID=%d, MI=%d, UID=%s" % (info.vid, info.pid, info.mi, info.unique_id))
34 print (
"Move device to D0 power state...")
35 dev.set_power_state(rs.D0)
38 print (
"Print list of UVC profiles supported by the device...")
39 profiles = dev.get_profiles()
43 if p.width == 640
and p.height == 480
and p.fps == 30
and p.format == 1196574041:
47 print (
"Negotiate Probe-Commit for first profile")
48 dev.probe_and_commit(first, on_frame)
51 xu = rs.extension_unit(0, 3, 2, rs.guid(
"C9606CCB-594C-4D25-af47-ccc496435995"))
53 ae = dev.get_xu(xu, 0xB, 1)
54 print (
"Auto Exposure option is:", ae)
55 print (
"Setting Auto Exposure option to new value")
56 dev.set_xu(xu, 0x0B, [0x00])
57 ae = dev.get_xu(xu, 0xB, 1)
58 print (
"New Auto Exposure setting is:", ae)
61 gain = dev.get_pu(rs.option.gain)
62 print (
"Gain = %d" % gain)
63 print (
"Setting gain to new value")
64 dev.set_pu(rs.option.gain, 32)
65 gain = dev.get_pu(rs.option.gain)
66 print (
"New gain = %d" % gain)
69 print (
"Start listening for callbacks (for all pins)...")
72 print (
"Start streaming (from all pins)...")
75 print (
"Wait for 5 seconds while frames are expected:")
79 print (
"Stop listening for new callbacks...")
82 print (
"Close the specific pin...")
86 def save_frame(profile, f):
87 f.save_png(
"pybackend_example_1_general_depth_frame.png", 640, 480, f.frame_size / (640*480))
89 print (
"Saving an IR VGA frame using profile:", vga)
90 dev.probe_and_commit(vga, save_frame)
92 dev.set_xu(xu, 0x0B, [0x01])
98 print (
"Move device to D3")
99 dev.set_power_state(rs.D3)
101 except Exception
as e:
static std::string print(const transformation &tf)
static const textual_icon exit