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-2015 Cosimo Streppone, cosimo@cpan.org
3             # Copyright (C) 2006-2015 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             package Device::Gsm::Sms;
14              
15 7     7   25 use strict;
  7         6  
  7         161  
16 7     7   19 use integer;
  7         7  
  7         21  
17              
18 7     7   100 use Device::Gsm::Sms;
  7         6  
  7         117  
19 7     7   20 use Device::Gsm::Sms::Token;
  7         7  
  7         106  
20              
21 7     7   2319 use Device::Gsm::Sms::Token::SCA;
  7         10  
  7         140  
22 7     7   2400 use Device::Gsm::Sms::Token::PDUTYPE;
  7         9  
  7         124  
23 7     7   3454 use Data::Dumper;
  7         39503  
  7         956  
24              
25             #
26             # Inspect structure of SMS
27             # This varies with sms type (deliver or submit)
28             #
29             sub structure {
30 16     16 0 16 my $self = shift;
31 16         11 my @struct;
32 16 100       30 if ($self->type() == SMS_DELIVER) {
    50          
    0          
33 14 50       32 if ($self->{'tokens'}->{'PDUTYPE'}->{'_UDHI'}) {
34 0         0 @struct = qw/SCA PDUTYPE OA PID DCS SCTS UDH UD/;
35             }
36             else {
37              
38             # UD takes UDL + UD automatically
39 14         27 @struct = qw/SCA PDUTYPE OA PID DCS SCTS UD/;
40             }
41             }
42             elsif ($self->type() == SMS_SUBMIT) {
43 2         4 @struct = qw/SCA PDUTYPE MR DA PID DCS VP UD/;
44             }
45             elsif ($self->type() == SMS_STATUS) {
46 0         0 @struct = qw/SCA PDUTYPE MR DA SCTS DT ST/;
47             }
48 16         48 return @struct;
49             }
50              
51             1;