Exemplo n.º 1
0
}

static gboolean get_channel(const GDBusPropertyTable *property,
					DBusMessageIter *iter, void *data)
{
	struct obc_session *session = data;

	dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE,
							&session->channel);

	return TRUE;
}

static const GDBusMethodTable session_methods[] = {
	{ GDBUS_ASYNC_METHOD("GetCapabilities",
				NULL, GDBUS_ARGS({ "capabilities", "s" }),
				get_capabilities) },
	{ }
};

static gboolean get_target(const GDBusPropertyTable *property,
					DBusMessageIter *iter, void *data)
{
	struct obc_session *session = data;

	if (session->driver->uuid == NULL)
		return FALSE;

	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
						&session->driver->uuid);
Exemplo n.º 2
0
Arquivo: object.c Projeto: intgr/bluez
						DBUS_ERROR_UNKNOWN_PROPERTY,
						"No such property '%s'", name);

	propdata = g_new(struct property_data, 1);
	propdata->id = next_pending_property++;
	propdata->message = dbus_message_ref(message);
	pending_property_set = g_slist_prepend(pending_property_set, propdata);

	property->set(property, &sub, propdata->id, iface->user_data);

	return NULL;
}

static const GDBusMethodTable properties_methods[] = {
	{ GDBUS_METHOD("Get",
			GDBUS_ARGS({ "interface", "s" }, { "name", "s" }),
			GDBUS_ARGS({ "value", "v" }),
			properties_get) },
	{ GDBUS_ASYNC_METHOD("Set",
			GDBUS_ARGS({ "interface", "s" }, { "name", "s" },
							{ "value", "v" }),
			NULL,
			properties_set) },
	{ GDBUS_METHOD("GetAll",
			GDBUS_ARGS({ "interface", "s" }),
			GDBUS_ARGS({ "properties", "a{sv}" }),
			properties_get_all) },
	{ }
};

static const GDBusSignalTable properties_signals[] = {
Exemplo n.º 3
0
			g_assert(FALSE);
			return __connman_error_invalid_arguments(msg);
		}
		dbus_message_iter_next(&array);
	}

	if (session->notify != NULL)
		session->notify(session);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable notify_methods[] = {
	{ GDBUS_METHOD("Release", NULL, NULL, notify_release) },
	{ GDBUS_METHOD("Update",
			GDBUS_ARGS({ "settings", "a{sv}" }), NULL,
			notify_update) },
	{ },
};

