NAME
Device::Gsm - Perl extension to interface GSM cellular / modems
WARNING
This is C<PRE-ALPHA> software, still needs extensive testing and
support for custom GSM commands, so use it at your own risk,
and without C<ANY> warranty! Have fun.
SYNOPSIS
use Device::Gsm;
my $gsm = new Device::Gsm( port => '/dev/ttyS1', pin => 'xxxx' );
if( $gsm->connect() ) {
print "connected!\n";
} else {
print "sorry, no connection with gsm phone on serial port!\n";
}
# Register to GSM network (you must supply PIN number in above new() call)
$gsm->register();
# Get the manufacturer and model code of device
my $mnf = $gsm->manufacturer();
my $model = $gsm->model();
print "soft version is ", $gsm->software_version(), "\n";
my $imei = $gsm->imei() or
$imei = $gsm->serial_number();
# Test for command support
if( $self->test_command('CGMI') ) {
# `AT+CGMI' is supported!
} else {
# No luck, CGMI command not available
}
print 'Service number is now: ', $gsm->service_center(), "\n";
$gsm->service_center( '+001505050' ); # Sets new number
# Send quickly a short text message
$modem->send_sms(
recipient => '+3934910203040',
content => 'Hello world! from Device::Gsm'
);
# The long way...
$modem->send_sms(
recipient => '34910203040',
content => 'Hello world again, with more args',
# SMS sending mode
# try `text' on old phones or GSM modems
# `pdu' is the default nowadays
mode => 'pdu',
# SMS Class (can be `normal' or `flash')
# `flash' mode delivers instantly!
class => 'normal'
);
DESCRIPTION
Device::Gsm
class implements basic GSM functions, network registration and SMS sending.
This class supports also PDU
mode to send SMS
messages, and should be fairly usable. I'm developing and testing it under Linux RedHat 7.1
with a 16550 serial port and Siemens C35i
/ C45
GSM phones attached with a Siemens-compatible serial cable.
Please be kind to the universe and contact me if you have troubles or you are interested in this.
Please be monstruosly kind to the universe and (if you don't mind spending an SMS) use the `examples/send_to_cosimo.pl' script to make me know that Device::Gsm works with your device (thanks!).
REQUIRES
Device::Modem, which in turn requires
Device::SerialPort (or Win32::SerialPort on Windows machines)
EXPORT
None
TO-DO
- Spooler
-
Build a simple spooler program that sends all SMS stored in a special queue (that could be a simple filesystem folder).
- Validity Period
-
Support
validity period
option on SMS sending. Tells how much time the SMS Service Center must hold the SMS for delivery. - Profiles
-
Build a profile of the GSM device used, so that we don't have to
always
test each command to know whether it is supported or not, because this takes too time to be done every time.
AUTHOR
Cosimo Streppone, cosimo@cpan.org
SEE ALSO
Device::Modem, Device::SerialPort, Win32::SerialPort, perl(1)