public function getDevices($request) { Logger::debug(__METHOD__, self::$logfile); $service = isset($request['service']) ? $request['service'] : null; $this->respond(UPnP::getDevices($service)); }
break; case 'select': $f = '<select id="' . $name . '" name="params[' . $name . ']"' . ($readonly ? ' readonly="readonly"' : '') . '>'; if ($readonly) { $f .= '<option></option>'; } foreach ($field['options'] as $o) { $f .= '<option' . (isset($field['default']) && $field['default'] == $o ? ' selected="selected"' : '') . '>' . $o . '</option>'; } $f .= '</select>'; break; } $html = sprintf('<tr><td><label for="%s">%s</label></td><td>%s <small>(%s)</small></td></tr>', $name, $name, $f, $field['param']); return $html; } $devices = UPnP::getDevices(); $deviceList = array(); $device = null; $services = array(); $client = null; $actions = array(); $action = null; foreach ($devices as $uid => $data) { $device = UPnP::getDevice($uid); $icon = null; $name = $device->getName(); $icons = $device->getIcons(); if (count($icons) > 0) { $first = array_shift($icons); $icon = $first->url; }
error_reporting(0); ini_set('display_errors', false); use at\mkweb\upnp\backend\UPnP; function pr($value) { echo '<pre>'; print_r($value); echo '</pre>'; } require_once 'src/at/mkweb/upnp/init.php'; try { // Discover devices UPnP::findDevices(); // Subscribe or renew subscription to AVTransport $devices = UPnP::getDevices('AVTransport'); echo "Starting subscriptions\n"; foreach ($devices as $uid => $device) { echo "Checking subscription for " . $uid . "\n"; $device = UPnP::getDevice($uid); $current = $device->getSubscriptions(); if (count($current) > 0) { foreach ($current as $uid) { echo "Renew\n"; $device->unSubscribe($uid); $device->subscribe(); } } else { echo "Create\n"; $device->subscribe('AVTransport'); }