view service/laundry/static/gui.js @ 96:27a685ce2e5d

more laundry web support Ignore-this: c7313465fbd93fa902b909f9128c2ad
author drewp@bigasterisk.com
date Sat, 31 Aug 2013 10:33:50 -0700
parents 5907eeb9a630
children 3c583603f261
line wrap: on
line source

'use strict';

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