Exemple #1
0
}

static gboolean control_property_get_connected(
					const GDBusPropertyTable *property,
					DBusMessageIter *iter, void *data)
{
	struct control *control = data;
	dbus_bool_t value = (control->session != NULL);

	dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value);

	return TRUE;
}

static const GDBusMethodTable control_methods[] = {
	{ GDBUS_METHOD("Play", NULL, NULL, control_play) },
	{ GDBUS_METHOD("Pause", NULL, NULL, control_pause) },
	{ GDBUS_METHOD("Stop", NULL, NULL, control_stop) },
	{ GDBUS_METHOD("Next", NULL, NULL, control_next) },
	{ GDBUS_METHOD("Previous", NULL, NULL, control_previous) },
	{ GDBUS_METHOD("VolumeUp", NULL, NULL, control_volume_up) },
	{ GDBUS_METHOD("VolumeDown", NULL, NULL, control_volume_down) },
	{ GDBUS_METHOD("FastForward", NULL, NULL, control_fast_forward) },
	{ GDBUS_METHOD("Rewind", NULL, NULL, control_rewind) },
	{ }
};

static const GDBusPropertyTable control_properties[] = {
	{ "Connected", "b", control_property_get_connected },
	{ }
};
Exemple #2
0
			set_online(modem, FALSE);
			modem_change_state(modem, MODEM_STATE_POWER_OFF);
		}

		return NULL;
	}

	if (g_str_equal(name, "Lockdown"))
		return set_property_lockdown(modem, msg, &var);

	return __ofono_error_invalid_args(msg);
}

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

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

void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered)
{
Exemple #3
0
		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 DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,
								void *data)
{
	struct heartrate *hr = data;
	DBusMessageIter iter;
	DBusMessageIter dict;
	DBusMessage *reply;
	gboolean has_reset;
Exemple #4
0
	g_dbus_unregister_interface(conn, AD_PATH, AD_IFACE);
}

static DBusMessage *release_advertising(DBusConnection *conn,
					DBusMessage *msg, void *user_data)
{
	rl_printf("Advertising released\n");

	ad_release(conn);

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable ad_methods[] = {
	{ GDBUS_METHOD("Release", NULL, NULL, release_advertising) },
	{ }
};

static void register_setup(DBusMessageIter *iter, void *user_data)
{
	DBusMessageIter dict;
	const char *path = AD_PATH;

	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
				DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
				DBUS_TYPE_STRING_AS_STRING
				DBUS_TYPE_VARIANT_AS_STRING
				DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
	dbus_message_iter_close_container(iter, &dict);
Exemple #5
0
	return dbus_message_new_method_return(msg);

error:
	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_NOREPLY_METHOD("Release", NULL, NULL, profile_release) },
	{ GDBUS_METHOD("RequestDisconnection",
				GDBUS_ARGS({"device", "o"}), NULL,
				profile_disconnection) },
	{ }
};

