#!/usr/bin/perl

=head1 NAME d2-getvalue

d2-getvalue - get and output value(s) from a D2 satellite controller

=head1 SYNOPSIS

 d2-getvalue value [value ..]

=head1 DESCRIPTION

Communicates with a D2 mobilsat controller and retreives the listed values
from it, which can be things like gps coordinates, dish positioning or
satellite location info, and outputs them one per line.

For a list of all known values with descriptions, run the command with no
parameters.

=cut

use SatUtils::D2;
use strict;
use warnings;

if (! @ARGV) {
	print "usage: d2-getvalue value [value ..]\n\n";
	print "Known values:\n";
	my %p=SatUtils::D2->listvalues;
	foreach my $v (sort keys %p) {
		print $v.(" " x (20 - length($v)))." $p{$v}\n";
	}
	exit;
}

my $s=SatUtils::D2->new;
foreach (@ARGV) {
	print $s->getvalue($_)."\n";
}

=head1 AUTHOR

Joey Hess <joey@kitenet.net>

=cut