int session_notify_register(struct test_session *session,
				const char *notify_path)
{
	if (g_dbus_register_interface(session->connection, notify_path,
			CONNMAN_NOTIFICATION_INTERFACE,
			notify_methods, NULL, NULL,
			session, NULL) == FALSE) {
		return -EINVAL;
	}

	return 0;
Exemplo n.º 4
0
	dbus_message_iter_get_basic(&args, &match.path);

	match.owner = dbus_message_get_sender(msg);

	ad = queue_find(manager->ads, match_advertisement, &match);
	if (!ad)
		return btd_error_does_not_exist(msg);

	advertisement_remove(ad);

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable methods[] = {
	{ GDBUS_EXPERIMENTAL_ASYNC_METHOD("RegisterAdvertisement",
					GDBUS_ARGS({ "advertisement", "o" },
							{ "options", "a{sv}" }),
					NULL, register_advertisement) },
	{ GDBUS_EXPERIMENTAL_ASYNC_METHOD("UnregisterAdvertisement",
						GDBUS_ARGS({ "service", "o" }),
						NULL,
						unregister_advertisement) },
	{ }
};

static void advertising_manager_destroy(void *user_data)
{
	struct btd_advertising *manager = user_data;

	queue_destroy(manager->ads, advertisement_destroy);

	mgmt_unref(manager->mgmt);
Exemplo n.º 5
0
	return NULL;
}

static const GDBusPropertyTable descriptor_properties[] = {
	{ "UUID", "s", descriptor_get_uuid, NULL, NULL,
					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
	{ "Characteristic", "o", descriptor_get_characteristic, NULL, NULL,
					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
	{ "Value", "ay", descriptor_get_value, NULL, descriptor_value_exists,
					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
	{ }
};

static const GDBusMethodTable descriptor_methods[] = {
	{ GDBUS_EXPERIMENTAL_ASYNC_METHOD("ReadValue", NULL,
						GDBUS_ARGS({ "value", "ay" }),
						descriptor_read_value) },
	{ GDBUS_EXPERIMENTAL_ASYNC_METHOD("WriteValue",
						GDBUS_ARGS({ "value", "ay" }),
						NULL,
						descriptor_write_value) },
	{ }
};

static void descriptor_free(void *data)
{
	struct descriptor *desc = data;

	g_free(desc->path);
	free(desc);
}
Exemplo n.º 6
0
	struct ofono_modem *modem = data;
	struct hfp_data *hfp_data = ofono_modem_get_data(modem);
	const char *obj_path = ofono_modem_get_path(modem);

	g_dbus_unregister_interface(connection, obj_path, HFP_AGENT_INTERFACE);
	hfp_data->agent_registered = FALSE;

	g_hash_table_remove(modem_hash, hfp_data->handsfree_path);
	ofono_modem_remove(modem);

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable agent_methods[] = {
	{ GDBUS_ASYNC_METHOD("NewConnection",
				GDBUS_ARGS({ "fd", "h" }, { "version", "q" }),
				NULL, hfp_agent_new_connection) },
	{ GDBUS_METHOD("Release", NULL, NULL, hfp_agent_release) },
	{ }
};

static int hfp_hf_probe(const char *device, const char *dev_addr,
				const char *adapter_addr, const char *alias)
{
	struct ofono_modem *modem;
	struct hfp_data *data;
	char buf[256];

	/* We already have this device in our hash, ignore */
	if (g_hash_table_lookup(modem_hash, device) != NULL)
		return -EALREADY;
Exemplo n.º 7
0
		goto invalid;

	shutdown(GPOINTER_TO_INT(fd), SHUT_RDWR);

	g_hash_table_remove(connection_hash, device);

	return dbus_message_new_method_return(msg);

invalid:
	return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE ".Rejected",
					"Invalid arguments in method call");
}

static const GDBusMethodTable profile_methods[] = {
	{ GDBUS_ASYNC_METHOD("NewConnection",
				GDBUS_ARGS({ "device", "o"}, { "fd", "h"},
						{ "fd_properties", "a{sv}" }),
				NULL, profile_new_connection) },
	{ GDBUS_METHOD("Release", NULL, NULL, profile_release) },
	{ GDBUS_METHOD("Cancel", NULL, NULL, profile_cancel) },
	{ GDBUS_METHOD("RequestDisconnection",
				GDBUS_ARGS({"device", "o"}), NULL,
				profile_disconnection) },
	{ }
};

static void sim_state_watch(enum ofono_sim_state new_state, void *data)
{
	struct ofono_modem *modem = data;
	DBusConnection *conn = ofono_dbus_get_connection();

	if (new_state != OFONO_SIM_STATE_READY) {
Exemplo n.º 8
0
	if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
						DBUS_TYPE_INVALID) == FALSE)
		return btd_error_invalid_args(msg);

	if (g_str_equal(path, agent->path) == FALSE)
		return btd_error_does_not_exist(msg);

	if (!add_default_agent(agent))
		return btd_error_failed(msg, "Failed to set as default");

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable methods[] = {
	{ GDBUS_METHOD("RegisterAgent",
			GDBUS_ARGS({ "agent", "o"}, { "capability", "s" }),
			NULL, register_agent) },
	{ GDBUS_METHOD("UnregisterAgent", GDBUS_ARGS({ "agent", "o" }),
			NULL, unregister_agent) },
	{ GDBUS_METHOD("RequestDefaultAgent", GDBUS_ARGS({ "agent", "o" }),
			NULL, request_default ) },
	{ }
};

void btd_agent_init(void)
{
	agent_list = g_hash_table_new_full(g_str_hash, g_str_equal,
						NULL, agent_destroy);

	default_agents = queue_new();
Exemplo n.º 9
0
	struct media_folder *folder = mp->scope;

	if (folder == NULL)
		return FALSE;

	DBG("%u", folder->number_of_items);

	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
						&folder->number_of_items);

	return TRUE;
}

static const GDBusMethodTable media_folder_methods[] = {
	{ GDBUS_ASYNC_METHOD("Search",
			GDBUS_ARGS({ "string", "s" }, { "filter", "a{sv}" }),
			GDBUS_ARGS({ "folder", "o" }),
			media_folder_search) },
	{ GDBUS_ASYNC_METHOD("ListItems",
			GDBUS_ARGS({ "filter", "a{sv}" }),
			GDBUS_ARGS({ "items", "a{oa{sv}}" }),
			media_folder_list_items) },
	{ GDBUS_ASYNC_METHOD("ChangeFolder",
			GDBUS_ARGS({ "folder", "o" }), NULL,
			media_folder_change_folder) },
	{ }
};

static const GDBusPropertyTable media_folder_properties[] = {
	{ "Name", "s", get_folder_name, NULL, folder_name_exists,
					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
Exemplo n.º 10
0
	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
					OFONO_PROPERTIES_ARRAY_SIGNATURE,
					&dict);

	value = ussd_get_state_string(ussd);
	ofono_dbus_dict_append(&dict, "State", DBUS_TYPE_STRING, &value);

	dbus_message_iter_close_container(&iter, &dict);

	return reply;
}

static const GDBusMethodTable ussd_methods[] = {
	{ GDBUS_ASYNC_METHOD("Initiate",
			GDBUS_ARGS({ "command", "s" }),
			GDBUS_ARGS({ "result_name", "s" }, { "value", "v" }),
			ussd_initiate) },
	{ GDBUS_ASYNC_METHOD("Respond",
			GDBUS_ARGS({ "reply", "s" }),
			GDBUS_ARGS({ "result", "s" }),
			ussd_respond) },
	{ GDBUS_ASYNC_METHOD("Cancel", NULL, NULL, ussd_cancel) },
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			ussd_get_properties) },
	{ }
};

