BT368i

 view release on metacpan or  search on metacpan

lib/BT368i/NMEA/GP/VTG.pm  view on Meta::CPAN


#----------------------------------------#
#
#----------------------------------------#
sub parse {
	my $self = shift;
	my $data = shift;

  # if we're logging, save data to filehandle
	if ($self->{log_fh}) {
		print { $self->{log_fh} } $data . "\n";
	}

	$data    =~ s/\*..$//; # remove the last three bytes
	my @args = split(/,/, $data);

	# 1) 054.7,T      True track made good (degrees)
	$self->{true_track} = $args[1];

	# 2) 034.4,M      Magnetic track made good
	$self->{magnetic_track} = $args[3];

	# 3) 005.5,N      Ground speed, knots
	$self->{ground_speed_knots} = $args[5];

	# 4) 010.2,K      Ground speed, Kilometers per hour
	$self->{ground_speed_kilometers} = $args[7];
}

1;

__END__
=head1 NAME

BT368i::NMEA::GP::VTG - The VTG sentance

=head1 SYNOPSIS

use BT368i::NMEA::GP::VTG;

my $vtg = new BT368i::NMEA::GP::VTG();

$vtg->parse();

$vtg->print();

=head1 DESCRIPTION

Used to decode the VTG message.

=head2 Methods

=over 2

=item $vtg->parse();

Parse a GPVTG sentance.

=item $vtg->print();

Print a decoded output of a GPVTG sentance.

=item $vtg->log($filename);

Log the GPVTG sentance to a file.

=back

=head1 AUTHOR

Travis Kent Beste, travis@tencorners.com

=head1 COPYRIGHT

Copyright 2010 Tencorners, LLC.  All rights reserved.

This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

Travis Kent Beste's GPS www site
http://www.travisbeste.com/software/gps

perl(1).

RingBuffer.pm.

Device::SerialPort.pm.

=cut



( run in 1.227 second using v1.01-cache-2.11-cpan-f56aa216473 )