Device::MX240 - Perl api to the MX240 (Motorola Instant Messenger)
use Device::MX240 qw(open_dev); my $done = 0; # Ctrl-C/INT handler $SIG{INT} = sub { $SIG{INT} = 'IGNORE'; $done++; }; my $d = open_dev(); # init device $d->write_dev("\xad\xef\x8d"); while (!$done) { my $buf = $d->read_dev(); if ($buf) { # process $buf # and use $d->write_dev(); } sleep(1); # poll the device $d->write_dev("\xad"); } $d->close_dev; exit;
This module allows easy communication to and from the MX240. Also known as the IMFree. The device is a wireless instant messenger. (USB base, 900mhz) libusb and libhid are required for this module to compile.
This module has a few functions to interact with the MX240a. Data is read in 16 byte boundries, and is written in 16 byte boundries.
open_dev
This function returns a blessed reference to the MX240 device. The interface for this function may change in the future to accept a vendor and product id. You can use the returned object with the following mehods.
read_dev
Returns undef when nothing has been read, and 16 bytes of data on success.
write_dev( $data )
Returns number of bytes written, and 0 on failure.
close_dev
Returns true on success and 0 on failure;
None by default. You can export open_dev, MX240A_VENDOR, and MX240A_PRODUCT.
MX240A_VENDOR
MX240A_PRODUCT
use Device::MX240 qw(open_dev);
http://libusb.sourceforge.net/, http://libhid.alioth.debian.org/
David Davis <xantus@cpan.org>
Dusty, for the C functions to libhid and libusb.
Please rate this module. "/cpanratings.perl.org/rate/?distribution=Device-MX240"" in "http:
Copyright 2005 by David Davis and Teknikill Software
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Device::MX240, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::MX240
CPAN shell
perl -MCPAN -e shell install Device::MX240
For more information on module installation, please visit the detailed CPAN module installation guide.