static const GDBusSignalTable ussd_signals[] = {
	{ GDBUS_SIGNAL("NotificationReceived",
Exemplo n.º 11
0
static DBusMessage *release_method(DBusConnection *dbus_conn,
					DBusMessage *message, void *user_data)
{
	DBG("");

	agent_registered = FALSE;
	g_dbus_unregister_interface(connection,
					AGENT_PATH, NEARD_AGENT_INTERFACE);

	return g_dbus_create_reply(message, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable neard_methods[] = {
{ GDBUS_ASYNC_METHOD("RequestOOB",
		GDBUS_ARGS({ "data", "a{sv}" }),
		GDBUS_ARGS({ "data", "a{sv}" }), request_oob_method) },
	{ GDBUS_ASYNC_METHOD("PushOOB",
		GDBUS_ARGS({ "data", "a{sv}"}), NULL, push_oob_method) },
	{ GDBUS_METHOD("Release", NULL, NULL, release_method) },
	{ },
};

static void cleanup_register_call(void)
{
	if (register_call != NULL) {
		dbus_pending_call_cancel(register_call);
		dbus_pending_call_unref(register_call);
		register_call = NULL;
	}
}
Exemplo n.º 12
0
				ERROR_INTERFACE ".InvalidArguments", NULL);

	sender = dbus_message_get_sender(message);
	if (g_str_equal(sender, obc_session_get_owner(session)) == FALSE)
		return g_dbus_create_error(message,
				ERROR_INTERFACE ".NotAuthorized",
				"Not Authorized");

	release_session(session);

	return dbus_message_new_method_return(message);
}

static const GDBusMethodTable client_methods[] = {
	{ GDBUS_ASYNC_METHOD("CreateSession",
			GDBUS_ARGS({ "destination", "s" }, { "args", "a{sv}" }),
			GDBUS_ARGS({ "session", "o" }), create_session) },
	{ GDBUS_ASYNC_METHOD("RemoveSession",
			GDBUS_ARGS({ "session", "o" }), NULL, remove_session) },
	{ }
};

static DBusConnection *conn = NULL;

static struct obc_module {
	const char *name;
	int (*init) (void);
	void (*exit) (void);
} modules[] = {
	{ "bluetooth", bluetooth_init, bluetooth_exit },
	{ "opp", opp_init, opp_exit },
Exemplo n.º 13
0
static GSList *g_drivers;

struct ofono_cdma_sms {
	const struct ofono_cdma_sms_driver *driver;
	void *driver_data;
	struct ofono_atom *atom;
};

static const GDBusMethodTable cdma_sms_manager_methods[] = {
	/* TODO */
	{ }
};

static const GDBusSignalTable cdma_sms_manager_signals[] = {
	{ GDBUS_SIGNAL("IncomingMessage",
			GDBUS_ARGS({ "message", "s"}, { "info", "a{sv}" })) },
	/* TODO */
	{ }
};

static void cdma_dispatch_text_message(struct ofono_cdma_sms *cdma_sms,
					const char *message,
					const char *oaddr)
{
	const char *path = __ofono_atom_get_path(cdma_sms->atom);
	DBusConnection *conn = ofono_dbus_get_connection();
	DBusMessage *signal;
	DBusMessageIter iter;
	DBusMessageIter dict;
	const char *signal_name;
Exemplo n.º 14
0
	auth = next_pending(serv_adapter);
	if (auth == NULL)
		goto done;

	auth->id = btd_request_authorization(get_address(serv_adapter),
							&auth->dst, auth->uuid,
							auth_cb, serv_adapter);

done:
	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable service_methods[] = {
	{ GDBUS_METHOD("AddRecord",
		GDBUS_ARGS({ "record", "s" }),
		GDBUS_ARGS({ "handle", "u" }),
		add_service_record) },
	{ GDBUS_METHOD("UpdateRecord",
		GDBUS_ARGS({ "handle", "u" }, { "record", "s" }), NULL,
		update_service_record) },
	{ GDBUS_METHOD("RemoveRecord",
		GDBUS_ARGS({ "handle", "u" }), NULL,
		remove_service_record) },
	{ GDBUS_ASYNC_METHOD("RequestAuthorization",
		GDBUS_ARGS({ "address", "s" }, { "handle", "u"}), NULL,
		request_authorization) },
	{ GDBUS_METHOD("CancelAuthorization",
		NULL, NULL, cancel_authorization) },
	{ }
};
Exemplo n.º 15
0
	if (obc_session_queue(map->session, transfer, buffer_cb, map, &err)) {
		map->msg = dbus_message_ref(message);
		return NULL;
	}

fail:
	reply = g_dbus_create_error(message, "org.openobex.Error.Failed", "%s",
								err->message);
	g_error_free(err);
	return reply;
}

static const GDBusMethodTable map_methods[] = {
	{ GDBUS_ASYNC_METHOD("SetFolder",
				GDBUS_ARGS({ "name", "string" }), NULL,
				map_setpath) },
	{ GDBUS_ASYNC_METHOD("GetFolderListing",
					GDBUS_ARGS({ "dummy", "a{ss}" }),
					GDBUS_ARGS({ "content", "s" }),
					map_get_folder_listing) },
	{ GDBUS_ASYNC_METHOD("GetMessageListing",
			GDBUS_ARGS({ "folder", "s" }, { "dummy", "a{ss}" }),
			GDBUS_ARGS({ "messages", "s" }),
			map_get_message_listing) },
	{ }
};

static void map_free(void *data)
{
	struct map_data *map = data;
Exemplo n.º 16
0
		return btd_error_invalid_args(msg);

	sender = dbus_message_get_sender(msg);

	player = media_adapter_find_player(adapter, sender, path);
	if (player == NULL)
		return btd_error_does_not_exist(msg);

	media_player_remove(player);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable media_methods[] = {
	{ GDBUS_METHOD("RegisterEndpoint",
		GDBUS_ARGS({ "endpoint", "o" }, { "properties", "a{sv}" }),
		NULL, register_endpoint) },
	{ GDBUS_METHOD("UnregisterEndpoint",
		GDBUS_ARGS({ "endpoint", "o" }), NULL, unregister_endpoint) },
	{ GDBUS_EXPERIMENTAL_METHOD("RegisterPlayer",
		GDBUS_ARGS({ "player", "o" }, { "properties", "a{sv}" }),
		NULL, register_player) },
	{ GDBUS_EXPERIMENTAL_METHOD("UnregisterPlayer",
		GDBUS_ARGS({ "player", "o" }), NULL, unregister_player) },
	{ },
};

static void path_free(void *data)
{
	struct media_adapter *adapter = data;
Exemplo n.º 17
0
	DBG("conn %p", conn);

	dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
							DBUS_TYPE_INVALID);

	err = __connman_private_network_release(path);
	if (err < 0)
		return __connman_error_failed(msg, -err);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable manager_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			get_properties) },
	{ GDBUS_ASYNC_METHOD("SetProperty",
			GDBUS_ARGS({ "name", "s" }, { "value", "v" }),
			NULL, set_property) },
	{ GDBUS_METHOD("GetTechnologies",
			NULL, GDBUS_ARGS({ "technologies", "a(oa{sv})" }),
			get_technologies) },
	{ GDBUS_DEPRECATED_METHOD("RemoveProvider",
			GDBUS_ARGS({ "provider", "o" }), NULL,
			remove_provider) },
	{ GDBUS_METHOD("GetServices",
			NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }),
			get_services) },
	{ GDBUS_DEPRECATED_ASYNC_METHOD("ConnectProvider",
			      GDBUS_ARGS({ "provider", "a{sv}" }),
		return btd_error_does_not_exist(msg);

	hradapter->watchers = g_slist_remove(hradapter->watchers, watcher);
	g_dbus_remove_watch(conn, watcher->id);

	if (g_slist_length(hradapter->watchers) == 0)
		g_slist_foreach(hradapter->devices, disable_measurement, 0);

	DBG("heartrate watcher [%s] unregistered", path);

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable heartrate_manager_methods[] = {
	{ GDBUS_METHOD("RegisterWatcher",
			GDBUS_ARGS({ "agent", "o" }), NULL,
			register_watcher) },
	{ GDBUS_METHOD("UnregisterWatcher",
			GDBUS_ARGS({ "agent", "o" }), NULL,
			unregister_watcher) },
	{ }
};

static gboolean property_get_location(const GDBusPropertyTable *property,
					DBusMessageIter *iter, void *data)
{
	struct heartrate *hr = data;
	char *loc;

	if (!hr->has_location)
		return FALSE;
Exemplo n.º 19
0
	dbus_message_ref(message);

	return NULL;

fail:
	reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
								gerr->message);
	g_error_free(gerr);
	return reply;

}

static const GDBusMethodTable session_methods[] = {
	{ GDBUS_METHOD("GetProperties",
				NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
				session_get_properties) },
	{ GDBUS_ASYNC_METHOD("GetCapabilities",
				NULL, GDBUS_ARGS({ "capabilities", "s" }),
				get_capabilities) },
	{ }
};

static gboolean session_queue_complete(gpointer data)
{
	struct obc_session *session = data;

	session_process_queue(session);

	session->queue_complete_id = 0;
Exemplo n.º 20
0
		struct btd_adapter *adapter = list->data;

		array[i] = (char *) adapter_get_path(adapter);
		i++;
	}
	dict_append_array(&dict, "Adapters", DBUS_TYPE_OBJECT_PATH, &array, i);
	g_free(array);

	dbus_message_iter_close_container(&iter, &dict);

	return reply;
}

static const GDBusMethodTable manager_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			get_properties) },
	{ GDBUS_METHOD("DefaultAdapter",
			NULL, GDBUS_ARGS({ "adapter", "o" }),
			default_adapter) },
	{ GDBUS_METHOD("FindAdapter",
			GDBUS_ARGS({ "pattern", "s" }),
			GDBUS_ARGS({ "adapter", "o" }),
			find_adapter) },
	{ GDBUS_DEPRECATED_METHOD("ListAdapters",
			NULL, GDBUS_ARGS({ "adapters", "ao" }),
			list_adapters) },
	{ }
};

