view service/laundry/static/gui.js @ 162:bb70eaa45666

whitespace Ignore-this: 29ddf8925c373bdb1ec8f62a01f0ac4f
author drewp@bigasterisk.com
date Sun, 22 Mar 2015 00:41:55 -0700
parents 64ad5ad17dc1
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();
        });
    }
}