X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=DWeather%2Flib%2FDWeather%2FStation%2FVantage.pm;fp=DWeather%2Flib%2FDWeather%2FStation%2FVantage.pm;h=a8b91cfe4b9e5512cdfc6f26f44c5c6972565fd2;hb=4f77e5fc357ae3bce202fe32fe4a5333aa1ee446;hp=5f3749ee2b3c31d7f4ffd0df862c0240f9eacd41;hpb=631bc0f2b224c9ebfd1dd5827814e5aba3e6d023;p=dweather.git diff --git a/DWeather/lib/DWeather/Station/Vantage.pm b/DWeather/lib/DWeather/Station/Vantage.pm index 5f3749e..a8b91cf 100644 --- a/DWeather/lib/DWeather/Station/Vantage.pm +++ b/DWeather/lib/DWeather/Station/Vantage.pm @@ -18,18 +18,43 @@ sub new my $class = ref $pkg || $pkg; my $device = shift; - my $d = $class->SUPER::new($device, 19200); - return $d; + my $self = $class->SUPER::new($device, 19200); + $self->on_read(sub{$d->process}); + return $self; } -sub reset +sub process { - + my $self = shift; + my $data = $self->{rbuf}; + $self->{rbuf} = ''; + + if (isdbg('raw')) { + dbg("I $self->{device} lth " . length $data); + dbgdump(data); + } elsif (isdbg('chan')) { + dbg("I $self->{device}: $data"); + } + foreach my $ch (@ch) { + + } } -sub poll +sub send { - + my $self= shift; + my $data = shift; + if (isdbg('raw')) { + dbg("O $self->{device} lth " . length $data); + dbgdump(data); + } elsif (isdbg('chan')) { + dbg("O $self->{device}: $data"); + } + $self->push_write($data) } +sub reset +{ + +} 1;