static const GDBusSignalTable manager_signals[] = {
Exemplo n.º 21
0
	DBusMessageIter iter;

	reply = dbus_message_new_method_return(msg);
	if (!reply)
		return NULL;

	dbus_message_iter_init_append(reply, &iter);

	transport_get_properties(transport, &iter);

	return reply;
}

static const GDBusMethodTable transport_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			get_properties) },
	{ GDBUS_ASYNC_METHOD("Acquire",
			GDBUS_ARGS({ "access_type", "s" }),
			GDBUS_ARGS({ "fd", "h" }, { "mtu_r", "q" },
							{ "mtu_w", "q" } ),
			acquire) },
	{ GDBUS_ASYNC_METHOD("Release",
			GDBUS_ARGS({ "access_type", "s" }), NULL,
			release ) },
	{ GDBUS_ASYNC_METHOD("SetProperty",
			GDBUS_ARGS({ "name", "s" }, { "value", "v" }),
			NULL, set_property) },
	{ },
};
Exemplo n.º 22
0
					"Invalid arguments in method call");
		return;
	}

	if (a2dp->volume != volume)
		avrcp_set_volume(transport->device, volume);

	a2dp->volume = volume;

	g_dbus_pending_property_success(id);
}

static const GDBusMethodTable transport_methods[] = {
	{ GDBUS_ASYNC_METHOD("Acquire",
			NULL,
			GDBUS_ARGS({ "fd", "h" }, { "mtu_r", "q" },
							{ "mtu_w", "q" }),
			acquire) },
	{ GDBUS_ASYNC_METHOD("TryAcquire",
			NULL,
			GDBUS_ARGS({ "fd", "h" }, { "mtu_r", "q" },
							{ "mtu_w", "q" }),
			try_acquire) },
	{ GDBUS_ASYNC_METHOD("Release", NULL, NULL, release) },
	{ },
};

