forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syncer.m
43 lines (41 loc) · 1.7 KB
/
syncer.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% Wraps librealsense2 syncer class
classdef syncer < handle
properties (SetAccess = private, Hidden = true)
objectHandle;
end
methods
% Constructor
function this = syncer(queue_size)
if nargin == 0
this.objectHandle = realsense.librealsense_mex('rs2::syncer', 'new');
else
validateattributes(queue_size, {'numeric'}, {'scalar', 'positive', 'real', 'integer'});
this.objectHandle = realsense.librealsense_mex('rs2::syncer', 'new', uint64(queue_size));
end
end
% Destructor
function delete(this)
if (this.objectHandle ~= 0)
realsense.librealsense_mex('rs2::syncer', 'delete', this.objectHandle);
end
end
% Functions
function frames = wait_for_frames(this, timeout_ms)
narginchk(1, 2);
if nargin == 1
out = realsense.librealsense_mex('rs2::syncer', 'wait_for_frames', this.objectHandle);
else
if isduration(timeout_ms)
timeout_ms = milliseconds(timeout_ms);
end
validateattributes(timeout_ms, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'timeout_ms', 2);
out = realsense.librealsense_mex('rs2::syncer', 'wait_for_frames', this.objectHandle, double(timeout_ms));
end
frames = realsense.frameset(out);
end
function [res, frames] = poll_for_frames(this)
res, out = realsense.librealsense_mex('rs2::syncer', 'poll_for_frames', this.objectHandle);
frames = realsense.frameset(out);
end
end
end