Device-Gsm
view release on metacpan or search on metacpan
lib/Device/Gsm.pm view on Meta::CPAN
=over 4
=item C<ME>
Means gsm phone B<ME>mory
=item C<MT>
Means gsm phone B<ME>mory on Nokia phones?
=item C<SM>
Means B<S>im card B<M>emory (default value)
=back
Example:
my $gsm = Device::Gsm->new();
$gsm->connect(port=>'/dev/ttyS0') or die "Can't connect!";
for( $gsm->messages('SM') )
{
print $_->sender(), ': ', $_->content(), "\n";
}
=head2 mode()
Sets the device GSM command mode. Accepts one parameter to set the new mode
that can be the string C<text> or C<pdu>. Example:
# Set text mode
$gsm->mode('text');
# Set pdu mode
$gsm->mode('pdu');
=head2 model()
Returns phone/device model name or number. Example:
my $model = $gsm->model();
For example, for Siemens C45, C<$model> holds C<C45>; for Nokia 6600, C<$model>
holds C<6600>.
=head2 network()
Returns the current registered or preferred GSM network operator. Example:
my $net_name = $gsm->network();
# Returns 'Wind Telecom Spa'
my($net_name, $net_code) = $gsm->network();
# Returns ('Wind Telecom Spa', '222 88')
This obviously varies depending on country and network operator. For me now,
it holds "Wind Telecomunicazioni SpA". It is not guaranteed that the mobile
phone returns the decoded network name. It can also return a gsm network code,
like C<222 88>. In this case, an attempt to decode the network name is made.
Be sure to call the C<network()> method when already registered to gsm
network. See C<register()> method.
=head2 signal_quality()
Returns the measure of signal quality expressed in dBm units, where near to
zero is better. An example value is -91 dBm, and reported value is C<-91>.
Values should range from -113 to -51 dBm, where -113 is the minimum signal
quality and -51 is the theoretical maximum quality.
my $level = $gsm->signal_quality();
If signal quality can't be read or your device does not support this command,
an B<undefined> value will be returned.
=head2 software_version()
Returns the device firmware version, as stored by the manufacturer. Example:
my $rev = $gsm->software_revision();
For example, for my Siemens C45, C<$rev> holds C<06>.
=head2 storage()
Allows to get/set the current sms storage, that is where the sms messages are
saved, either the sim card or gsm phone memory. Phones/modems that do not
support this feature (implemented by C<+CPMS> AT command won't be affected by
this method.
my @msg;
my $storage = $gsm->storage();
print "Current storage is $storage\n";
# Read all messages on sim card
$gsm->storage('SM');
@msg = $gsm->messages();
# Read messages from gsm phone memory
$gsm->storage('ME');
push @msg, $gsm->messages();
=head2 test_command()
This method queries the device to know if a specific AT GSM command is
supported. This is used only with GSM commands (those with C<AT+> prefix).
For example, if I want to know if my device supports the C<AT+GXXX> command:
my $gsm = Device::Gsm->new( port => '/dev/myport' );
...
if( $gsm->test_command('GXXX') ) {
# Ok, command is supported
} else {
# Nope, no GXXX command
}
( run in 0.391 second using v1.01-cache-2.11-cpan-96521ef73a4 )