oFono/Message.pm untested

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