function tvcontrol_device_proxy_available_cb($proxy, $arg) { printf("Device is available\n"); /* Get device info */ $info = gupnp_device_info_get($proxy); foreach ($info as $key => $value) { printf("\t%-30s: %s\n", $key, $value); } printf("\n"); gupnp_control_point_browse_stop($arg['cp']); }
function device_proxy_unavailable_cb($proxy, $arg) { $info = gupnp_device_info_get($proxy); $type = $info['device_type']; $location = $info['location']; printf("Device unavailable:\n"); printf("\ttype: %s\n", $type); printf("\tlocation: %s\n", $location); }
function gupnp_device_proxy_available_cb($proxy, $arg) { /* Get device info */ $info = gupnp_device_info_get($proxy); if ($info['friendly_name'] == 'MediaTomb') { printf("Device is available:\n"); foreach ($info as $key => $value) { printf("\t%-30s: %s\n", $key, $value); } printf("\n"); gupnp_control_point_browse_stop($arg['cp_device']); $arg_service = array('udn' => $info['udn'], 'cp_service' => $arg['cp_service']); $cb_service = "gupnp_service_proxy_available_cb"; gupnp_control_point_callback_set($arg['cp_service'], GUPNP_SIGNAL_SERVICE_PROXY_AVAILABLE, $cb_service, $arg_service); gupnp_control_point_browse_start($arg['cp_service']); } }
echo "---------------------------------------------------------\n"; $result = gupnp_root_device_get_available($device); echo "[RESULT]: "; var_dump($result); echo "=========================================================\n\n\n"; echo "=========================================================\n"; echo "[CALL]: gupnp_root_device_get_relative_location({$device}) \n"; echo "---------------------------------------------------------\n"; $result = gupnp_root_device_get_relative_location($device); echo "[RESULT]: "; var_dump($result); echo "=========================================================\n\n\n"; echo "=========================================================\n"; echo "[CALL]: gupnp_device_info_get({$device}) \n"; echo "---------------------------------------------------------\n"; $result = gupnp_device_info_get($device); echo "[RESULT]: "; var_dump($result); echo "=========================================================\n\n\n"; $service_type = "urn:schemas-upnp-org:service:SwitchPower:1"; echo "=========================================================\n"; echo "[CALL]: gupnp_device_info_get_service({$device}, {$service_type}) \n"; echo "---------------------------------------------------------\n"; $service_info = gupnp_device_info_get_service($device, $service_type); echo "[RESULT]: "; var_dump($service_info); echo "=========================================================\n\n\n"; $cb = "action_getstatus_cb"; $arg = "action data, GetStatus"; $action_name = "action-invoked::GetStatus"; echo "=========================================================\n";