view service/laundry/static/gui.js @ 108:64ad5ad17dc1

fix angular api Ignore-this: b3a3275dec9c6df4770533ab5b865c17
author drewp@bigasterisk.com
date Sun, 01 Sep 2013 00:46:04 -0700
parents 3c583603f261
children
line wrap: on
line source

'use strict';


function Ctrl($scope, $http, $timeout) {
    $scope.refresh = function () {
        $http.get("status").success(function (data) {
            $scope.status = data;
        });
    }
    $scope.refresh();
    $scope.setLed = function (value) {
        $http.put("led", value).success(function () {
            $scope.refresh();
        });
    };
    $scope.temporaryUnlock = function () {
        var seconds = 3;
        $http.put("strike/temporaryUnlock", {seconds: seconds}).success(function () {
            $scope.refresh();
            $timeout($scope.refresh, (seconds + .1) * 1000);
        });
    };
    $scope.beep = function () {
        $http.put("speaker/beep").success(function () {
            $scope.speakerStatus = "sent at " + new Date();
        });
    }
}