-
Notifications
You must be signed in to change notification settings - Fork 2
/
WaitForPTPLock.m
40 lines (22 loc) · 1.03 KB
/
WaitForPTPLock.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
function WaitForPTPLock(ip,DefaultTimeout)
% Bruel & Kjaer LAN-XI Open Application Programming Interface
% MATLAB Simple Recorder GUI Version 1.0 (September 15, 2021)
% By Matthew Houtteman and Gert Nyrup
% +1 800-332-2040
% TechnicalSalesSupport.US@hbkworld.com
% Developed in MATLAB R2021a with LAN-XI Firmware 2.10.0.501
% This function runs a while loop until the REST GET command
% /rest/rec/onchange returns a ptpStatus of "Locked"
RecorderStatus = GetRecorderStatus(ip,DefaultTimeout);
if isempty(fieldnames(RecorderStatus)) % Keep issuing GET command until we get a proper result
while isempty(fieldnames(RecorderStatus))
RecorderStatus = GetRecorderStatus(ip,DefaultTimeout);
end
end
while RecorderStatus.ptpStatus ~= "Locked"
RecorderStatus = GetRecorderStatus(ip,DefaultTimeout);
while isempty(fieldnames(RecorderStatus)) % Keep issuing GET command until we get a proper result
RecorderStatus = GetRecorderStatus(ip,DefaultTimeout);
end
end
end