mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Confirmed wps working with stapin and pbc
This commit is contained in:
parent
4501e9f09b
commit
c6f986063f
2 changed files with 34 additions and 35 deletions
|
|
@ -19,6 +19,9 @@
|
|||
<h2 translate>WPS-PBC: Push Button on Device</h2>
|
||||
<p translate>wifi.wps.pbc.info</p>
|
||||
<luci-config-lines>
|
||||
<luci-config-line ng-show="boardpanel" title="{{'Enable WPS button on router'|translate}}">
|
||||
<switch id="enabled" name="enabled" ng-model="boardpanel.settings.wpsbutton.value" class="green" ng-change="save()" ></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line ng-show="boardpanel" title="{{'Pressing WiFi on/off button on your router for long time activates pairing '|translate}}">
|
||||
<switch id="enabled" name="enabled" ng-model="boardpanel.settings.wifibutton.value" class="green" ng-change="save()" ></switch>
|
||||
</luci-config-line>
|
||||
|
|
|
|||
|
|
@ -22,49 +22,45 @@ $juci.module("wifi")
|
|||
$rpc.wps.showpin().done(function(data){
|
||||
$scope.generatedPIN = data.pin;
|
||||
});
|
||||
function pair(){
|
||||
$scope.showProgress = 1;
|
||||
$scope.pairState = 'progress';
|
||||
$scope.timeRemaining = 60;
|
||||
$uci.save().done(function(){
|
||||
var interval = setInterval(function(){
|
||||
$scope.timeRemaining --;
|
||||
if($scope.timeRemaining == 0){
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 1000);
|
||||
$rpc.wps.pbc().done(function(){
|
||||
clearInterval(interval);
|
||||
$scope.pairState = 'success';
|
||||
$scope.$apply();
|
||||
setTimeout(function(){
|
||||
$scope.showProgress = 0;
|
||||
$scope.$apply();
|
||||
}, 2000);
|
||||
}).fail(function(){
|
||||
clearInterval(interval);
|
||||
$scope.pairState = 'fail';
|
||||
$scope.$apply();
|
||||
setTimeout(function(){
|
||||
$scope.showProgress = 0;
|
||||
$scope.$apply();
|
||||
}, 2000);
|
||||
}).always(function(){
|
||||
$scope.showProgress = 0;
|
||||
});
|
||||
});
|
||||
function wpsSuccess(){
|
||||
$scope.pairState = 'success';
|
||||
$scope.$apply();
|
||||
setTimeout(function(){
|
||||
$scope.showProgress = 0;
|
||||
$scope.$apply();
|
||||
}, 2000);
|
||||
}
|
||||
function wpsFail(){
|
||||
$scope.pairState = 'fail';
|
||||
$scope.$apply();
|
||||
setTimeout(function(){
|
||||
$scope.showProgress = 0;
|
||||
$scope.$apply();
|
||||
}, 2000);
|
||||
}
|
||||
$scope.save = function(){
|
||||
$uci.save();
|
||||
}
|
||||
$scope.onPairPBC = function(){
|
||||
|
||||
pair();
|
||||
$scope.showProgress = 1;
|
||||
$scope.pairState = 'progress';
|
||||
$rpc.wps.pbc().done(function(){
|
||||
wpsSuccess();
|
||||
}).fail(function(){
|
||||
wpsFail();
|
||||
});
|
||||
}
|
||||
$scope.onPairUserPIN = function(){
|
||||
$scope.showProgress = 1;
|
||||
$scope.pairState = 'progress';
|
||||
$rpc.wps.stapin({ pin: $scope.data.userPIN }).done(function(data){
|
||||
pair();
|
||||
});
|
||||
wpsSuccess();
|
||||
}).fail(function(){
|
||||
wpsFail();
|
||||
}).always(function(){
|
||||
$scope.data.userPIN = "";
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
$scope.onGeneratePIN = function(){
|
||||
$rpc.wps.genpin().done(function(data){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue