Ejemplo n.º 1
0
static void prv_dlr_method_call(dleyna_connector_id_t conn,
				const gchar *sender, const gchar *object,
				const gchar *interface,
				const gchar *method, GVariant *parameters,
				dleyna_connector_msg_id_t invocation)
{
	dlr_task_t *task;

	DLEYNA_LOG_INFO("Calling %s method", method);

	if (!strcmp(method, DLR_INTERFACE_RELEASE)) {
		g_context.connector->unwatch_client(sender);
		prv_remove_client(sender);
		g_context.connector->return_response(invocation, NULL);
	} else {
		if (!strcmp(method, DLR_INTERFACE_GET_VERSION))
			task = dlr_task_get_version_new(invocation);
		else if (!strcmp(method, DLR_INTERFACE_GET_SERVERS))
			task = dlr_task_get_servers_new(invocation);
		else
			goto finished;

		prv_add_task(task, sender, DLR_RENDERER_SINK);
	}

finished:

	return;
}
Ejemplo n.º 2
0
static void prv_dlr_push_host_method_call(dleyna_connector_id_t conn,
					  const gchar *sender,
					  const gchar *object,
					  const gchar *interface,
					  const gchar *method,
					  GVariant *parameters,
					  dleyna_connector_msg_id_t invocation)
{
	dlr_task_t *task;
	const gchar *device_id;
	GError *error = NULL;

	device_id = prv_get_device_id(object, &error);
	if (!device_id) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto on_error;
	}

	if (!strcmp(method, DLR_INTERFACE_HOST_FILE))
		task = dlr_task_host_uri_new(invocation, object, sender,
					     parameters);
	else if (!strcmp(method, DLR_INTERFACE_REMOVE_FILE))
		task = dlr_task_remove_uri_new(invocation, object, sender,
					       parameters);
	else
		goto on_error;

	prv_add_task(task, sender, device_id);

on_error:

	return;
}
Ejemplo n.º 3
0
static void prv_dlr_device_method_call(dleyna_connector_id_t conn,
				       const gchar *sender,
				       const gchar *object,
				       const gchar *interface,
				       const gchar *method,
				       GVariant *parameters,
				       dleyna_connector_msg_id_t invocation)
{
	dlr_task_t *task;
	const gchar *device_id;
	GError *error = NULL;

	device_id = prv_get_device_id(object, &error);
	if (!device_id) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto finished;
	}

	if (!strcmp(method, DLR_INTERFACE_RAISE))
		task = dlr_task_raise_new(invocation);
	else if (!strcmp(method, DLR_INTERFACE_QUIT))
		task = dlr_task_quit_new(invocation);
	else
		goto finished;

	prv_add_task(task, sender, device_id);

