示例#1
0
void dlr_upnp_get_icon(dlr_upnp_t *upnp, dlr_task_t *task,
		       dlr_upnp_task_complete_t cb)
{
	dlr_device_t *device;
	dlr_async_task_t *cb_data = (dlr_async_task_t *)task;

	DLEYNA_LOG_DEBUG("Enter");

	device = dlr_device_from_path(task->path, upnp->server_udn_map);

	if (!device) {
		DLEYNA_LOG_WARNING("Cannot locate device");

		cb_data->cb = cb;
		cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
					     DLEYNA_ERROR_OBJECT_NOT_FOUND,
					     "Cannot locate a device for the specified object");

		(void) g_idle_add(dlr_async_task_complete, cb_data);
	} else {
		dlr_device_get_icon(device, task, cb);
	}

	DLEYNA_LOG_DEBUG("Exit");
}
示例#2
0
void dlr_upnp_set_prop(dlr_upnp_t *upnp, dlr_task_t *task,
		       dlr_upnp_task_complete_t cb)
{
	dlr_device_t *device;
	dlr_async_task_t *cb_data = (dlr_async_task_t *)task;

	device = dlr_device_from_path(task->path, upnp->server_udn_map);

	if (!device) {
		cb_data->cb = cb;
		cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
					     DLEYNA_ERROR_OBJECT_NOT_FOUND,
					     "Cannot locate a device for the specified object");

		(void) g_idle_add(dlr_async_task_complete, cb_data);
	} else {
		dlr_device_set_prop(device, task, cb);
	}
}
示例#3
0
static const gchar *prv_get_device_id(const gchar *object, GError **error)
{
	dlr_device_t *device;

	device = dlr_device_from_path(object,
				dlr_upnp_get_server_udn_map(g_context.upnp));


	if (!device) {
		DLEYNA_LOG_WARNING("Cannot locate device for %s", object);

		*error = g_error_new(DLEYNA_SERVER_ERROR,
				     DLEYNA_ERROR_OBJECT_NOT_FOUND,
				     "Cannot locate device corresponding to the specified path");
		goto on_error;
	}

	return device->path;

on_error:

	return NULL;
}