static const GDBusPropertyTable transport_properties[] = {
	{ "Device", "o", get_device },
	{ "UUID", "s", get_uuid },
	{ "Codec", "y", get_codec },
	{ "Configuration", "ay", get_configuration },
Exemplo n.º 23
0
	alert_adapters = g_slist_remove(alert_adapters, al_adapter);
	btd_adapter_unref(al_adapter->adapter);

	g_free(al_adapter);
}

static struct btd_profile alert_profile = {
	.name = "gatt-alert-server",
	.adapter_probe = alert_server_probe,
	.adapter_remove = alert_server_remove,
};

static const GDBusMethodTable alert_methods[] = {
	{ GDBUS_METHOD("RegisterAlert",
			GDBUS_ARGS({ "category", "s" },
				   { "agent", "o" }), NULL,
			register_alert) },
	{ GDBUS_METHOD("NewAlert",
			GDBUS_ARGS({ "category", "s" },
				   { "count", "q" },
				   { "description", "s" }), NULL,
			new_alert) },
	{ GDBUS_METHOD("UnreadAlert",
			GDBUS_ARGS({ "category", "s" }, { "count", "q" }), NULL,
			unread_alert) },
	{ }
};

static int alert_server_init(void)
{
	if (!g_dbus_register_interface(btd_get_dbus_connection(),
Exemplo n.º 24
0
	if (ecall_session != NULL && ecall_session != session)
		return __connman_error_failed(msg, EBUSY);

	session_disconnect(session);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable session_methods[] = {
	{ GDBUS_METHOD("Destroy", NULL, NULL, destroy_session) },
	{ GDBUS_METHOD("Connect", NULL, NULL, connect_session) },
	{ GDBUS_METHOD("Disconnect", NULL, NULL,
			disconnect_session ) },
	{ GDBUS_METHOD("Change",
			GDBUS_ARGS({ "name", "s" }, { "value", "v" }),
			NULL, change_session) },
	{ },
};

static int session_create_cb(struct connman_session *session,
				struct connman_session_config *config,
				void *user_data, int err)
{
	DBusMessage *reply;
	struct user_config *user_config = user_data;
	struct session_info *info, *info_last;

	DBG("session %p config %p", session, config);

	if (err != 0)
Exemplo n.º 25
0
	if (gnss->posr_agent == NULL)
		return __ofono_error_not_available(msg);

	if (!gnss_agent_sender_matches(gnss->posr_agent, caller))
		return __ofono_error_access_denied(msg);

	gnss->pending = dbus_message_ref(msg);

	gnss->driver->send_element(gnss, xml, gnss_send_element_cb, gnss);

	return NULL;
}

static const GDBusMethodTable gnss_methods[] = {
	{ GDBUS_ASYNC_METHOD("SendPositioningElement",
			GDBUS_ARGS({ "xml_element" "s" }), NULL,
			gnss_send_element) },
	{ GDBUS_ASYNC_METHOD("RegisterPositioningRequestAgent",
			GDBUS_ARGS({ "agent", "o" }), NULL,
			gnss_register_agent) },
	{ GDBUS_ASYNC_METHOD("UnregisterPositioningRequestAgent",
			GDBUS_ARGS({ "agent", "o" }), NULL,
			gnss_unregister_agent) },
	{ }
};

static void gnss_unregister(struct ofono_atom *atom)
{
	struct ofono_gnss *gnss = __ofono_atom_get_data(atom);
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(atom);
Exemplo n.º 26
0
	if (!os)
		return invalid_args(msg);

	sender = dbus_message_get_sender(msg);
	if (strcmp(agent->bus_name, sender) != 0)
		return not_authorized(msg);

	os->aborted = TRUE;

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable manager_methods[] = {
	{ GDBUS_METHOD("RegisterAgent",
			GDBUS_ARGS({ "agent", "o" }), NULL, register_agent) },
	{ GDBUS_METHOD("UnregisterAgent",
			GDBUS_ARGS({ "agent", "o" }), NULL, unregister_agent) },
	{ }
};

static const GDBusSignalTable manager_signals[] = {
	{ GDBUS_SIGNAL("TransferStarted", GDBUS_ARGS({ "transfer", "o"})) },
	{ GDBUS_SIGNAL("TransferCompleted", GDBUS_ARGS({ "transfer", "o" },
							{ "success", "b" })) },
	{ GDBUS_SIGNAL("SessionCreated", GDBUS_ARGS({ "session", "o" })) },
	{ GDBUS_SIGNAL("SessionRemoved", GDBUS_ARGS({ "session", "o" })) },
	{ }
};

static const GDBusMethodTable transfer_methods[] = {
Exemplo n.º 27
0
		g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);

		err = set_powered(conn, mgr, powered);
		if (err < 0)
			return NULL;

		return NULL;
	}

	return __dbus_error_invalid_args(msg);
}

static const GDBusMethodTable manager_methods[] = {
	{ GDBUS_METHOD("GetProperties",
		NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
		manager_get_properties) },
	{ GDBUS_ASYNC_METHOD("SetProperty",
		GDBUS_ARGS({ "property", "s" }, { "value", "v" }),
		NULL, manager_set_property) },
	{ }
};

static const GDBusSignalTable manager_signals[] = {
	{ GDBUS_SIGNAL("PropertyChanged",
		GDBUS_ARGS({ "property", "s" }, { "value", "v" })) },
	{ }
};

static void log_handler(const char *message, void *user_data)
{
Exemplo n.º 28
0
	if (agent_if->pending_reply != NULL) {
		dbus_message_unref(agent_if->pending_reply);
		agent_if->pending_reply = NULL;
	}

	if (agent_if->cancel_cb != NULL)
		agent_if->cancel_cb();

reply:
	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static GDBusMethodTable agent_methods[] = {
	{ GDBUS_METHOD("Release", NULL, NULL, agent_release_method) },
	{ GDBUS_ASYNC_METHOD("ReportError",
			GDBUS_ARGS({"service", "o"}, {"error", "s"}),
			NULL, agent_report_error_method) },
	{ GDBUS_ASYNC_METHOD("RequestBrowser",
			GDBUS_ARGS({"service", "o"}, {"url", "s"}),
			NULL, agent_request_browser_method) },
	{ GDBUS_ASYNC_METHOD("RequestInput",
			GDBUS_ARGS({"service", "o"}, {"fields", "a{sv}"}),
			GDBUS_ARGS({"inputs", "a{sv}"}),
			agent_request_input_method) },
	{ GDBUS_METHOD("Cancel", NULL, NULL, agent_cancel_method) },
	{ NULL },
};

static inline void send_agent_reply(DBusMessage *reply)
{
	if (reply == NULL)
Exemplo n.º 29
0
	/* Store msg to request struct to allow multiple parallel requests */
	req->pending = dbus_message_ref(msg);
	raw->driver->request(raw, req, ofono_oem_raw_query_cb, req);

	return NULL;

error_arg:
	DBG("DBus arg type=%c, msg signature: %s",
		dbus_message_iter_get_arg_type(&iter),
		dbus_message_get_signature(msg));
	return __ofono_error_invalid_args(msg);
}

static const GDBusMethodTable oem_raw_methods[] = {
	{ GDBUS_ASYNC_METHOD("Send",
			GDBUS_ARGS({ "req", "ay" }),
			GDBUS_ARGS({ "response", "ay"}),
			oem_raw_make_request) },
	{ }
};

static const GDBusSignalTable oem_raw_signals[] = {
	{ }
};

static void oem_raw_dbus_unregister(struct ofono_atom *atom)
{
	DBG("");
	struct ofono_oem_raw *oemraw = __ofono_atom_get_data(atom);
	const char *path = __ofono_atom_get_path(oemraw->atom);
	DBusConnection *conn = ofono_dbus_get_connection();
Exemplo n.º 30
0
		ofono_dbus_dict_append(&dict, "SystemIdentifier",
						DBUS_TYPE_STRING,
						&cdma_netreg->sid);

	if (cdma_netreg->provider_name)
		ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING,
						&cdma_netreg->provider_name);

	dbus_message_iter_close_container(&iter, &dict);

	return reply;
}

static const GDBusMethodTable cdma_netreg_manager_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			network_get_properties) },
	{ }
};

static const GDBusSignalTable cdma_netreg_manager_signals[] = {
	{ }
};

static void serving_system_callback(const struct ofono_error *error,
					const char *sid, void *data)
{
	struct ofono_cdma_netreg *cdma_netreg = data;
	const char *path = __ofono_atom_get_path(cdma_netreg->atom);
	DBusConnection *conn = ofono_dbus_get_connection();