Net::Radio::oFono::Roles::Manager - Role for Interfaces which manages objects
This package provides a role for being added to classes which need to manages embedded remote objects in remote dbus object.
package Net::Radio::oFono::NewInterface; use Net::Radio::oFono::Roles::Manager qw(Embed); use base qw(Net::Radio::oFono::Helpers::EventMgr? Net::Radio::oFono::Roles::RemoteObj Net::Radio::oFono::Roles::Manager ...); use Net::DBus qw(:typing); sub new { my ( $class, %events ) = @_; my $self = $class->SUPER::new(%events); # SUPER::new finds first - so EventMgr::new bless( $self, $class ); $self->_init(); return $self; } sub _init { my $self = $_[0]; # initialize roles $self->Net::Radio::oFono::Roles::RemoteObj::_init( "/modem_0", "org.ofono.NewInterface" ); # must be first one $self->Net::Radio::oFono::Roles::Manager::_init( "Embed", "NewEmbed" ); ... return; } sub DESTROY { my $self = $_[0]; # destroy roles ... $self->Net::Radio::oFono::Roles::Manager::DESTROY(); # must be last one $self->Net::Radio::oFono::Roles::RemoteObj::DESTROY(); # must be last one # destroy base class $self->Net::Radio::oFono::Helpers::EventMgr::DESTROY(); return; }
Following events are triggered by this role:
Triggered when a new object of specified type was added.
Triggered when an object of specified type is removed.
When invoked, getters for embedded objects are injected into caller's namespace using the generic "GetObjects" and "GetObject" as well as required static methods for managed types.
Using the MessageManager example:
package Net::Radio::oFono::MessageManager; ... use Net::Radio::oFono::Roles::Manager qw(Message);
Injects GetMessages and GetMessage into Net::Radio::oFono::MessageManager, using GetObjects for GetMessages and GetObject for GetMessage. Injects _get_managed_type and _get_managed_interface into Net::Radio::oFono::MessageManager, returning Message as descriptive type and Message as interface or class type, respectively.
GetMessages
GetMessage
GetObjects
GetObject
_get_managed_type
_get_managed_interface
Message
package Net::Radio::oFono::NetworkRegistration; ... use Net::Radio::oFono::Roles::NetworkRegistration qw(Operator NetworkOperator);
Injects GetOperators and GetOperator into Net::Radio::oFono::NetworkRegistration, using GetObjects for GetOperators and GetObject for GetOperator. Injects _get_managed_type and _get_managed_interface into Net::Radio::oFono::NetworkRegistration, returning Operator as descriptive type and NetworkOperator as interface or class type, respectively.
GetOperators
GetOperator
Operator
NetworkOperator
Initializes the manager role of the object.
$type and $<$interface> are the spoken type of the embedded object (for signals, events) and the remote interface name (without the org.ofono. prefix).
$type
org.ofono.
If no interface is named, the spoken type is used as interface name (which is pretty common, like for Modem or Message).
The initialization connects to the signals ${type}Added and ${type}Removed provided by oFono's manager objects.
${type}Added
${type}Removed
Frees previously aquired resources like connected signals, list of managed objects (object_path).
Must be invoked before the RemoteObject role frees it's resources ...
Returns the managed objects of the remote object as hash with the object path as key and the properties dictionary (hash) as value.
When invoked with a true value as first argument, the managed object list is refreshed from the remote object.
Returns the object hash in array more and the reference to the object hash in scalar mode.
Return cloned objects to avoid dirtying the local cache ...
Returns an instance of the managed object interface identified by the specified object path.
Take above example for MessageManager, this method will return instances of net::Radio::oFono::Message using the /{modem0,modem1,...}/{message_01,...} object path.
MessageManager
net::Radio::oFono::Message
Callback method used when the signal ..Added is received. Can be overwritten to implement other or enhanced behavior.
..Added
Updates properties cache
Triggers event for added object
Callback method used when the signal ..Removed is received. Can be overwritten to implement other or enhanced behavior.
..Removed
Triggers event for removed object
Please report any bugs or feature requests to bug-net-radio-ofono at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Radio-oFono. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-net-radio-ofono at rt.cpan.org
If you think you've found a bug then please read "How to Report Bugs Effectively" by Simon Tatham: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html.
You can find documentation for this module with the perldoc command.
perldoc Net::Radio::oFono
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Radio-oFono
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-Radio-oFono
CPAN Ratings
http://cpanratings.perl.org/d/Net-Radio-oFono
Search CPAN
http://search.cpan.org/dist/Net-Radio-oFono/
Bugs and feature requests are accepted against the latest version only. To get patches for earlier versions, you need to get an agreement with a developer of your choice - who may or not report the issue and a suggested fix upstream (depends on the license you have chosen).
For business support you can contact Jens via his CPAN email address rehsackATcpan.org. Please keep in mind that business support is neither available for free nor are you eligible to receive any support based on the license distributed with this package.
At first the guys from the oFono-Team shall be named: Marcel Holtmann and Denis Kenzior, the maintainers and all the people named in ofono/AUTHORS. Without their effort, there would no need for a Net::Radio::oFono module.
Further, Peter "ribasushi" Rabbitson helped a lot by providing hints and support how to make this API accessor a valuable CPAN module.
Jens Rehsack, <rehsack at cpan.org>
<rehsack at cpan.org>
Copyright 2012 Jens Rehsack.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Net::Radio::oFono, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Radio::oFono
CPAN shell
perl -MCPAN -e shell install Net::Radio::oFono
For more information on module installation, please visit the detailed CPAN module installation guide.