static void connect_handler(DBusConnection *conn, void *user_data)
{
	uint16_t features = HFP_SDP_HF_FEATURE_ECNR |
				HFP_SDP_HF_FEATURE_3WAY |
				HFP_SDP_HF_FEATURE_CLIP |
				HFP_SDP_HF_FEATURE_REMOTE_VOLUME_CONTROL;

	/*
	 * Assuming that if defer_setup is supported, then SCO transparent
	 * mode is also supported
	*/
Exemple #6
0
	if (err < 0)
		return __connman_error_failed(msg, -err);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable manager_methods[] = {
	{ GDBUS_ASYNC_METHOD("Create",
			GDBUS_ARGS({ "properties", "a{sv}" }),
			GDBUS_ARGS({ "path", "o" }),
			create) },
	{ GDBUS_ASYNC_METHOD("Remove",
			GDBUS_ARGS({ "identifier", "o" }), NULL,
			remove) },
	{ GDBUS_METHOD("GetConnections", NULL,
			GDBUS_ARGS({ "connections", "a(oa{sv})" }),
			get_connections) },
	{ GDBUS_METHOD("RegisterAgent",
			GDBUS_ARGS({ "path", "o" }), NULL,
			register_agent) },
	{ GDBUS_METHOD("UnregisterAgent",
			GDBUS_ARGS({ "path", "o" }), NULL,
			unregister_agent) },
	{ },
};

static const GDBusSignalTable manager_signals[] = {
	{ GDBUS_SIGNAL("ConnectionAdded",
			GDBUS_ARGS({ "identifier", "o" },
				{ "properties", "a{sv}" })) },
	{ GDBUS_SIGNAL("ConnectionRemoved",
Exemple #7
0
	dbus_message_ref(message);

	return NULL;

fail:
	reply = g_dbus_create_error(message,
					"org.openobex.Error.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;
Exemple #8
0
	if (hf->pending)
		return __ofono_error_busy(msg);

	if (!hf->driver->request_phone_number)
		return __ofono_error_not_supported(msg);

	hf->pending = dbus_message_ref(msg);
	hf->driver->request_phone_number(hf, request_phone_number_cb, hf);

	return NULL;
}

static const GDBusMethodTable handsfree_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			handsfree_get_properties) },
	{ GDBUS_ASYNC_METHOD("SetProperty",
			GDBUS_ARGS({ "property", "s" }, { "value", "v" }),
			NULL, handsfree_set_property) },
	{ GDBUS_ASYNC_METHOD("RequestPhoneNumber",
			NULL, GDBUS_ARGS({ "number", "s" }),
			handsfree_request_phone_number) },
	{ }
};

static const GDBusSignalTable handsfree_signals[] = {
	{ GDBUS_SIGNAL("PropertyChanged",
			GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
	{ }
};
Exemple #9
0
}

static gboolean transfer_get_transferred(const GDBusPropertyTable *property,
					DBusMessageIter *iter, void *data)
{
	struct obex_transfer *transfer = data;
	struct obex_session *session = transfer->session;

	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT64,
							&session->offset);

	return TRUE;
}

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 GDBusMethodTable transfer_methods[] = {
	{ GDBUS_METHOD("Cancel", NULL, NULL, transfer_cancel) },
	{ }
};

static const GDBusPropertyTable transfer_properties[] = {
	{ "Status", "s", transfer_get_status },
	{ "Session", "o", transfer_get_session },
	{ "Name", "s", transfer_get_name, NULL, transfer_name_exists },
	{ "Type", "s", transfer_get_type, NULL, transfer_type_exists },
Exemple #10
0
	info->chat = NULL;

	return dbus_message_new_method_return(msg);

error:
	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 connect_handler(DBusConnection *conn, void *user_data)
{
	DBG("Registering External Profile handler ...");

	bt_register_profile(conn, HFP_HS_UUID, HFP_VERSION_1_6, "hfp_hf",
						HFP_EXT_PROFILE_PATH);
}
Exemple #11
0
					"Invalid signature for '%s'", name);

	propdata = g_new(struct property_data, 1);
	propdata->id = next_pending_property++;
	propdata->message = dbus_message_ref(message);
	propdata->conn = connection;
	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[] = {
	{ GDBUS_SIGNAL("PropertiesChanged",
Exemple #12
0
			void *data)
{
	set_status(property, iter, id, STATUS_READ, data);
}

static void set_deleted(const GDBusPropertyTable *property,
			DBusMessageIter *iter, GDBusPendingPropertySet id,
			void *data)
{
	set_status(property, iter, id, STATUS_DELETE, data);
}

static const GDBusMethodTable map_msg_methods[] = {
	{ GDBUS_METHOD("Get",
			GDBUS_ARGS({ "targetfile", "s" },
						{ "attachment", "b" }),
			GDBUS_ARGS({ "transfer", "o" },
						{ "properties", "a{sv}" }),
			map_msg_get) },
	{ }
};

static const GDBusPropertyTable map_msg_properties[] = {
	{ "Subject", "s", get_subject, NULL, subject_exists },
	{ "Timestamp", "s", get_timestamp, NULL, timestamp_exists },
	{ "Sender", "s", get_sender, NULL, sender_exists },
	{ "SenderAddress", "s", get_sender_address, NULL,
						sender_address_exists },
	{ "ReplyTo", "s", get_replyto, NULL, replyto_exists },
	{ "Recipient", "s", get_recipient, NULL, recipient_exists },
	{ "RecipientAddress", "s", get_recipient_address, NULL,
						recipient_address_exists },
Exemple #13
0
	DBG("%s", mgr->sender);

	if (strncmp(sender, mgr->sender, strlen(mgr->sender)))
		return error_permission_denied(msg);

	/* remove it */
	near_p2p_unregister(mgr->p2p_driver);

	g_hash_table_remove(mgr_list, mgr->p2p_driver->service_name);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable phdc_methods[] = {
	{ GDBUS_METHOD("RegisterAgent",
			GDBUS_ARGS({"", "a{sv}"}),
			NULL, dbus_register_phdc_agent) },

{ GDBUS_METHOD("UnregisterAgent",
			GDBUS_ARGS({ "path", "o" }, { "type", "s"}),
			NULL, dbus_unregister_phdc_agent) },
	{ },
};

/* Initialize the PHDC plugin - Expose our dbus entry points */
int phdc_init(void)
{
	gboolean err;

	DBG("");
Exemple #14
0
			break;
		default:
			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;
	}
Exemple #15
0
}

static DBusMessage *cancel_request(DBusConnection *conn,
					DBusMessage *msg, void *user_data)
{
	bt_shell_printf("Request canceled\n");

	agent_release_prompt();
	dbus_message_unref(pending_message);
	pending_message = NULL;

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable methods[] = {
	{ GDBUS_METHOD("Release", NULL, NULL, release_agent) },
	{ GDBUS_ASYNC_METHOD("RequestPinCode",
			GDBUS_ARGS({ "device", "o" }),
			GDBUS_ARGS({ "pincode", "s" }), request_pincode) },
	{ GDBUS_METHOD("DisplayPinCode",
			GDBUS_ARGS({ "device", "o" }, { "pincode", "s" }),
			NULL, display_pincode) },
	{ GDBUS_ASYNC_METHOD("RequestPasskey",
			GDBUS_ARGS({ "device", "o" }),
			GDBUS_ARGS({ "passkey", "u" }), request_passkey) },
	{ GDBUS_METHOD("DisplayPasskey",
			GDBUS_ARGS({ "device", "o" }, { "passkey", "u" },
							{ "entered", "q" }),
			NULL, display_passkey) },
	{ GDBUS_ASYNC_METHOD("RequestConfirmation",
			GDBUS_ARGS({ "device", "o" }, { "passkey", "u" }),
Exemple #16
0
		return __ofono_error_invalid_args(msg);

	if (pn->agent == NULL)
		return __ofono_error_failed(msg);

	if (sms_agent_matches(pn->agent, agent_bus, agent_path) == FALSE)
		return __ofono_error_failed(msg);

	sms_agent_free(pn->agent);
	pn->agent = NULL;

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable push_notification_methods[] = {
	{ GDBUS_METHOD("RegisterAgent",	GDBUS_ARGS({ "path", "o" }), NULL,
			push_notification_register_agent) },
	{ GDBUS_METHOD("UnregisterAgent", GDBUS_ARGS({ "path", "o" }), NULL,
			push_notification_unregister_agent) },
	{ }
};

static void push_notification_cleanup(gpointer user)
{
	struct push_notification *pn = user;

	DBG("%p", pn);

	/* The push watch was already cleaned up */
	pn->push_watch[0] = 0;
	pn->push_watch[1] = 0;
	pn->sms = NULL;
	return NULL;

fallback:
	/* There's no driver, fallback to direct SCO connection */
	err = ofono_handsfree_card_connect_sco(card);
	if (err < 0)
		return __ofono_error_failed(msg);

	card->msg = dbus_message_ref(msg);

	return NULL;
}

static const GDBusMethodTable card_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			card_get_properties) },
	{ GDBUS_ASYNC_METHOD("Connect", NULL, NULL, card_connect) },
	{ }
};

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

struct ofono_handsfree_card *ofono_handsfree_card_create(unsigned int vendor,
					enum ofono_handsfree_card_type type,
					const char *driver,
					void *data)
Exemple #18
0
			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);

	connected = (conn->state == SAP_STATE_CONNECTED ||
				conn->state == SAP_STATE_GRACEFUL_DISCONNECT);
	dict_append_entry(&dict, "Connected", DBUS_TYPE_BOOLEAN, &connected);

	dbus_message_iter_close_container(&iter, &dict);

	return reply;
}

static const GDBusMethodTable server_methods[] = {
	{ GDBUS_METHOD("GetProperties",
			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
			get_properties) },
	{ GDBUS_METHOD("Disconnect", NULL, NULL, disconnect) },
	{ }
};

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

static void server_free(struct sap_server *server)
{
	if (!server)
		return;
Exemple #19
0
                                    DBusMessage *msg, void *user_data)
{
    struct connman_session *session = user_data;

    DBG("session %p", session);

    if (ecall_session && 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_policy_config_cb(struct connman_session *session,
                                    struct connman_session_config *config,
                                    void *user_data, int err)
{
Exemple #20
0
static void path_unregister(void *data)
{
	struct network_adapter *na = data;

	DBG("Unregistered interface %s on path %s",
		NETWORK_SERVER_INTERFACE, adapter_get_path(na->adapter));

	g_slist_free_full(na->servers, server_free);

	adapters = g_slist_remove(adapters, na);
	adapter_free(na);
}

static const GDBusMethodTable server_methods[] = {
	{ GDBUS_METHOD("Register",
			GDBUS_ARGS({ "uuid", "s" }, { "bridge", "s" }), NULL,
			register_server) },
	{ GDBUS_METHOD("Unregister",
			GDBUS_ARGS({ "uuid", "s" }), NULL,
			unregister_server) },
	{ }
};

static struct network_adapter *create_adapter(struct btd_adapter *adapter)
{
	struct network_adapter *na;
	GError *err = NULL;

	na = g_new0(struct network_adapter, 1);
	na->adapter = btd_adapter_ref(adapter);
Exemple #21
0
static DBusMessage *profile_request_disconnection(DBusConnection *conn,
						DBusMessage *msg, void *data)
{
	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static DBusMessage *profile_cancel(DBusConnection *conn,
						DBusMessage *msg, void *data)
{
	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

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

static void register_profile_reply(DBusPendingCall *call, void *user_data)
Exemple #22
0
						&query, &query_len, &version);
	if (ret)
		goto error;

	ret = __connman_peer_service_unregister(owner, spec, spec_len,
						query, query_len, version);
	if (!ret)
		return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
error:
	return __connman_error_failed(msg, -ret);

}

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_METHOD("GetPeers",
			NULL, GDBUS_ARGS({ "peers", "a(oa{sv})" }),
Exemple #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) },
	{ }
};

int alert_server_init(void)
{
	if (!g_dbus_register_interface(btd_get_dbus_connection(),
Exemple #24
0
	return dbus_message_new_method_return(msg);
}

static DBusMessage *control_reset(DBusConnection *conn,
					DBusMessage *msg, void *data)
{
	release_modems();
	parse_config();

	return dbus_message_new_method_return(msg);
}

static const GDBusMethodTable control_methods[] = {
	{ GDBUS_METHOD("Add",
		GDBUS_ARGS({ "name", "s" }, {"address", "s"}, {"port", "s"}),
		NULL,
		control_add) },
	{ GDBUS_METHOD("RemoveAll",
		GDBUS_ARGS({ }),
		NULL,
		control_remove_all) },
	{ GDBUS_METHOD("Reset",
		GDBUS_ARGS({ }),
		NULL,
		control_reset) },
	{}
};

static int setup_control_channel(void)
{
	int err = 0;
		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;
Exemple #26
0
	sender = dbus_message_get_sender(msg);

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

	DBG("sender %s path %s", sender, path);

	g_hash_table_remove(config_list, path);

	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

static const GDBusMethodTable manager_methods[] = {
	{ GDBUS_METHOD("CreateProxyConfiguration",
			GDBUS_ARGS({ "settings", "a{sv}" }),
			GDBUS_ARGS({ "path", "o" }),
			create_proxy_config) },
	{ GDBUS_METHOD("DestroyProxyConfiguration",
			GDBUS_ARGS({ "configuration" , "o" }), NULL,
			destroy_proxy_config) },
	{ },
};

static DBusConnection *connection;

int __pacrunner_manager_init(DBusConnection *conn)
{
	DBG("");

	connection = dbus_connection_ref(conn);
Exemple #27
0
	return 0;
}

static const GDBusMethodTable sms_manager_methods[] = {
	{ GDBUS_ASYNC_METHOD("GetProperties",
				NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
				sms_get_properties) },
	{ GDBUS_ASYNC_METHOD("SetProperty",
			GDBUS_ARGS({ "property", "s" }, { "value", "v" }),
			NULL, sms_set_property) },
	{ GDBUS_ASYNC_METHOD("SendMessage",
			GDBUS_ARGS({ "to", "s" }, { "text", "s" }),
			GDBUS_ARGS({ "path", "o" }),
			sms_send_message) },
	{ GDBUS_METHOD("GetMessages",
			NULL, GDBUS_ARGS({ "messages", "a(oa{sv})" }),
			sms_get_messages) },
	{ }
};

static const GDBusSignalTable sms_manager_signals[] = {
	{ GDBUS_SIGNAL("PropertyChanged",
			GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
	{ GDBUS_SIGNAL("IncomingMessage",
			GDBUS_ARGS({ "message", "s" }, { "info", "a{sv}" })) },
	{ GDBUS_SIGNAL("ImmediateMessage",
			GDBUS_ARGS({ "message", "s" }, { "info", "a{sv}" })) },
	{ GDBUS_SIGNAL("MessageAdded",
			GDBUS_ARGS({ "path", "o" },
						{ "properties", "a{sv}" })) },
	{ GDBUS_SIGNAL("MessageRemoved",
Exemple #28
0
	}

	invalidate_parent_data(conn, parent_path);

	if (data == NULL)
		goto done;

	g_free(data->introspect);
	data->introspect = NULL;

done:
	g_free(parent_path);
}

static const GDBusMethodTable introspect_methods[] = {
	{ GDBUS_METHOD("Introspect", NULL,
			GDBUS_ARGS({ "xml", "s" }), introspect) },
	{ }
};

static void add_interface(struct generic_data *data, const char *name,
				const GDBusMethodTable *methods,
				const GDBusSignalTable *signals,
				const GDBusPropertyTable *properties,
				void *user_data,
				GDBusDestroyFunction destroy)
{
	struct interface_data *iface;

	iface = g_new0(struct interface_data, 1);
	iface->name = g_strdup(name);
	iface->methods = methods;
Exemple #29
0
    dbus_message_iter_next(&iter);

    if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
        return __dundee_error_invalid_args(msg);

    dbus_message_iter_recurse(&iter, &var);

    if (g_str_equal(name, "Active"))
        return set_property_active(device, msg, &var);

    return __dundee_error_invalid_args(msg);
}

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

static const GDBusSignalTable device_signals[] = {
    {   GDBUS_SIGNAL("PropertyChanged",
        GDBUS_ARGS({ "name", "s" }, { "value", "v" }))
    },
    { }
};
Exemple #30
0
	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;

	ofono_info("Using device: %s, devaddr: %s, adapter: %s",