diff --git a/html5/verto/verto_communicator/src/partials/modal_settings.html b/html5/verto/verto_communicator/src/partials/modal_settings.html index b6bc9cec05..42c91b4cf9 100644 --- a/html5/verto/verto_communicator/src/partials/modal_settings.html +++ b/html5/verto/verto_communicator/src/partials/modal_settings.html @@ -88,6 +88,8 @@ + + Check Speed diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index da7a156f63..d9be180147 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -4,7 +4,7 @@ .module('storageService') .service('splashscreen', ['$rootScope', '$q', 'storage', 'config', 'verto', function($rootScope, $q, storage, config, verto) { - + var checkBrowser = function() { return $q(function(resolve, reject) { var activity = 'browser-upgrade'; @@ -22,10 +22,10 @@ if (!navigator.getUserMedia) { result['status'] = 'error'; result['message'] = 'Error: browser doesn\'t support WebRTC.'; - reject(result); + reject(result); } - resolve(result); + resolve(result); }); }; @@ -48,7 +48,7 @@ reject(result); } verto.data.mediaPerm = true; - resolve(result); + resolve(result); }); }); }; @@ -62,7 +62,7 @@ 'activity': activity, 'message': 'Refresh Media Devices.' }; - + verto.refreshDevices(function(status) { verto.refreshDevicesCallback(function() { resolve(result); @@ -72,6 +72,30 @@ }); }; + var checkConnectionSpeed = function() { + return $q(function(resolve, reject) { + var activity = 'check-connection-speed'; + var result = { + 'status': 'success', + 'soft': true, + 'activity': activity, + 'message': 'Check Connection Speed.' + }; + + if(!verto.instance) { + resolve(result); + return; + } + + verto.testSpeed(cb); + + function cb(data) { + + resolve(result); + } + }); + }; + var provisionConfig = function() { return $q(function(resolve, reject) { var activity = 'provision-config'; @@ -100,7 +124,7 @@ }); result['promise'] = configPromise; - + resolve(result); }); }; @@ -136,13 +160,13 @@ verto.data.connecting = false; resolve(result); }); - }; + }; }; if(storage.data.ui_connected && storage.data.ws_connected) { - checkUserStored(); + checkUserStored(); } else { - resolve(result); + resolve(result); }; }); }; @@ -152,7 +176,8 @@ checkMediaPerm, refreshMediaDevices, provisionConfig, - checkLogin + checkLogin, + checkConnectionSpeed ]; var progress_message = [ @@ -160,12 +185,13 @@ 'Checking media permissions', 'Refresh Media Devices.', 'Provisioning configuration.', - 'Checking login.' + 'Checking login.', + 'Check Connection Speed.' ]; - + var getProgressMessage = function(current_progress) { if(progress_message[current_progress] != undefined) { - return progress_message[current_progress]; + return progress_message[current_progress]; } else { return 'Please wait...'; } @@ -176,7 +202,7 @@ var calculateProgress = function(index) { var _progress; - + _progress = index + 1; progress_percentage = (_progress / progress.length) * 100; return progress_percentage; @@ -186,12 +212,12 @@ var fn, fn_return, status, interrupt, activity, soft, message, promise; interrupt = false; current_progress++; - + if(current_progress >= progress.length) { $rootScope.$emit('progress.complete', current_progress); return; } - + fn = progress[current_progress]; fn_return = fn(); @@ -221,7 +247,7 @@ emitNextProgress(fn_return); } ); - + }; return { @@ -232,4 +258,3 @@ }; }]); - diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 7bd5cb6819..4a00c021c0 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -52,10 +52,11 @@ storage.data.email = verto.data.email; storage.data.login = verto.data.login; storage.data.password = verto.data.password; + verto.testSpeed(); + if (redirect && storage.data.preview) { $location.path('/preview'); - } - else if (redirect) { + } else if (redirect) { $location.path('/dialpad'); } } diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js index 2b70948bbe..eb2cdc8c8f 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js @@ -26,6 +26,21 @@ return verto.refreshDevices(); }; + $scope.rangeBandwidth = function(bandwidth) { + for(var i = 0; i < verto.videoQuality.length; i++) { + + } + }; + + $scope.testSpeed = function() { + return verto.testSpeed(cb); + + function cb(data) { + + $scope.$apply(); + } + }; + $scope.resetSettings = function() { if (confirm('Factory Reset Settings?')) { storage.factoryReset(); diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 6f0366740b..62678396e2 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -797,6 +797,30 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora } }, + /** + * Do speed test. + * + * @param callback + */ + testSpeed: function(cb) { + + data.instance.rpcClient.speedTest(1024 * 256, function(e, data) { + var outBand = Math.ceil(data.upKPS * .75), + inBand = Math.ceil(data.downKPS * .75); + + storage.data.vidQual = 'hd'; + + if (outBand < 1024) { + storage.data.vidQual = 'vga'; + } + if (outBand < 512) { + storage.data.vidQual = 'qvga'; + } + + if(cb) cb(data); + // console.info("Up: " + data.upKPS, "Down: ", data.downKPS); + }); + }, /** * Mute the microphone for the current call. *