Rev 2057 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 2057 | Rev 2058 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | <?php |
1 | <?php |
| 2 | $aliasesDimmer = array("bardisk_tv", "TakSovrum"); |
2 | $aliasesDimmer = array("bardisk_tv", "TakSovrum"); |
| 3 | $aliasesOther = array("Power", "PowerBRF"); |
3 | $aliasesOther = array("Power", "PowerBRF", "PID"); |
| 4 | 4 | ||
| 5 | require 'atom_interface.php'; |
5 | require 'atom_interface.php'; |
| 6 | require 'getSetData.php'; |
6 | require 'getSetData.php'; |
| 7 | 7 | ||
| 8 | $response = array(); |
8 | $response = array(); |
| Line 13... | Line 13... | ||
| 13 | { |
13 | { |
| 14 | $_GET["strength"] = 0; |
14 | $_GET["strength"] = 0; |
| 15 | } |
15 | } |
| 16 | 16 | ||
| 17 | SetDimmerValue($_GET["alias"], $_GET["strength"]); |
17 | SetDimmerValue($_GET["alias"], $_GET["strength"]); |
| 18 | - | ||
| 19 | echo json_encode($response); |
- | |
| 20 | exit(0); |
- | |
| 21 | } |
- | |
| 22 | else if (isset($_GET["getvalue"])) |
- | |
| 23 | { |
- | |
| 24 | foreach ($_GET["alias"] as $alias) |
- | |
| 25 | { |
- | |
| 26 | $response[$alias] = GetLastValue($alias); |
- | |
| 27 | } |
- | |
| 28 | 18 | ||
| 29 | echo json_encode($response); |
19 | echo json_encode($response); |
| 30 | exit(0); |
20 | exit(0); |
| 31 | } |
21 | } |
| 32 | else if (isset($_GET["getdata"])) |
22 | else if (isset($_GET["getdata"])) |
| Line 92... | Line 82... | ||
| 92 | var timer = null; |
82 | var timer = null; |
| 93 | 83 | ||
| 94 | function checkCurrentValue() |
84 | function checkCurrentValue() |
| 95 | { |
85 | { |
| 96 | updating_current = true; |
86 | updating_current = true; |
| 97 | jQuery.getJSON("? |
87 | jQuery.getJSON("?getdata=1", "<? echo "alias[]=" . implode("&alias[]=", $aliasesDimmer)?>", function(data) |
| 98 | { |
88 | { |
| 99 | 89 | ||
| 100 | 90 | ||
| 101 | jQuery.each(data, function(alias, value) |
91 | jQuery.each(data, function(alias, value) |
| 102 | { |
92 | { |
| 103 | current_value[alias] = value; |
93 | current_value[alias] = value.Level.value; |
| 104 | $('#slider' + alias).val(value).slider("refresh"); |
94 | $('#slider' + alias).val(value.Level.value).slider("refresh"); |
| 105 | }); |
95 | }); |
| 106 | 96 | ||
| 107 | updating_current = false; |
97 | updating_current = false; |
| 108 | }); |
98 | }); |
| 109 | jQuery.getJSON("?getdata=1", "<? echo "alias[]=" . implode("&alias[]=", $aliasesOther)?>", function(data) |
99 | jQuery.getJSON("?getdata=1", "<? echo "alias[]=" . implode("&alias[]=", $aliasesOther)?>", function(data) |
| Line 118... | Line 108... | ||
| 118 | { |
108 | { |
| 119 | text += "<b>" + alias + "</b><br/>"; |
109 | text += "<b>" + alias + "</b><br/>"; |
| 120 | 110 | ||
| 121 | jQuery.each(aliasData, function(name, value) |
111 | jQuery.each(aliasData, function(name, value) |
| 122 | { |
112 | { |
| - | 113 | if (typeof value.value == "string") |
|
| - | 114 | { |
|
| 123 |
|
115 | text += name + "=" + value.value + "<br/>"; |
| - | 116 | } |
|
| - | 117 | else |
|
| - | 118 | { |
|
| - | 119 | text += name + "<br/>"; |
|
| - | 120 | jQuery.each(value.value, function(name2, value2) |
|
| - | 121 | { |
|
| - | 122 | text += " " + name2 + "=" + value2 + "<br/>"; |
|
| - | 123 | }); |
|
| - | 124 | } |
|
| 124 | }); |
125 | }); |
| 125 | 126 | ||
| 126 | text += "<br/>"; |
127 | text += "<br/>"; |
| 127 | }); |
128 | }); |
| 128 | 129 | ||