.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Device::Gsm::Sms 3pm" .TH Device::Gsm::Sms 3pm "2021-01-19" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Device::Gsm::Sms \- SMS message internal class that represents a single text SMS message .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # 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() , "\en"; \& print $msg\->recipient() , "\en"; \& print $msg\->sender() , "\en"; \& print $msg\->content() , "\en"; \& print $msg\->time() , "\en"; \& print $msg\->type() , "\en"; \& } \& } \& \& # Or you can instance a sms message from raw PDU data \& my $msg = new Device::Gsm::Sms( \& header => \*(Aq+CMGL: ...\*(Aq, \& pdu => \`[encoded pdu data]\*(Aq, \& storage=> \*(AqME\*(Aq, # or \*(AqSC\*(Aq \& ); \& \& if( defined $msg ) { \& print $msg\->recipient() , "\en"; \& print $msg\->sender() , "\en"; \& print $msg\->content() , "\en"; # or $msg\->text() \& print $msg\->time() , "\en"; \& print $msg\->type() , "\en"; \& } \& \& $msg\->delete(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Device::Gsm::Sms\*(C'\fR class implements very basic \s-1SMS\s0 message object, that can be used to decode \f(CW\*(C`+CMGL\*(C'\fR \s-1GSM\s0 command response to build a more friendly high-level object. .SH "METHODS" .IX Header "METHODS" The following is a list of methods applicable to \f(CW\*(C`Device::Gsm::Sms\*(C'\fR objects. .SS "\fBcontent()\fP" .IX Subsection "content()" See \fBtext()\fR method. .SS "\fBdecode()\fP" .IX Subsection "decode()" 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. .PP If decoding process has errors or pdu data is not provided, return value is 0 (zero). .SS "\fBdelete()\fP" .IX Subsection "delete()" Delete the current \s-1SMS\s0 message from sim card. Example: .PP .Vb 4 \& $gsm = Device::Gsm\->new(); \& ... \& my @msg = $gsm\->messages(); \& $msg[0] && $msg[0]\->delete(); .Ve .SS "\fBnew()\fP" .IX Subsection "new()" Basic constructor. You can build a new \f(CW\*(C`Device::Gsm::Sms\*(C'\fR object from the raw \fB+CMGL\fR header and \fB\s-1PDU\s0\fR data. Those data is then decoded and a new sms object is instanced and all information filled, to be available for subsequent method calls. .PP The allowed parameters to \fBnew()\fR method are: .IP "header" 4 .IX Item "header" This is the raw \fB+CMGL\fR header string as modem outputs when you issue a \fB+CMGL\fR command .IP "pdu" 4 .IX Item "pdu" Binary encoded sms data .IP "storage" 4 .IX Item "storage" Tells which storage to delete the message from. Check the documentation of your phone to know valid storage values. Default values are: .RS 4 .ie n .IP """ME""" 4 .el .IP "\f(CWME\fR" 4 .IX Item "ME" Deletes messages from gsm phone memory. .ie n .IP """SC""" 4 .el .IP "\f(CWSC\fR" 4 .IX Item "SC" Deletes messages from sim card. .RE .RS 4 .RE .SS "\fBindex()\fP" .IX Subsection "index()" 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. .PP .Vb 7 \& my $gsm = Device::Gsm\->new(port=>\*(Aq/dev/ttyS0\*(Aq); \& ... \& my @messages = $gsm\->messages(); \& ... \& # Delete the first returned message \& my $msg = shift @messages; \& $gsm\->delete_sms( $msg\->index() ); .Ve .SS "\fBrecipient()\fP" .IX Subsection "recipient()" Returns the sms recipient number (destination address = \s-1DA\s0) as string (ex.: \f(CW+39012345678\fR). .SS "\fBsender()\fP" .IX Subsection "sender()" Returns the sms sender number (originating address = \s-1OA\s0) as string. .SS "\fBstatus()\fP" .IX Subsection "status()" Status of the message can be one value from the following list: .SS "\fBstorage()\fP" .IX Subsection "storage()" Returns the storage where \s-1SMS\s0 has been read from. .SS "\fBtext()\fP" .IX Subsection "text()" Returns the textual content of sms message. .SS "\fBtoken()\fP" .IX Subsection "token()" Returns the given \s-1PDU\s0 token of the decoded message (internal usage). .SS "\fBtype()\fP" .IX Subsection "type()" \&\s-1SMS\s0 messages can be of two types: \s-1SMS_SUBMIT\s0 and \s-1SMS_DELIVER,\s0 that are defined by two constants with those names. \fBtype()\fR method returns one of these two values. .PP Example: .PP .Vb 6 \& if( $sms\->type() == Device::Gsm::Sms::SMS_DELIVER ) { \& # ... \& } \& elsif( $sms\->type() == Device::Gsm::Sms::SMS_SUBMIT ) { \& # ... \& } .Ve .SH "REQUIRES" .IX Header "REQUIRES" .IP "\(bu" 4 Device::Gsm .SH "EXPORTS" .IX Header "EXPORTS" None .SH "TODO" .IX Header "TODO" .IP "\(bu" 4 Complete and proof-read documentation and examples .SH "COPYRIGHT" .IX Header "COPYRIGHT" Device::Gsm::Sms \- \s-1SMS\s0 message simple class that represents a text \s-1SMS\s0 message .PP Copyright (C) 2002\-2015 Cosimo Streppone, cosimo@cpan.org .PP This program is free software; you can redistribute it and/or modify it only under the terms of Perl itself. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the Perl licensing terms for details. .SH "AUTHOR" .IX Header "AUTHOR" Cosimo Streppone, cosimo@cpan.org .SH "SEE ALSO" .IX Header "SEE ALSO" Device::Gsm, \fBperl\fR\|(1)