1Net::UPnP::Service(3) User Contributed Perl DocumentationNet::UPnP::Service(3)
2
3
4
6 Net::UPnP::Service - Perl extension for UPnP.
7
9 use Net::UPnP::ControlPoint;
10
11 my $obj = Net::UPnP::ControlPoint->new();
12
13 @dev_list = $obj->search(st =>'upnp:rootdevice', mx => 3);
14
15 $devNum= 0;
16 foreach $dev (@dev_list) {
17 $device_type = $dev->getdevicetype();
18 if ($device_type ne 'urn:schemas-upnp-org:device:MediaServer:1') {
19 next;
20 }
21 print "[$devNum] : " . $dev->getfriendlyname() . "\n";
22 unless ($dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1')) {
23 next;
24 }
25 $condir_service = $dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1');
26 unless (defined(condir_service)) {
27 next;
28 }
29 %action_in_arg = (
30 'ObjectID' => 0,
31 'BrowseFlag' => 'BrowseDirectChildren',
32 'Filter' => '*',
33 'StartingIndex' => 0,
34 'RequestedCount' => 0,
35 'SortCriteria' => '',
36 );
37 $action_res = $condir_service->postcontrol('Browse', \%action_in_arg);
38 unless ($action_res->getstatuscode() == 200) {
39 next;
40 }
41 $actrion_out_arg = $action_res->getargumentlist();
42 unless ($actrion_out_arg->{'Result'}) {
43 next;
44 }
45 $result = $actrion_out_arg->{'Result'};
46 while ($result =~ m/<dc:title>(.*?)<\/dc:title>/sgi) {
47 print "\t$1\n";
48 }
49 $devNum++;
50 }
51
53 The package is used a object of UPnP service.
54
56 getdevice - get the device.
57 $description = $service->getdevice();
58
59 Get the parent device of the service.
60
61 getdevicedescription - get the service description of the device
62 description.
63 $description = $service->getdevicedescription(
64 name => $name # undef
65 );
66
67 Get the service description of the device description.
68
69 The function returns the all description when the name parameter is
70 not specified, otherwise return a value the specified name.
71
72 getservicetype - get the service type.
73 $service_type = $service->getservicetype();
74
75 Get the service type.
76
77 getserviceid - get the service id.
78 $service_id = $service->getserviceid();
79
80 Get the service id.
81
82 postaction - post a action control.
83 $action_res = $service->postcontrol($action_name, \%action_arg);
84
85 Post a action control to the device, and return
86 Net::UPnP::ActionResponse.
87
88 The method was renamed from postcontrol(), but the old name is
89 deprecated.
90
91 postquery - post a query control.
92 $query_res = $service->postcontrol($var_name);
93
94 Post a query control to the device, and return
95 Net::UPnP::QueryResponse.
96
98 Net::UPnP::ActionResponse
99
101 Satoshi Konno skonno@cybergarage.org
102
103 CyberGarage http://www.cybergarage.org
104
106 Copyright (C) 2005 by Satoshi Konno
107
108 It may be used, redistributed, and/or modified under the terms of BSD
109 License.
110
111
112
113perl v5.30.0 2019-07-26 Net::UPnP::Service(3)