NAME

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

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.

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.

COPYRIGHT

Copyright (C) 2015 by Christian Garbs <mitch@cgarbs.de>

LICENSE

Licensed under GNU GPL v2 or later, see <http://www.gnu.org/licenses/gpl-2.0-standalone.html>

AUTHOR

Christian Garbs <mitch@cgarbs.de>

SEE ALSO

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