Subversion Repositories HomeAutomation

Rev

Rev 2054 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2054 Rev 2058
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
3
function GetLastValue($alias2)
-
 
4
{
-
 
5
  $level2 = 0;
-
 
6
  $buffer = "";
-
 
7
 
-
 
8
  try
-
 
9
  {
-
 
10
    $socket = atomd_initialize("127.0.0.1", 1202);
-
 
11
 
-
 
12
    atomd_send_command($socket, "Module_GetLastValue $alias2");
-
 
13
   
-
 
14
    $buffer = atomd_read_command_response($socket);
-
 
15
  }
-
 
16
  catch (Exception $e)
-
 
17
  {
-
 
18
    die($e);
-
 
19
  }
-
 
20
 
-
 
21
  $output = explode("\n", $buffer);
-
 
22
 
-
 
23
  foreach ($output as $line)
-
 
24
  {
-
 
25
    if (strpos($line, "Level: ") !== FALSE)
-
 
26
    {
-
 
27
      list($dummy1, $level2) = explode(" ", $line);
-
 
28
     
-
 
29
      $start = strpos($level2, "m") + 1;
-
 
30
     
-
 
31
      $level2 = substr($level2, $start, strpos($level2, "[", $start) - $start);
-
 
32
    }
-
 
33
  }
-
 
34
 
-
 
35
  return intval($level2);
-
 
36
}
-
 
37
 
2
 
38
 
3
 
39
function GetLastData($alias2)
4
function GetLastData($alias2)
40
{
5
{
41
  $level2 = 0;
6
  $level2 = 0;