#
# Vantage Pro 2 interface for DWeather
#
#

package DWeather::Station::Vantage;

use strict;
use warnings;

use base qw(DWeather::Station);
use DWeather::Debug;
use AnyEvent;

sub new
{
	my $pkg = shift;
	my $class = ref $pkg || $pkg;
	my $device = shift;
	
	my $self = $class->SUPER::new($device, 19200);
	$self->on_read(sub{$d->process});
	return $self;
}

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 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;
