GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Device::Gsm::Sms(3) User Contributed Perl Documentation Device::Gsm::Sms(3)

Device::Gsm::Sms - SMS message internal class that represents a single text SMS message

    # A list of Device::Gsm::Sms messages is returned by
    # Device::Gsm messages() method.

    use Device::Gsm;
    ...
    @sms = $gsm->messages();

    if( @sms ) {
        foreach( @sms ) {
            print $msg->storage()   , "\n";
            print $msg->recipient() , "\n";
            print $msg->sender()    , "\n";
            print $msg->content()   , "\n";
            print $msg->time()      , "\n";
            print $msg->type()      , "\n";
        }
    }

    # Or you can instance a sms message from raw PDU data
    my $msg = new Device::Gsm::Sms(
        header => '+CMGL: ...',
        pdu    => `[encoded pdu data]',
        storage=> 'ME', # or 'SC'
    );

    if( defined $msg ) {
        print $msg->recipient() , "\n";
        print $msg->sender()    , "\n";
        print $msg->content()   , "\n";  # or $msg->text()
        print $msg->time()      , "\n";
        print $msg->type()      , "\n";
    }

        $msg->delete();

"Device::Gsm::Sms" class implements very basic SMS message object, that can be used to decode "+CMGL" GSM command response to build a more friendly high-level object.

The following is a list of methods applicable to "Device::Gsm::Sms" objects.

See text() method.

Starts the decoding process of pdu binary data. If decoding process ends in success, return value is true and sms object is filled with all proper values.

If decoding process has errors or pdu data is not provided, return value is 0 (zero).

Delete the current SMS message from sim card. Example:

    $gsm = Device::Gsm->new();
    ...
    my @msg = $gsm->messages();
    $msg[0] && $msg[0]->delete();

Basic constructor. You can build a new "Device::Gsm::Sms" object from the raw +CMGL header and PDU data. Those data is then decoded and a new sms object is instanced and all information filled, to be available for subsequent method calls.

The allowed parameters to new() method are:

header
This is the raw +CMGL header string as modem outputs when you issue a +CMGL command
pdu
Binary encoded sms data
storage
Tells which storage to delete the message from. Check the documentation of your phone to know valid storage values. Default values are:
"ME"
Deletes messages from gsm phone memory.
"SC"
Deletes messages from sim card.

Returns the sms message index number, that is the position of message in the internal device memory or sim card. This number is used for example to delete the message.

    my $gsm = Device::Gsm->new(port=>'/dev/ttyS0');
    ...
    my @messages = $gsm->messages();
    ...
    # Delete the first returned message
    my $msg = shift @messages;
    $gsm->delete_sms( $msg->index() );

Returns the sms recipient number (destination address = DA) as string (ex.: +39012345678).

Returns the sms sender number (originating address = OA) as string.

Status of the message can be one value from the following list:

Returns the storage where SMS has been read from.

Returns the textual content of sms message.

Returns the given PDU token of the decoded message (internal usage).

SMS messages can be of two types: SMS_SUBMIT and SMS_DELIVER, that are defined by two constants with those names. type() method returns one of these two values.

Example:

        if( $sms->type() == Device::Gsm::Sms::SMS_DELIVER ) {
                # ...
        }
        elsif( $sms->type() == Device::Gsm::Sms::SMS_SUBMIT ) {
                # ...
        }

Device::Gsm

None

Complete and proof-read documentation and examples

Device::Gsm::Sms - SMS message simple class that represents a text SMS message

Copyright (C) 2002-2015 Cosimo Streppone, cosimo@cpan.org

This program is free software; you can redistribute it and/or modify it only under the terms of Perl itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Perl licensing terms for details.

Cosimo Streppone, cosimo@cpan.org

Device::Gsm, perl(1)
2015-12-18 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.