| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Radio::Modem; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
69685
|
use 5.010; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
81
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
64
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
899
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::Radio::Modem - Independently access radio network modems (such as 3GPP) |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Net::Radio::Modem; |
|
19
|
|
|
|
|
|
|
my $modem = Net::Radio::Modem->new('Static', '/test_0' => { |
|
20
|
|
|
|
|
|
|
MNC => '262', MCC => '02', IMSI => '262020555017753', |
|
21
|
|
|
|
|
|
|
LAC => ...}, '/test_1' => { ... } ... ); |
|
22
|
|
|
|
|
|
|
my @modems = $modem->get_modems(); # returns ('/test_0', 'test_1', ...) |
|
23
|
|
|
|
|
|
|
my $local_modem = grep { |
|
24
|
|
|
|
|
|
|
$modem->get_modem_property($_, 'MobileCountryCode') == 364 |
|
25
|
|
|
|
|
|
|
} @modems; # find the one for Bahamas |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $real_m = Net::Radio::Modem->new('oFono', { |
|
28
|
|
|
|
|
|
|
dbus_main_runs => 0 # fetch values, don't rely on dbus-signals |
|
29
|
|
|
|
|
|
|
}); |
|
30
|
|
|
|
|
|
|
my @rm = $real_m->get_modems(); |
|
31
|
|
|
|
|
|
|
my $o2sim = grep { |
|
32
|
|
|
|
|
|
|
$real_m->get_modem_property($_, 'MCC') == 262 # Germany |
|
33
|
|
|
|
|
|
|
and $real_m->get_modem_property($_, 'MNC') ~~ qw(07 08 11) # O2 |
|
34
|
|
|
|
|
|
|
} @rf; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 new($imp;@impl_args) |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Instantiates new modem accessor from package C. |
|
41
|
|
|
|
|
|
|
If no package C is available, |
|
42
|
|
|
|
|
|
|
C is used. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
C<@impl_args> are passed to the initialisation of the implementation class. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
3
|
|
|
3
|
1
|
1870
|
my ( $class, $impl, @args ) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
11
|
my $self = bless( {}, $class ); |
|
53
|
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
13
|
my $impl_class = _load_plugin($impl); |
|
55
|
3
|
|
33
|
|
|
12
|
$impl_class //= _load_plugin("Net::Radio::Modem::Adapter::Null"); |
|
56
|
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
12
|
$self->{impl_class} = $impl_class; |
|
58
|
3
|
|
|
|
|
15
|
$self->{impl} = $impl_class->new(@args); |
|
59
|
|
|
|
|
|
|
|
|
60
|
3
|
|
|
|
|
15
|
return $self; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _load_plugin |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
6
|
|
|
6
|
|
11
|
my $plugin = shift; |
|
66
|
|
|
|
|
|
|
|
|
67
|
6
|
100
|
|
|
|
53
|
$plugin->isa("Net::Radio::Modem::Adapter") and return $plugin; |
|
68
|
|
|
|
|
|
|
|
|
69
|
5
|
|
|
|
|
24
|
( my $module_file = "$plugin.pm" ) =~ s{::}{/}g; |
|
70
|
5
|
50
|
|
|
|
21
|
defined $INC{$module_file} and return; |
|
71
|
|
|
|
|
|
|
|
|
72
|
5
|
|
|
|
|
8
|
eval { require $module_file; }; |
|
|
5
|
|
|
|
|
3075
|
|
|
73
|
5
|
100
|
|
|
|
22
|
if ($@) |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
3
|
50
|
|
|
|
23
|
$plugin =~ m/Net::Radio::Modem::Adapter/ |
|
76
|
|
|
|
|
|
|
or return _load_plugin("Net::Radio::Modem::Adapter::$plugin"); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
else |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
2
|
50
|
|
|
|
30
|
$plugin->isa("Net::Radio::Modem::Adapter") and return $plugin; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
return; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 get_modems() |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Provides a list of modems available. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub get_modems |
|
93
|
|
|
|
|
|
|
{ |
|
94
|
3
|
|
|
3
|
1
|
7800
|
return $_[0]->{impl}->get_modems(); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 get_modem_property($modem,$property) |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Provides the value of given property for specified modem. |
|
100
|
|
|
|
|
|
|
Property can be an L. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub get_modem_property |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
40
|
|
|
40
|
1
|
5153
|
my $self = $_[0]; |
|
107
|
40
|
|
|
|
|
52
|
my $modem = $_[1]; |
|
108
|
40
|
|
|
|
|
134
|
my $property = $self->{impl}->get_alias_for( $_[2] ); |
|
109
|
40
|
|
|
|
|
133
|
$self->{impl}->get_modem_property( $modem, $property ); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 BUGS |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
115
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
116
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
If you think you've found a bug then please read "How to Report Bugs |
|
119
|
|
|
|
|
|
|
Effectively" by Simon Tatham: |
|
120
|
|
|
|
|
|
|
L. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SUPPORT |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
perldoc Net::Radio::Modem |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
You can also look for information at: |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=over 4 |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
If you think you've found a bug then please read "How to Report Bugs |
|
137
|
|
|
|
|
|
|
Effectively" by Simon Tatham: |
|
138
|
|
|
|
|
|
|
L. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * Search CPAN |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
L |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=back |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 Where can I go for help with a concrete version? |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Bugs and feature requests are accepted against the latest version |
|
157
|
|
|
|
|
|
|
only. To get patches for earlier versions, you need to get an |
|
158
|
|
|
|
|
|
|
agreement with a developer of your choice - who may or not report the |
|
159
|
|
|
|
|
|
|
issue and a suggested fix upstream (depends on the license you have |
|
160
|
|
|
|
|
|
|
chosen). |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 Business support and maintenance |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
For business support you can contact Jens via his CPAN email |
|
165
|
|
|
|
|
|
|
address rehsackATcpan.org. Please keep in mind that business |
|
166
|
|
|
|
|
|
|
support is neither available for free nor are you eligible to |
|
167
|
|
|
|
|
|
|
receive any support based on the license distributed with this |
|
168
|
|
|
|
|
|
|
package. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 ROADMAP |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Following things will be nice to have: |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=over 4 |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item * |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
List of features useful in a perl module (excluding NIH features) |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item * |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Class hierarchy with wrapper implementation of required functions |
|
185
|
|
|
|
|
|
|
using a configurable adapter class hierarchy. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Implement I and I pattern to allow mocking |
|
190
|
|
|
|
|
|
|
of specific values and/or fallback values ... |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Patches |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 AUTHOR |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Jens Rehsack, C<< >> |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright 2012 Jens Rehsack. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
207
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
208
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
1; # End of Net::Radio::Modem |