finished:

	return;
}
Ejemplo n.º 4
0
static void prv_manager_root_method_call(dleyna_connector_id_t conn,
				const gchar *sender, const gchar *object,
				const gchar *interface,
				const gchar *method, GVariant *parameters,
				dleyna_connector_msg_id_t invocation)
{
	dld_task_t *task;

	DLEYNA_LOG_INFO("Calling %s method", method);

	if (!strcmp(method, DLD_INTERFACE_RELEASE)) {
		g_context.connector->unwatch_client(sender);
		prv_remove_client(sender);
		g_context.connector->return_response(invocation, NULL);

		goto finished;
	} else  {
		if (!strcmp(method, DLD_INTERFACE_GET_VERSION))
			task = dld_task_get_version_new(invocation);
		else if (!strcmp(method, DLD_INTERFACE_GET_DEVICES))
			task = dld_task_get_devices_new(invocation);
		else if (!strcmp(method, DLD_INTERFACE_RESCAN))
			task = dld_task_rescan_new(invocation);
		else
			goto finished;
	}

	prv_add_task(task, sender, DLD_DIAGNOSTICS_SINK);

finished:
	return;
}
Ejemplo n.º 5
0
static void prv_manager_root_method_call(
				dleyna_connector_id_t conn,
				const gchar *sender, const gchar *object,
				const gchar *interface,
				const gchar *method, GVariant *parameters,
				dleyna_connector_msg_id_t invocation)
{
	dls_task_t *task;

	if (!strcmp(method, DLS_INTERFACE_RELEASE)) {
		prv_remove_client(sender);
		g_context.connector->return_response(invocation, NULL);
		goto finished;
	} else if (!strcmp(method, DLS_INTERFACE_RESCAN)) {
		task = dls_task_rescan_new(invocation);
	} else if (!strcmp(method, DLS_INTERFACE_GET_VERSION)) {
		task = dls_task_get_version_new(invocation);
	} else if (!strcmp(method, DLS_INTERFACE_GET_SERVERS)) {
		task = dls_task_get_servers_new(invocation);
	} else if (!strcmp(method, DLS_INTERFACE_SET_PROTOCOL_INFO)) {
		task = dls_task_set_protocol_info_new(invocation,
						      parameters);
	} else if (!strcmp(method, DLS_INTERFACE_PREFER_LOCAL_ADDRESSES)) {
		task = dls_task_prefer_local_addresses_new(invocation,
							   parameters);
	} else {
		goto finished;
	}

	prv_add_task(task, sender, DLS_SERVER_SINK);

finished:

	return;
}
Ejemplo n.º 6
0
static void prv_props_method_call(dleyna_connector_id_t conn,
				  const gchar *sender,
				  const gchar *object,
				  const gchar *interface,
				  const gchar *method,
				  GVariant *parameters,
				  dleyna_connector_msg_id_t invocation)
{
	dls_task_t *task;
	GError *error = NULL;

	if (!strcmp(method, DLS_INTERFACE_GET_ALL))
		task = dls_task_get_props_new(invocation, object,
					      parameters, &error);
	else if (!strcmp(method, DLS_INTERFACE_GET))
		task = dls_task_get_prop_new(invocation, object,
					     parameters, &error);
	else
		goto finished;

	if (!task) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto finished;
	}

	prv_add_task(task, sender, task->target.device->path);

finished:

	return;
}
Ejemplo n.º 7
0
static void prv_item_method_call(dleyna_connector_id_t conn,
				 const gchar *sender,
				 const gchar *object,
				 const gchar *interface,
				 const gchar *method,
				 GVariant *parameters,
				 dleyna_connector_msg_id_t invocation)
{
	dls_task_t *task;
	GError *error = NULL;

	if (!strcmp(method, DLS_INTERFACE_GET_COMPATIBLE_RESOURCE)) {
		task = dls_task_get_resource_new(invocation, object,
						 parameters, &error);

		if (!task) {
			g_context.connector->return_error(invocation, error);
			g_error_free(error);

			goto finished;
		}

		prv_add_task(task, sender, task->target.device->path);
	}

finished:

	return;
}
Ejemplo n.º 8
0
static void prv_dlr_player_method_call(dleyna_connector_id_t conn,
				       const gchar *sender,
				       const gchar *object,
				       const gchar *interface,
				       const gchar *method,
				       GVariant *parameters,
				       dleyna_connector_msg_id_t invocation)
{
	dlr_task_t *task;
	const gchar *device_id;
	GError *error = NULL;

	device_id = prv_get_device_id(object, &error);
	if (!device_id) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto finished;
	}

	if (!strcmp(method, DLR_INTERFACE_PLAY))
		task = dlr_task_play_new(invocation, object);
	else if (!strcmp(method, DLR_INTERFACE_PAUSE))
		task = dlr_task_pause_new(invocation, object);
	else if (!strcmp(method, DLR_INTERFACE_PLAY_PAUSE))
		task = dlr_task_play_pause_new(invocation, object);
	else if (!strcmp(method, DLR_INTERFACE_STOP))
		task = dlr_task_stop_new(invocation, object);
	else if (!strcmp(method, DLR_INTERFACE_NEXT))
		task = dlr_task_next_new(invocation, object);
	else if (!strcmp(method, DLR_INTERFACE_PREVIOUS))
		task = dlr_task_previous_new(invocation, object);
	else if (!strcmp(method, DLR_INTERFACE_OPEN_URI))
		task = dlr_task_open_uri_new(invocation, object, parameters);
	else if (!strcmp(method, DLR_INTERFACE_OPEN_URI_EX))
		task = dlr_task_open_uri_ex_new(invocation, object, parameters);
	else if (!strcmp(method, DLR_INTERFACE_SEEK))
		task = dlr_task_seek_new(invocation, object, parameters);
	else if (!strcmp(method, DLR_INTERFACE_SET_POSITION))
		task = dlr_task_set_position_new(invocation, object,
						 parameters);
	else if (!strcmp(method, DLR_INTERFACE_GOTO_TRACK))
		task = dlr_task_goto_track_new(invocation, object, parameters);
	else
		goto finished;

	prv_add_task(task, sender, device_id);

