Net::Fritz::Device - represents a TR064 device
version v0.0.9
my $fritz = Net::Fritz::Box->new(); my $device = $fritz->discover(); # get services to call them later my $service_a = $device->get_service('DeviceInfo:1'); my $service_b = $device->find_service('D.*Info:1'); # get a subdevice my $subdevice = $device->find_device('LANDevice:1'); # this one can give multiple results my $service_list = $device->find_service_names('DeviceInfo:1'); printf "%d services found\n", scalar @{$service_list->data}; # show all data $device->dump();
This class represents a TR064 device that has been discovered. A device gives access to other subdevices (Net::Fritz::Device) as well as Net::Fritz::Services which allow interaction with a Net::Fritz::Device.
A Net::Fritz::Box instance containing the current configuration information (device address, authentication etc.).
A complex hashref containing all information about this Net::Fritz::Device. This is the parsed form of the TR064 XML which describes the device, it's subdevices and Net::Fritz::Services.
An arrayref of all Net::Fritz::Services that are available on this device.
An arrayref of all subdevices (Net::Fritz::Device) that are available on this device.
A hashref that contains the most important information from the XML device description. This allows easier access than via "xmltree". The available attributes are device-dependent. The following attributes are made available as keys in the hashref if present in the XML:
deviceType
friendlyName
manufacturer
manufacturerURL
modelDescription
modelName
modelNumber
modelURL
UDN
presentationURL
See "error" in Net::Fritz::IsNoError.
Creates a new Net::Fritz::Device object. You propably don't have to call this method, it's mostly used internally. Expects parameters in key => value form with the following keys:
key => value
Net::Fritz::Box configuration object
device information in parsed XML format
Returns the Net::Fritz::Service whose serviceType equals name.
If no matching service is found, the subdevices are searched for the service in the order they are listed in the device XML, depth first.
If no matching service is found, a Net::Fritz::Error is returned.
Returns the Net::Fritz::Service whose serviceType matches regexp.
Returns all Net::Fritz::Services whose serviceType match regexp.
Searches recursively through all subdevices in the order they are listed in the device XML, depth first.
The resulting arrayref is wrapped in a Net::Fritz::Data to allow error checking. (Although no error should ever occur, an an empty list is returned if nothing matched.)
Returns the Net::Fritz::Device subdevice whose deviceType equals name.
If no matching service is found, the subdevices are searched for the deviceType in the order they are listed in the device XML, depth first.
If no matching device is found, a Net::Fritz::Error is returned.
Directly calls the Net::Fritz::Action named action_name of the Net::Fritz::Service matching the regular expression service_name.
This is a convenience method that internally calls find_service() followed by Net::Fritz::Service::call - see those methods for further details.
The intermediate Net::Fritz::Service is cached, so that further calls to the same service_name only need to do one instead of two SOAP requests.
This method is available since v0.0.8.
v0.0.8
Returns some preformatted multiline information about the object. Useful for debugging purposes, printing or logging. The optional parameter indent is used for indentation of the output by prepending it to every line.
Recursively descends into subdevices and services, so dumping the root device of a "discover" in Net::Fritz::Box should show everything that is available.
See "errorcheck" in Net::Fritz::IsNoError.
TODO: Method names are inconsistent: With services, get_* uses exact matching while find_* uses regexp matching. But with devices, find_device() uses exact matching. Change this to match the service methods and add the missing variants.
get_*
find_*
TODO: Rename find_service_names() to something like find_all_services() as it's basically find_service() with multiple results. It does not return service names but services.
find_all_services()
See Net::Fritz for general information about this package, especially "INTERFACE" in Net::Fritz for links to the other classes.
Christian Garbs <mitch@cgarbs.de>
Copyright (C) 2017 Christian Garbs
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
To install Net::Fritz, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Fritz
CPAN shell
perl -MCPAN -e shell install Net::Fritz
For more information on module installation, please visit the detailed CPAN module installation guide.