1Net::UPnP::ControlPointU(s3e)r Contributed Perl DocumentaNteito:n:UPnP::ControlPoint(3)
2
3
4
6 Net::UPnP::ControlPoint - Perl extension for UPnP control point.
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 $actrion_out_arg = $action_res->getargumentlist();
39 unless ($actrion_out_arg->{'Result'}) {
40 next;
41 }
42 $result = $actrion_out_arg->{'Result'};
43 while ($result =~ m/<dc:title>(.*?)<\/dc:title>/sgi) {
44 print "\t$1\n";
45 }
46 $devNum++;
47 }
48
50 The package can search UPnP devices in the local network and get the
51 device list of Net::UPnP::Device.
52
54 new - create new Net::UPnP::ControlPoint
55 $ctrlPoint = Net::UPnP::ControlPoint();
56
57 Creates a new object. Read `perldoc perlboot` if you don't
58 understand that.
59
60 search - search UPnP devices
61 @device_list = $ctrlPoint->search();
62
63 @device_list = $ctrlPoint->search(
64 [st => $search_target], # 'upnp:rootdevice'
65 [mx => $maximum_wait] # 3
66 );
67
68 Search UPnP devices and return the device list. Please see
69 Net::UPnP::Device too.
70
72 Net::UPnP::Device
73
75 Satoshi Konno skonno@cybergarage.org
76
77 CyberGarage http://www.cybergarage.org
78
80 Copyright (C) 2005 by Satoshi Konno
81
82 It may be used, redistributed, and/or modified under the terms of BSD
83 License.
84
85
86
87perl v5.38.0 2023-07-21 Net::UPnP::ControlPoint(3)