finished:

	return;
}
Ejemplo n.º 9
0
static void prv_device_method_call(dleyna_connector_id_t conn,
				   const gchar *sender,
				   const gchar *object,
				   const gchar *interface,
				   const gchar *method,
				   GVariant *parameters,
				   dleyna_connector_msg_id_t invocation)
{
	dld_task_t *task;
	const gchar *device_id = NULL;
	GError *error = NULL;
	const dleyna_task_queue_key_t *queue_id;

	device_id = prv_get_device_id(object, &error);
	if (!device_id) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto finished;
	}

	if (!strcmp(method, DLD_INTERFACE_CANCEL)) {
		queue_id = dleyna_task_processor_lookup_queue(
							g_context.processor,
							sender, device_id);
		if (queue_id)
			dleyna_task_processor_cancel_queue(queue_id);

		g_context.connector->return_response(invocation, NULL);
	} else if (!strcmp(method, DLD_INTERFACE_GET_ICON)) {
		task = dld_task_get_icon_new(invocation, object, parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_GET_TEST_INFO)) {
		task = dld_task_get_test_info_new(invocation, object,
						  parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_CANCEL_TEST)) {
		task = dld_task_cancel_test_new(invocation, object,
						parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_PING)) {
		task = dld_task_ping_new(invocation, object, parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_GET_PING_RESULT)) {
		task = dld_task_get_ping_result_new(invocation, object,
						    parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_NSLOOKUP)) {
		task = dld_task_nslookup_new(invocation, object, parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_GET_NSLOOKUP_RESULT)) {
		task = dld_task_get_nslookup_result_new(invocation, object,
							parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_TRACEROUTE)) {
		task = dld_task_traceroute_new(invocation, object, parameters);
		prv_add_task(task, sender, device_id);
	} else if (!strcmp(method, DLD_INTERFACE_GET_TRACEROUTE_RESULT)) {
		task = dld_task_get_traceroute_result_new(invocation, object,
							  parameters);
		prv_add_task(task, sender, device_id);
	}

finished:

	return;
}
Ejemplo n.º 10
0
static void prv_device_method_call(dleyna_connector_id_t conn,
				   const gchar *sender,
				   const gchar *object,
				   const gchar *interface,
				   const gchar *method,
				   GVariant *parameters,
				   dleyna_connector_msg_id_t invocation)
{
	dls_task_t *task;
	GError *error = NULL;
	const gchar *device_id;
	const dleyna_task_queue_key_t *queue_id;

	if (!strcmp(method, DLS_INTERFACE_UPLOAD_TO_ANY)) {
		task = dls_task_upload_to_any_new(invocation,
						  object, parameters, &error);
	} else if (!strcmp(method, DLS_INTERFACE_CREATE_CONTAINER_IN_ANY)) {
		task = dls_task_create_container_new_generic(
					invocation,
					DLS_TASK_CREATE_CONTAINER_IN_ANY,
					object, parameters, &error);
	} else if (!strcmp(method, DLS_INTERFACE_GET_UPLOAD_STATUS)) {
		task = dls_task_get_upload_status_new(invocation,
						      object, parameters,
						      &error);
	} else if (!strcmp(method, DLS_INTERFACE_GET_UPLOAD_IDS)) {
		task = dls_task_get_upload_ids_new(invocation, object,
						   &error);
	} else if (!strcmp(method, DLS_INTERFACE_CANCEL_UPLOAD)) {
		task = dls_task_cancel_upload_new(invocation, object,
						  parameters, &error);
	} else if (!strcmp(method, DLS_INTERFACE_GET_ICON)) {
		task = dls_task_get_icon_new(invocation, object, parameters,
					     &error);
	} else if (!strcmp(method, DLS_INTERFACE_BROWSE_OBJECTS)) {
		task = dls_task_browse_objects_new(invocation, object,
						   parameters, &error);
	} else if (!strcmp(method, DLS_INTERFACE_WAKE)) {
		task = dls_task_wake_new(invocation, object, &error);
	} else if (!strcmp(method, DLS_INTERFACE_CANCEL)) {
		task = NULL;

		device_id = prv_get_device_id(object, &error);
		if (!device_id)
			goto on_error;

		queue_id = dleyna_task_processor_lookup_queue(
							g_context.processor,
							sender,
							device_id);
		if (queue_id)
			dleyna_task_processor_cancel_queue(queue_id);

		g_context.connector->return_response(invocation, NULL);

		goto finished;
	} else {
		goto finished;
	}

on_error:

	if (!task) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto finished;
	}

	prv_add_task(task, sender, task->target.device->path);

