NAME

Net::Fritz::Service - represents a TR064 service

VERSION

version v0.0.7

SYNOPSIS

my $fritz    = Net::Fritz::Box->new();
my $device   = $fritz->discover();
my $service  = $device->get_service('DeviceInfo:1');

# call an action
my $response = $service->call('GetSecurityPort');

# show all data
$service->dump();

DESCRIPTION

This class represents a TR064 service belonging to a Net::Fritz::Device. A service consists of one or more Net::Fritz::Actions that interact with the underlying device.

ATTRIBUTES (read-only)

fritz

A Net::Fritz::Box instance containing the current configuration information (device address, authentication etc.).

xmltree

A complex hashref containing most information about this Net::Fritz::Service. This is the parsed form of the TR064 XML which describes the service. It contains nearly all information besides "fritz" and "scpd".

scpd

A complex hashref containing all information about this Net::Fritz::Service. This is the parsed form of the XML available at "SCPDURL" which describes the service and its Net::Fritz::Actions.

action_hash

A hashref containing all Net::Fritz::Actions of this service indexed by their "name" in Net::Fritz::Action.

The serviceType (string) of this service which is used by Net::Fritz::Device to look up services.

The serviceId (string) of this service.

The controlURL (URL string) of this service which is needed to "call" any Net::Fritz::Actions of this service.

The eventSubURL (URL string) of this service for subscribing to or unsubscribing from events.

SCPDURL

The SCPDURL (URL string) of the SCPD file of this service where most of the other attributes are read from.

error

See "error" in Net::Fritz::IsNoError.

METHODS

new

Creates a new Net::Fritz::Service 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:

fritz

Net::Fritz::Box configuration object

xmltree

service information in parsed XML format

call(action_name [parameter = value] [...])

Calls the Net::Fritz::Action named action_name of this service. Response data from the service call is wrapped as Net::Fritz::Data. If the action expects parameters, they must be passed as key=gtvalue pairs.

If no matching action is found, the parameters don't match the action or any other error occurs, a Net::Fritz::Error is returned.

dump(indent)

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 actions, so dumping a service also shows all its actions as well.

errorcheck

See "errorcheck" in Net::Fritz::IsNoError.

SEE ALSO

See Net::Fritz for general information about this package, especially "INTERFACE" in Net::Fritz for links to the other classes.

AUTHOR

Christian Garbs <mitch@cgarbs.de>

COPYRIGHT AND LICENSE

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/>.