Device::RFXCOM::RX - Module to support RFXCOM RF receiver
version 1.163170
# for a USB-based device my $rx = Device::RFXCOM::RX->new(device => '/dev/ttyUSB0'); $|=1; # don't buffer output # simple interface to read received data my $timeout = 10; # 10 seconds while (my $data = $rx->read($timeout)) { print $data->summary,"\n" unless ($data->duplicate); } # for a networked device $rx = Device::RFXCOM::RX->new(device => '10.0.0.1:10001');
Module to decode messages from an RFXCOM RF receiver.
IMPORTANT: This API is still subject to change.
new(%parameters)
This constructor returns a new RFXCOM RF receiver object. The supported parameters are:
The name of the device to connect to. The value can be a tty device name or hostname:port for a TCP-based RFXCOM receiver.
hostname:port
The default is /dev/rfxcom-rx in anticipation of a scenario where a udev rule has been used to identify the USB tty device for the device. For example, a file might be created in /etc/udev/rules.d/91-rfxcom with a line like:
/dev/rfxcom-rx
/etc/udev/rules.d/91-rfxcom
SUBSYSTEM=="tty", SYSFS{idProduct}=="6001", SYSFS{idVendor}=="0403", SYSFS{serial}=="AnnnnABC", NAME="rfxcom-rx"
where the serial number attribute is obtained from the output from:
serial
udevinfo -a -p `udevinfo -q path -n /dev/ttyUSB0` | \ sed -e'/ATTRS{serial}/!d;q'
This parameter can be set to a callback to be called when the device initialization has been completed.
read($timeout)
This method blocks until a new message has been received by the device. When a message is received a data structure is returned that represents the data received.
read_one(\$buffer)
This method attempts to remove a single RF message from the buffer passed in via the scalar reference. When a message is removed a data structure is returned that represents the data received. If insufficient data is available then undef is returned. If a duplicate message is received then 0 is returned.
Special thanks to RFXCOM, 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.
RFXCOM website: http://www.rfxcom.com/
Mark Hindess <soft-cpan@temporalanomaly.com>
This software is copyright (c) 2014 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.
To install Device::W800, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::W800
CPAN shell
perl -MCPAN -e shell install Device::W800
For more information on module installation, please visit the detailed CPAN module installation guide.