finished:

	return;
}
Ejemplo n.º 11
0
static void prv_con_method_call(dleyna_connector_id_t conn,
				const gchar *sender,
				const gchar *object,
				const gchar *interface,
				const gchar *method,
				GVariant *parameters,
				dleyna_connector_msg_id_t invocation)
{
	dls_task_t *task;
	GError *error = NULL;

	if (!strcmp(method, DLS_INTERFACE_LIST_CHILDREN))
		task = dls_task_get_children_new(invocation, object,
						 parameters, TRUE,
						 TRUE, &error);
	else if (!strcmp(method, DLS_INTERFACE_LIST_CHILDREN_EX))
		task = dls_task_get_children_ex_new(invocation, object,
						    parameters, TRUE,
						    TRUE, &error);
	else if (!strcmp(method, DLS_INTERFACE_LIST_ITEMS))
		task = dls_task_get_children_new(invocation, object,
						 parameters, TRUE,
						 FALSE, &error);
	else if (!strcmp(method, DLS_INTERFACE_LIST_ITEMS_EX))
		task = dls_task_get_children_ex_new(invocation, object,
						    parameters, TRUE,
						    FALSE, &error);
	else if (!strcmp(method, DLS_INTERFACE_LIST_CONTAINERS))
		task = dls_task_get_children_new(invocation, object,
						 parameters, FALSE,
						 TRUE, &error);
	else if (!strcmp(method, DLS_INTERFACE_LIST_CONTAINERS_EX))
		task = dls_task_get_children_ex_new(invocation, object,
						    parameters, FALSE,
						    TRUE, &error);
	else if (!strcmp(method, DLS_INTERFACE_SEARCH_OBJECTS))
		task = dls_task_search_new(invocation, object,
					   parameters, &error);
	else if (!strcmp(method, DLS_INTERFACE_SEARCH_OBJECTS_EX))
		task = dls_task_search_ex_new(invocation, object,
					      parameters, &error);
	else if (!strcmp(method, DLS_INTERFACE_UPLOAD))
		task = dls_task_upload_new(invocation, object,
					   parameters, &error);
	else if (!strcmp(method, DLS_INTERFACE_CREATE_CONTAINER))
		task = dls_task_create_container_new_generic(invocation,
						DLS_TASK_CREATE_CONTAINER,
						object, parameters, &error);
	else if (!strcmp(method, DLS_INTERFACE_GET_COMPATIBLE_RESOURCE))
		task = dls_task_get_resource_new(invocation, object,
						 parameters, &error);
	else if (!strcmp(method, DLS_INTERFACE_CREATE_REFERENCE))
		task = dls_task_create_reference_new(invocation,
						    DLS_TASK_CREATE_REFERENCE,
						    object, parameters, &error);
	else
		goto finished;

	if (!task) {
		g_context.connector->return_error(invocation, error);
		g_error_free(error);

		goto finished;
	}

	prv_add_task(task, sender, task->target.device->path);

finished:

	return;
}