add (working) dirk.pl + other bits
[dweather.git] / DWeather / lib / DWeather / Station / Vantage.pm
index 5f3749ee2b3c31d7f4ffd0df862c0240f9eacd41..a8b91cfe4b9e5512cdfc6f26f44c5c6972565fd2 100644 (file)
@@ -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;