#!/usr/bin/perl

# ABSTRACT: simple example script to read from an RFXCOM receiver
# PODNAME: rfxcom-rx


use warnings;
use strict;
use Device::RFXCOM::RX;

my $device = shift or die "Usage: $0 [device] [key=value] ...\n";

my $rx = Device::RFXCOM::RX->new(device => $device, map{split/=/}@ARGV);

$|=1; # don't buffer output

while (1) {
  my $data = $rx->read() or next;
  print $data->summary,"\n";
}


__END__
=pod

=head1 NAME

rfxcom-rx - simple example script to read from an RFXCOM receiver

=head1 VERSION

version 1.110430

=head1 SYNOPSIS

  # read from USB tty device
  rfxcom-rx /dev/ttyUSB0

  # read from USB device with nicer name see Device::RFXCOM::RX(3)
  rfxcom-rx /dev/rfxcom-rx

  # read from network/wireless device
  rfxcom-rx 10.0.0.1:10001

=head1 DESCRIPTION

This script is an example of the usage of the L<Device::RFXCOM::RX>
API.  It simply initializes the receiver and writes a summary of the
received RF messages to stdout.  The keys and values given on the
command line become the parameter hash for the
L<Device::RFXCOM::RX#new> constructor and are documented in that
module.

=head1 THANKS

Special thanks to RFXCOM, L<http://www.rfxcom.com/>, for their
excellent documentation and for giving me permission to use it to help
me write this code.  I own a number of their products and highly
recommend them.

=head1 SEE ALSO

L<Device::RFXCOM::RX>

RFXCOM website: http://www.rfxcom.com/

=head1 AUTHOR

Mark Hindess <soft-rfxcom@temporalanomaly.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Mark Hindess.

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

=cut

