php-upnp/src/SSDP/SearchTarget.php

36 lines
1.1 KiB
PHP

<?php
namespace NoccyLabs\UPnP\SSDP;
class SearchTarget
{
// Common
const ALL = "ssdp:all"; // Search for all devices and services
const ROOT_DEVICE = "upnp:rootdevice"; // Search for root devices only
// Device schemas
const URN_SCHEMA_DEVICE_IGD_1 = "urn:schemas-upnp-org:device:InternetGatewayDevice:2";
const URN_SCHEMA_DEVICE_IGD_2 = "urn:schemas-upnp-org:device:InternetGatewayDevice:2";
// Helpers to generate targets
public static function UUID($device_uuid)
{ return sprintf("uuid:%s", $device_uuid); }
public static function URN_SCHEMA_DEVICE($type, $version)
{ return sprintf("urn:schemas-upnp-org:device:%s:%d", $type, $version); }
public static function URN_SCHEMA_SERVICE($type, $version)
{ return sprintf("urn:schemas-upnp-org:service:%s:%d", $type, $version); }
public static function URN_DEVICE($domain, $type, $version)
{ return sprintf("urn:%s:device:%s:%d", $domain, $type, $version); }
public static function URN_SERVICE($domain, $type, $version)
{ return sprintf("urn:%s:service:%s:%d", $domain, $type, $version); }
}