Commit b45d2e58 authored by Florian Pausch's avatar Florian Pausch
Browse files

check if PC is connected to Internet

parent 4c6a25d0
...@@ -292,17 +292,27 @@ classdef itaOptitrack < handle ...@@ -292,17 +292,27 @@ classdef itaOptitrack < handle
% Check if NatNet dll's are existing % Check if NatNet dll's are existing
if ~exist(Optitrack_obj.dllPath,'dir') if ~exist(Optitrack_obj.dllPath,'dir')
% download NatNet version
url = 'http://s3.amazonaws.com/naturalpoint/software/NatNetSDK/NatNet_SDK_2.10.zip';
try
% check Internet connection
urljava = java.net.URL(url);
openStream(urljava);
catch
error('[itaOptitrack] No Internet connection. Missing NatNet SDK cannot be downloaded.')
end
% create directory % create directory
mkdir(Optitrack_obj.dllPath) mkdir(Optitrack_obj.dllPath)
fprintf( '[itaOptitrack] NatNet SDK not found. Installing.' ); fprintf( '[itaOptitrack] Cannot find NatNet SDK on computer. Downloading.' );
try try
% download NatNet version
url = 'http://s3.amazonaws.com/naturalpoint/software/NatNetSDK/NatNet_SDK_2.10.zip';
websave(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10.zip'),url); websave(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10.zip'),url);
catch catch
error(['[itaOptitrack] Download of NatNet SDK from ',url,' failed. Please update url in line 302.']) error(['[itaOptitrack] Download of NatNet SDK from ',url,' failed. Please update URL (l.297) and version (l.320, l.324).'])
end end
% unzip % unzip
...@@ -313,7 +323,7 @@ classdef itaOptitrack < handle ...@@ -313,7 +323,7 @@ classdef itaOptitrack < handle
fprintf('.\n') fprintf('.\n')
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10.zip')) delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10.zip'))
fprintf( '[itaOptitrack] NatNet SDK has been successfully installed.\n' ); fprintf( '[itaOptitrack] NatNet SDK has been successfully downloaded.\n' );
end end
...@@ -323,7 +333,7 @@ classdef itaOptitrack < handle ...@@ -323,7 +333,7 @@ classdef itaOptitrack < handle
Optitrack_obj.theClient = NatNetML.NatNetClientML(0); % Input = iConnectionType: 0 = Multicast, 1 = Unicast Optitrack_obj.theClient = NatNetML.NatNetClientML(0); % Input = iConnectionType: 0 = Multicast, 1 = Unicast
version = Optitrack_obj.theClient.NatNetVersion(); version = Optitrack_obj.theClient.NatNetVersion();
fprintf( '[itaOptitrack] Initialization succeeded.\n' ); fprintf( '[itaOptitrack] Initialization succeeded.\n' );
fprintf( '[itaOptitrack] NatNetML Client Version : %d.%d.%d.%d\n', version(1), version(2), version(3), version(4) ); fprintf( '[itaOptitrack] NatNetML Client Version: %d.%d.%d.%d\n', version(1), version(2), version(3), version(4) );
Optitrack_obj.isInitialized = true; Optitrack_obj.isInitialized = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment