diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js b/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js index c9e1ab0c8..2506d75c0 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js @@ -27,6 +27,7 @@ $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(); diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html index 6b0aed006..dd9a1afb2 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html @@ -8,6 +8,46 @@ + + + + + + +

WPS PBC

+

wifi.wps.pbc.info

+ + + + + + + + +

WPS with own PIN

+

wifi.wps.pin.info

+ + + + + + + + + + + +

WPS with foreign PIN

+

wifi.wps.otherpin.info

+ + + + + + + + +
diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js index 5a3f727f7..ff99692da 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js @@ -1,10 +1,68 @@ $juci.module("wifi") .controller("WifiWPSPageCtrl", function($scope, $uci){ - $uci.sync(["easybox"]).done(function(){ + $scope.data = { + userPIN: "" + } + $uci.sync(["easybox", "wireless"]).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(); + }); + }); + } });