Subversion Repositories HomeAutomation

Rev

Rev 1885 | Rev 1892 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1885 Rev 1890
Line 56... Line 56...
56
{
56
{
57
    ($socket) = @_;
57
    ($socket) = @_;
58
 
58
 
59
    $s = IO::Select->new();
59
    $s = IO::Select->new();
60
    $s->add($socket);
60
    $s->add($socket);
61
    @handles = $s->can_read(0.01);
61
    @handles = $s->can_read(0.001);
62
 
62
 
63
    $has_data = 0;
63
    $has_data = 0;
64
    if (@handles)
64
    if (@handles)
65
    {
65
    {
66
        $has_data = 1;
66
        $has_data = 1;
67
    }
67
    }
68
   
68
   
69
    return $has_data;
69
    return $has_data;
70
}
70
}
71
 
71
 
-
 
72
sub atomd_kill_promt
-
 
73
{
-
 
74
    ($socket) = @_;
-
 
75
 
-
 
76
    while (atomd_data_available($socket))
-
 
77
    {
-
 
78
        $packet = atomd_read_packet($socket); # Read prompt
-
 
79
    }
-
 
80
}
72
 
81
 
73
sub atomd_initialize
82
sub atomd_initialize
74
{
83
{
75
    ($host, $port) = @_;
84
    ($host, $port) = @_;
76
    $socket = atomd_connect($host, $port);
85
    $socket = atomd_connect($host, $port);
77
   
86
   
78
    while (atomd_data_available($socket))
87
    atomd_kill_promt($socket);
79
    {
-
 
80
        $packet = atomd_read_packet($socket); # Read initial prompt
-
 
81
    }
-
 
82
   
88
   
83
    return $socket;
89
    return $socket;
84
}
90
}
85
 
91
 
86
 
92