File Coverage

blib/lib/Device/Gsm/Sms/Structure.pm
Criterion Covered Total %
statement 28 30 93.3
branch 4 8 50.0
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 40 47 85.1


line stmt bran cond sub pod time code
1             # Device::Gsm::Sms::Structure - SMS messages structure class
2             # Copyright (C) 2002 Cosimo Streppone, cosimo@cpan.org
3             # Copyright (C) 2006-2011 Grzegorz Wozniak, wozniakg@gmail.com
4             #
5             # This program is free software; you can redistribute it and/or modify
6             # it only under the terms of Perl itself.
7             #
8             # This program is distributed in the hope that it will be useful,
9             # but WITHOUT ANY WARRANTY; without even the implied warranty of
10             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11             # Perl licensing terms for details.
12             #
13             # $Id$
14              
15             package Device::Gsm::Sms;
16              
17 6     6   33 use strict;
  6         10  
  6         213  
18 6     6   32 use integer;
  6         10  
  6         39  
19              
20 6     6   135 use Device::Gsm::Sms;
  6         11  
  6         165  
21 6     6   28 use Device::Gsm::Sms::Token;
  6         9  
  6         124  
22              
23 6     6   4001 use Device::Gsm::Sms::Token::SCA;
  6         16  
  6         142  
24 6     6   3944 use Device::Gsm::Sms::Token::PDUTYPE;
  6         15  
  6         182  
25 6     6   9993 use Data::Dumper;
  6         75015  
  6         1551  
26              
27             #
28             # Inspect structure of SMS
29             # This varies with sms type (deliver or submit)
30             #
31             sub structure {
32 8     8 0 12 my $self = shift;
33 8         12 my @struct;
34 8 100       25 if ($self->type() == SMS_DELIVER) {
    50          
    0          
35 6 50       23 if ($self->{'tokens'}->{'PDUTYPE'}->{'_UDHI'}) {
36 0         0 @struct = qw/SCA PDUTYPE OA PID DCS SCTS UDH UD/;
37             }
38             else {
39              
40             # UD takes UDL + UD automatically
41 6         30 @struct = qw/SCA PDUTYPE OA PID DCS SCTS UD/;
42             }
43             }
44             elsif ($self->type() == SMS_SUBMIT) {
45 2         11 @struct = qw/SCA PDUTYPE MR DA PID DCS VP UD/;
46             }
47             elsif ($self->type() == SMS_STATUS) {
48 0         0 @struct = qw/SCA PDUTYPE MR DA SCTS DT ST/;
49             }
50 8         41 return @struct;
51             }
52              
53             1;