#!/usr/bin/perl

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


use warnings;
use strict;
package main;
BEGIN {
  $main::VERSION = '1.103240';
}
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

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

=head1 VERSION

version 1.103240

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

