forked from rowoflo/Matlab_TrackablePackage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate.m
66 lines (59 loc) · 1.25 KB
/
validate.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function validServer = validate(name,host,port)
% The "validate" function is used to validate the server information and
% that it is producing data.
%
% SYNTAX:
% validServer = validate(name,host,port)
%
% INPUTS:
% name - (string)
% Trackable name name.
%
% host - (string)
% Server computer host name.
%
% port - (string) ['3883']
% Server port number.
%
% OUTPUTS:
% validServer - (1 x 1 logical)
% True if the server is valid and producing data.
%
% EXAMPLES:
% trackable.validate('optitrackSudoServer','localhost','50555')
%
% NOTES:
%
% NECESSARY FILES:
% trackable.getTrackableData
%
% SEE ALSO: TODO: Add see alsos
% relatedFunction1 | relatedFunction2
%
% AUTHOR:
% Rowland O'Flaherty (www.rowlandoflaherty.com)
%
% VERSION:
% Created 27-OCT-2012
%-------------------------------------------------------------------------------
%% Check Inputs
if nargin < 3; port = '3883'; end;
validServer = false;
% Check input arguments for errors
if ~(~isempty(name) && ischar(name))
return
end
if ~(~isempty(host) && ischar(host))
return
end
if ~(~isempty(port) && ischar(port))
return
end
%% Validate
try
trackable.getTrackableData(name, host, port);
catch %#ok<CTCH>
return
end
validServer = true;
end