oFono/ConnectionContext.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 44 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
_init
2.0
DESTROY
2.0
CRAP 2.0
1 package Net::Radio::oFono::ConnectionContext;
2  
3 use 5.010;
4 use strict;
5 use warnings;
6  
7 =head1 NAME
8  
9 Net::Radio::oFono::ConnectionContext - provide ConnectionContext API for objects managed by ConnectionManager
10  
11 =cut
12  
13 our $VERSION = '0.001';
14  
15 use Net::DBus qw(:typing);
16  
17 # R/W
18 use base
19 qw(Net::Radio::oFono::Helpers::EventMgr Net::Radio::oFono::Roles::RemoteObj Net::Radio::oFono::Roles::Properties);
20  
21 =head1 SYNOPSIS
22  
23 my $oFono = Net::Location::oFono->new();
24 my @modems = Net::Location::oFono->get_modems();
25 # show each available context
26 foreach my $modem_path (@modems) {
27 my $conman = Net::Location::oFono->get_modem_interface($modem_path, "ConnectionManager");
28 my %ctxs = $conman->GetContexts();
29 foreach my $ctx_path (keys %ctxs) {
30 my $ctx = $conman->GetContext($ctx_path);
31 say "Status: ", $ctx->GetProperty("Status"),
32 "Name: ", $ctx->GetProperty("Name"),
33 "Settings: ", Dumper($ctx->GetProperty("Settings") // {}), # hash
34 "IPv6.Settings: ", Dumper($ctx->GetProperty("IPv6.Settings") // {}); # hash
35 }
36 }
37  
38 =head1 METHODS
39  
40 See C<ofono/doc/conman-api.txt> for valid properties and detailed
41 action description and possible errors.
42  
43 =head2 new($obj_path;%events)
44  
45 Instantiates new Net::Radio::oFono::ConnectionContext object at specified
46 object path and registers initial events to call on ...
47  
48 =cut
49  
50 sub new
51 {
52 my ( $class, $obj_path, %events ) = @_;
53  
54 my $self = $class->SUPER::new(%events);
55  
56 bless( $self, $class );
57  
58 $self->_init($obj_path);
59 $self->GetProperties(1);
60  
61 return $self;
62 }
63  
64 =head2 _init($obj_path)
65  
66 Initializes the ConnectionContext interface. Using the "basename" of the
67 instantiated package as interface name for the RemoteObj role.
68  
69 =cut
70  
71 sub _init
72 {
73 my ( $self, $obj_path ) = @_;
74  
75 ( my $interface = ref($self) ) =~ s/Net::Radio::oFono:://;
76  
77 # initialize roles
78 $self->Net::Radio::oFono::Roles::RemoteObj::_init( $obj_path, "org.ofono.$interface" );
79 $self->Net::Radio::oFono::Roles::Properties::_init();
80  
81 return;
82 }
83  
84 sub DESTROY
85 {
86 my $self = $_[0];
87  
88 # destroy roles
89 $self->Net::Radio::oFono::Roles::Properties::DESTROY();
90 $self->Net::Radio::oFono::Roles::RemoteObj::DESTROY();
91  
92 # destroy base class
93 $self->Net::Radio::oFono::Helpers::EventMgr::DESTROY();
94  
95 return;
96 }
97  
98 =head1 BUGS
99  
100 Please report any bugs or feature requests to C<bug-net-radio-ofono at rt.cpan.org>, or through
101 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Radio-oFono>. I will be notified, and then you'll
102 automatically be notified of progress on your bug as I make changes.
103  
104 If you think you've found a bug then please read "How to Report Bugs
105 Effectively" by Simon Tatham:
106 L<http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>.
107  
108 =head1 SUPPORT
109  
110 You can find documentation for this module with the perldoc command.
111  
112 perldoc Net::Radio::oFono
113  
114 You can also look for information at:
115  
116 =over 4
117  
118 =item * RT: CPAN's request tracker (report bugs here)
119  
120 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Radio-oFono>
121  
122 If you think you've found a bug then please read "How to Report Bugs
123 Effectively" by Simon Tatham:
124 L<http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>.
125  
126 =item * AnnoCPAN: Annotated CPAN documentation
127  
128 L<http://annocpan.org/dist/Net-Radio-oFono>
129  
130 =item * CPAN Ratings
131  
132 L<http://cpanratings.perl.org/d/Net-Radio-oFono>
133  
134 =item * Search CPAN
135  
136 L<http://search.cpan.org/dist/Net-Radio-oFono/>
137  
138 =back
139  
140 =head2 Where can I go for help with a concrete version?
141  
142 Bugs and feature requests are accepted against the latest version
143 only. To get patches for earlier versions, you need to get an
144 agreement with a developer of your choice - who may or not report the
145 issue and a suggested fix upstream (depends on the license you have
146 chosen).
147  
148 =head2 Business support and maintenance
149  
150 For business support you can contact Jens via his CPAN email
151 address rehsackATcpan.org. Please keep in mind that business
152 support is neither available for free nor are you eligible to
153 receive any support based on the license distributed with this
154 package.
155  
156 =head1 ACKNOWLEDGEMENTS
157  
158 At first the guys from the oFono-Team shall be named: Marcel Holtmann and
159 Denis Kenzior, the maintainers and all the people named in ofono/AUTHORS.
160 Without their effort, there would no need for a Net::Radio::oFono module.
161  
162 Further, Peter "ribasushi" Rabbitson helped a lot by providing hints
163 and support how to make this API accessor a valuable CPAN module.
164  
165 =head1 AUTHOR
166  
167 Jens Rehsack, C<< <rehsack at cpan.org> >>
168  
169 =head1 LICENSE AND COPYRIGHT
170  
171 Copyright 2012 Jens Rehsack.
172  
173 This program is free software; you can redistribute it and/or modify it
174 under the terms of either: the GNU General Public License as published
175 by the Free Software Foundation; or the Artistic License.
176  
177 See http://dev.perl.org/licenses/ for more information.
178  
179  
180 =cut
181  
182 1;