899
|
1 'use strict';
|
|
2
|
|
3 function Ctrl($scope, $http) {
|
900
|
4 function refresh() {
|
|
5 $http.get("status").success(function (data) {
|
|
6 $scope.status = data;
|
|
7 });
|
|
8 }
|
|
9 refresh();
|
|
10 $scope.setLed = function (value) {
|
|
11 $http.put("led", value).succeed(function () {
|
|
12 refresh();
|
|
13 });
|
901
|
14 };
|
|
15 $scope.temporaryUnlock = function () {
|
|
16 var seconds = 3;
|
|
17 $http.put("strike/temporaryUnlock", {seconds: seconds}).succeed(function () {
|
|
18 refresh();
|
|
19 setTimeout(function () { refresh(); }, (seconds + .1) * 1000);
|
|
20 });
|
|
21 };
|
|
22 $scope.beep = function () {
|
|
23 $http.put("speaker/beep").succeed(function () {
|
|
24 $scope.speakerStatus = "sent at " + new Date();
|
|
25 });
|
900
|
26 }
|
899
|
27 }
|