mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-28 01:47:19 +01:00
..
This commit is contained in:
parent
013accc2aa
commit
17fbaea426
3 changed files with 2 additions and 101 deletions
|
|
@ -27,7 +27,6 @@ $juci.module("wifi")
|
|||
window.uci = $uci;
|
||||
$scope.interfaces = $uci.wireless['@wifi-iface'];
|
||||
$scope.status = $uci.wireless.status;
|
||||
$scope.easybox = $uci.easybox.settings;
|
||||
$scope.$apply();
|
||||
|
||||
next();
|
||||
|
|
|
|||
|
|
@ -8,46 +8,6 @@
|
|||
<luci-config-line title="{{'WPS Function'|translate}}"><switch id="enabled" name="enabled" ng-model="easybox.settings.wpsbutton.value" class="green"></switch></luci-config-line>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
<luci-config-section>
|
||||
<luci-config-lines ng-repeat="interface in wireless['@wifi-iface']">
|
||||
<luci-config-line title="{{'Enable WPS on '|translate}} {{interface.ssid.value}}">
|
||||
<switch id="enabled" name="enabled" ng-model="interface.wps_pbc.value" class="green" ></switch>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<h2 translate>WPS PBC</h2>
|
||||
<p translate>wifi.wps.pbc.info</p>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Pressing WiFi on/off button on EasyBox for long time activates pairing '|translate}}">
|
||||
<switch id="enabled" name="enabled" ng-model="easybox.settings.wifibutton.value" class="green" ></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Pair (within 2 minutes)'|translate}}">
|
||||
<button class="btn btn-default" ng-click="onPairPBC()" translate>Pair</button>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<h2 translate>WPS with own PIN</h2>
|
||||
<p translate>wifi.wps.pin.info</p>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'WPS Using Generated PIN '|translate}}">
|
||||
<switch id="enabled" name="enabled" ng-model="easybox.settings.wpsdevicepin.value" ng-change="save" class="green"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Generated PIN'|translate}}">
|
||||
<input type="text" class="form-control" ng-model="generatedPIN" />
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Generate New PIN'|translate}}">
|
||||
<button class="btn btn-default" ng-click="onGeneratePIN()" translate>Generate</button>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<h2 translate>WPS with foreign PIN</h2>
|
||||
<p translate>wifi.wps.otherpin.info</p>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Enter your device PIN'|translate}}">
|
||||
<input type="text" class="form-control" ng-model="data.userPIN" />
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Pair (within 2 minutes)'|translate}}">
|
||||
<button class="btn btn-default" ng-click="onPairUserPIN()" translate>Pair</button>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
</luci-config>
|
||||
<modal title="{{'Attempting to Pair'|translate}}" ng-show="showProgress">
|
||||
<div ng-show="pairState == 'progress'" >
|
||||
|
|
|
|||
|
|
@ -1,68 +1,10 @@
|
|||
$juci.module("wifi")
|
||||
.controller("WifiWPSPageCtrl", function($scope, $uci){
|
||||
$scope.data = {
|
||||
userPIN: ""
|
||||
}
|
||||
$uci.sync(["easybox", "wireless"]).done(function(){
|
||||
$uci.sync(["easybox"]).done(function(){
|
||||
$scope.easybox = $uci.easybox;
|
||||
$scope.wireless = $uci.wireless;
|
||||
$scope.$apply();
|
||||
}).fail(function(err){
|
||||
console.log("failed to sync config: "+err);
|
||||
});
|
||||
$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;
|
||||
});
|
||||
});
|
||||
}
|
||||
$scope.save = function(){
|
||||
$uci.save();
|
||||
}
|
||||
$scope.onPairPBC = function(){
|
||||
|
||||
pair();
|
||||
}
|
||||
$scope.onPairUserPIN = function(){
|
||||
$rpc.wps.stapin({ pin: $scope.data.userPIN }).done(function(data){
|
||||
pair();
|
||||
});
|
||||
}
|
||||
$scope.onGeneratePIN = function(){
|
||||
$rpc.wps.genpin().done(function(data){
|
||||
$rpc.wps.setpin({pin: data.pin}).done(function(){
|
||||
$scope.generatedPIN = data.pin;
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue