From: Frederic Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/8] bluetooth: add support to register Bluetooth Service
Date: Tue, 01 Feb 2011 15:25:45 +0100 [thread overview]
Message-ID: <4D4817E9.5000709@linux.intel.com> (raw)
In-Reply-To: <1296507122-10936-2-git-send-email-padovan@profusion.mobi>
[-- Attachment #1: Type: text/plain, Size: 3623 bytes --]
Hello Gustavo,
Le 31/01/2011 21:51, Gustavo F. Padovan a écrit :
> ---
> plugins/bluetooth.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 75 insertions(+), 0 deletions(-)
>
> diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
> index dcf75e6..0b5a021 100644
> --- a/plugins/bluetooth.c
> +++ b/plugins/bluetooth.c
> @@ -44,6 +44,43 @@ static GHashTable *adapter_address_hash = NULL;
> static GSList *server_list = NULL;
> static gint bluetooth_refcount;
>
> +static const gchar *dun_record = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
> +<record> \
> +<attribute id=\"0x0001\"> \
> +<sequence> \
> +<uuid value=\"0x1103\"/> \
> +</sequence> \
> +</attribute> \
> + \
> +<attribute id=\"0x0004\"> \
> +<sequence> \
> +<sequence> \
> +<uuid value=\"0x0100\"/> \
> +</sequence> \
> +<sequence> \
> +<uuid value=\"0x0003\"/> \
> +<uint8 value=\"%u\" name=\"channel\"/> \
> +</sequence> \
> +<sequence> \
> +<uuid value=\"0x0008\"/> \
> +</sequence> \
> +</sequence> \
> +</attribute> \
> + \
> +<attribute id=\"0x0009\"> \
> +<sequence> \
> +<sequence> \
> +<uuid value=\"0x1103\"/> \
> +<uint16 value=\"0x0100\" name=\"version\"/> \
> +</sequence> \
> +</sequence> \
> +</attribute> \
> + \
> +<attribute id=\"0x0100\"> \
> +<text value=\"%s\" name=\"name\"/> \
> +</attribute> \
> +</record>";
> +
Why do you set the SDP record in the generic bluetooth code ?
I think this should be moved to dun_gw code.
> struct server {
> guint16 service;
> gchar *name;
> @@ -451,12 +488,40 @@ static void new_connection(GIOChannel *io, gpointer user_data)
> DBG("%p", server);
> }
>
> +static void add_record_cb(DBusPendingCall *call, gpointer user_data)
> +{
> + struct server *server = user_data;
> + DBusMessage *reply = dbus_pending_call_steal_reply(call);
> + DBusError derr;
> + guint32 handle;
> +
> + dbus_error_init(&derr);
> +
> + if (dbus_set_error_from_message(&derr, reply)) {
> + ofono_error("Replied with an error: %s, %s",
> + derr.name, derr.message);
> + dbus_error_free(&derr);
> + server_stop(server);
> + goto done;
> + }
> +
> + dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32,&handle,
> + DBUS_TYPE_INVALID);
> + server->handle = handle;
> +
> + ofono_info("Registered: %s, handle: 0x%x", server->name, handle);
> +
> +done:
> + dbus_message_unref(reply);
> +}
> +
> static void server_start(gpointer data, gpointer user_data)
> {
> struct server *server = data;
> char *addr, *path = user_data;
> bdaddr_t baddr;
> GError *err = NULL;
> + gchar *xml;
>
> if (server->handle != 0)
> return;
> @@ -478,6 +543,16 @@ static void server_start(gpointer data, gpointer user_data)
> }
>
> server->adapter = g_strdup(path);
> +
> + xml = g_markup_printf_escaped(dun_record, server->channel,
> + server->name);
> +
> + bluetooth_send_with_reply(path, BLUEZ_SERVICE_INTERFACE, "AddRecord",
> + add_record_cb, server, NULL, -1,
> + DBUS_TYPE_STRING,&xml,
> + DBUS_TYPE_INVALID);
> +
> + g_free(xml);
> }
>
> static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)
--
Frederic Danis Open Source Technology Centre
frederic.danis(a)intel.com Intel Corporation
next prev parent reply other threads:[~2011-02-01 14:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-31 20:51 [PATCH 1/8] bluetooth: add server support Gustavo F. Padovan
2011-01-31 20:51 ` [PATCH 2/8] bluetooth: add support to register Bluetooth Service Gustavo F. Padovan
2011-01-31 20:51 ` [PATCH 3/8] bluetooth: add Request auth code for new connections Gustavo F. Padovan
2011-01-31 20:51 ` [PATCH 4/8] include: add public headed to emulator atom Gustavo F. Padovan
2011-01-31 20:51 ` [PATCH 5/8] emulator: Add emulator atom in oFono Gustavo F. Padovan
2011-01-31 20:52 ` [PATCH 6/8] dun_gw: Add DUN server plugin for oFono Gustavo F. Padovan
2011-01-31 20:52 ` [PATCH 7/8] emulator: Implement dialing up for DUN Gustavo F. Padovan
2011-01-31 20:52 ` [PATCH 8/8] gsmdial: add option for Bluetooth DUN dialing Gustavo F. Padovan
2011-02-01 14:25 ` Frederic Danis [this message]
2011-02-01 14:17 ` [PATCH 1/8] bluetooth: add server support Frederic Danis
2011-02-02 18:21 ` Gustavo F. Padovan
2011-02-03 15:56 ` Frederic Danis
2011-02-03 16:30 ` Gustavo F. Padovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D4817E9.5000709@linux.intel.com \
--to=frederic.danis@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox