PHP Doku:: Set control point callback - function.gupnp-control-point-callback-set.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige DiensteGupnpGupnp Funktionengupnp_control_point_callback_set

Ein Service von Reinhard Neidl - Webprogrammierung.

Gupnp Funktionen

<<gupnp_control_point_browse_stop

gupnp_control_point_new>>

gupnp_control_point_callback_set

(PECL gupnp >= 0.1.0)

gupnp_control_point_callback_setSet control point callback

Beschreibung

bool gupnp_control_point_callback_set ( resource $cpoint , int $signal , mixed $callback [, mixed $arg ] )

Set control point callback function for signal.

Parameter-Liste

cpoint

A control point identifier, returned by gupnp_control_point_new().

signal

The value of signal. Signal can be one of the following values:

GUPNP_SIGNAL_DEVICE_PROXY_AVAILABLE
Emitted whenever a new device has become available.
GUPNP_SIGNAL_DEVICE_PROXY_UNAVAILABLE
Emitted whenever a device is not available any more.
GUPNP_SIGNAL_SERVICE_PROXY_AVAILABLE
Emitted whenever a new service has become available.
GUPNP_SIGNAL_SERVICE_PROXY_UNAVAILABLE
Emitted whenever a service is not available any more.

callback

The callback function for the certain signal. Typically, callback function takes on two parameters. The proxy parameter's identifier being the first, and the arg second.

arg

User data for callback.

Rückgabewerte

Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.

Beispiele

Beispiel #1 Create new UPnP context and start browsing

<?php

function device_proxy_available_cb($proxy$arg)
{
    
$info gupnp_device_info_get($proxy);

    
$type $info['device_type'];
    
$location $info['location'];

    
printf("Device available:\n");
    
printf("type:     %s\n"$type);
    
printf("location: %s\n"$location);
}

/* Create the UPnP context */
$context gupnp_context_new();

if (!
$context) {
 die(
"Error creating the GUPnP context\n");
}

/* We're interested in everything */
$cp gupnp_control_point_new($context"ssdp:all");

gupnp_control_point_callback_set($cp
    
GUPNP_SIGNAL_DEVICE_PROXY_AVAILABLE'device_proxy_available_cb');

/* Start for browsing */
gupnp_control_point_browse_start($cp);

?>

Fehler/Exceptions

Issues E_WARNING with not valid callback function.

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)