FS-8293 [verto_communicator] Implemented speed test in verto communicator.

This commit is contained in:
Jaon EarlWolf 2015-10-30 18:51:26 -03:00 committed by Anthony Minessale
parent 24b0161cdf
commit 5c73724f50
5 changed files with 87 additions and 20 deletions

View File

@ -88,6 +88,8 @@
<select name="video_quality" id="video-quality" class="form-control"
ng-model="mydata.vidQual"
ng-options="item.id as item.label for item in verto.videoQuality"></select>
<a class="btn btn-primary" href="" ng-click="testSpeed()">Check Speed</a>
</div>
<input type="hidden" name="use_dedenc" ng-value="mydata.useDedenc" ng-model="mydata.useDedenc">

View File

@ -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';
@ -152,7 +176,8 @@
checkMediaPerm,
refreshMediaDevices,
provisionConfig,
checkLogin
checkLogin,
checkConnectionSpeed
];
var progress_message = [
@ -160,7 +185,8 @@
'Checking media permissions',
'Refresh Media Devices.',
'Provisioning configuration.',
'Checking login.'
'Checking login.',
'Check Connection Speed.'
];
var getProgressMessage = function(current_progress) {
@ -232,4 +258,3 @@
};
}]);

View File

@ -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');
}
}

View File

@ -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();

View File

@ -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.
*