From: Jose Antonio Santos Cadenas <santoscadenas@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jose Antonio Santos Cadenas <santoscadenas@gmail.com>
Subject: [PATCH 10/32] Insert end_point in array returned by get_health_instances
Date: Wed, 2 Jun 2010 15:19:06 +0200 [thread overview]
Message-ID: <1275484768-25838-11-git-send-email-santoscadenas@gmail.com> (raw)
In-Reply-To: <1275484768-25838-10-git-send-email-santoscadenas@gmail.com>
---
health/hdp.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++--
health/hdp_util.c | 2 -
2 files changed, 57 insertions(+), 5 deletions(-)
diff --git a/health/hdp.c b/health/hdp.c
index 68bd809..6d18626 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -76,6 +76,43 @@ static struct hdp_device *find_device(GSList *devices, struct btd_device *dev)
return NULL;
}
+static void append_dict_features(DBusMessageIter *iter, GSList *end_points)
+{
+ DBusMessageIter entry, array;
+
+ dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY,
+ NULL, &entry);
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, "end_points");
+
+ dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &array);
+
+ dbus_message_iter_close_container(&entry, &array);
+ dbus_message_iter_close_container(iter, &entry);
+}
+
+static void append_array_entry(DBusMessageIter *iter, uint32_t *handler,
+ uint8_t *spec, GSList *end_points)
+{
+ DBusMessageIter dict;
+
+ 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);
+
+ dict_append_entry(&dict, "id", DBUS_TYPE_UINT32, handler);
+ dict_append_entry(&dict, "data_spec", DBUS_TYPE_BYTE, spec);
+ append_dict_features(&dict, end_points);
+
+ dbus_message_iter_close_container(iter, &dict);
+}
+
static void sink_health_instances(sdp_list_t *recs, int err, gpointer user_data)
{
struct instances_aux *cb_data = user_data;
@@ -86,6 +123,7 @@ static void sink_health_instances(sdp_list_t *recs, int err, gpointer user_data)
sdp_list_t *l;
guint8 data_spec;
GSList *end_points;
+ DBusMessageIter iter, dict;
g_free(cb_data);
@@ -97,10 +135,22 @@ static void sink_health_instances(sdp_list_t *recs, int err, gpointer user_data)
return;
}
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_ARRAY_AS_STRING
+ 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);
+
for (l = recs; l; l = l->next) {
rec = l->data;
debug("Record found 0x%x", rec->handle);
- /* TODO: Check record */
+
if (!hdp_get_data_exchange_spec(rec, &data_spec)) {
error("Error getting data exchange info");
continue;
@@ -110,11 +160,15 @@ static void sink_health_instances(sdp_list_t *recs, int err, gpointer user_data)
error("Error getting end points");
continue;
}
- debug("Get data exchange spec %d", data_spec);
+ append_array_entry(&dict, &rec->handle, &data_spec,
+ end_points);
}
+ dbus_message_iter_close_container(&iter, &dict);
+/*
reply = g_dbus_create_error(msg, ERROR_INTERFACE ".HealthError",
"Not implemented yet");
+*/
g_dbus_send_message(device->conn, reply);
}
@@ -172,7 +226,7 @@ static void dev_path_unregister(void *data)
}
static GDBusMethodTable device_methods[] = {
- { "GetHealthInstances", "", "a{sv}", get_health_instances,
+ { "GetHealthInstances", "", "aa{sv}", get_health_instances,
G_DBUS_METHOD_FLAG_ASYNC },
{ NULL }
};
diff --git a/health/hdp_util.c b/health/hdp_util.c
index b59e4e3..f6ab8e7 100644
--- a/health/hdp_util.c
+++ b/health/hdp_util.c
@@ -947,7 +947,5 @@ GSList *hdp_get_end_points(const sdp_record_t *rec)
epl = get_feature(epl, l->val.dataseq);
}
- g_slist_foreach(epl, print_features, NULL);
-
return epl;
}
--
1.6.3.3
next prev parent reply other threads:[~2010-06-02 13:19 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 13:18 [PATCH 00/32] Health device profile (HDP) Jose Antonio Santos Cadenas
2010-06-02 13:18 ` [PATCH 01/32] Add Health api description Jose Antonio Santos Cadenas
2010-06-02 13:18 ` [PATCH 02/32] Initial support for HDP Jose Antonio Santos Cadenas
2010-06-02 13:18 ` [PATCH 03/32] Add functions to resiger health instances in SDP Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 04/32] Initial support for hdp_device_drivers Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 05/32] Register healt_driver interfaces in d-bus Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 06/32] Add delete instance petition Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 07/32] Add watcher to control client disconections to delete hdp instance Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 08/32] Work in getting remote SDP records Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 09/32] Adds functions to get remote suported features from its SDP record Jose Antonio Santos Cadenas
2010-06-02 13:19 ` Jose Antonio Santos Cadenas [this message]
2010-06-02 13:19 ` [PATCH 11/32] Initial support for connecting instances Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 12/32] Complete the response dictionary in GetHealthInstances response Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 13/32] Implement connection of health instances Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 14/32] Manage mcap instances Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 15/32] Implement connect MCL callback in health instances connection Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 16/32] Register Health link int the bus when MCL is connected Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 17/32] Analize remote record looking for psm Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 18/32] Unify the creation of health links Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 19/32] Remove hdp_device pointer from health link struct Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 20/32] Release health link resources Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 21/32] Manage mcap disconnections and reconnections Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 22/32] Initial work for disconnecting health links Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 23/32] Avoid multiple links with the same device Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 24/32] Disconnect health link petition Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 25/32] Create new structure to manage data channels in HDP Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 26/32] Implement connect data channel callback Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 27/32] Change function name when retreiving remote SDP records Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 28/32] Changed HEALTH_MANAGER_INTERFACE to HEALTH_MANAGER Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 29/32] Call the agent when a new Health Link is created Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 30/32] Add a test that creates a simple health agent Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 31/32] Send MCL disconnect callback to agents Jose Antonio Santos Cadenas
2010-06-02 13:19 ` [PATCH 32/32] Add support for mcl reconnections Jose Antonio Santos Cadenas
2010-06-02 13:51 ` [PATCH 00/32] Health device profile (HDP) Johan Hedberg
2010-06-02 14:44 ` José Antonio Santos Cadenas
2010-06-02 20:48 ` Gustavo F. Padovan
-- strict thread matches above, loose matches on Subject: below --
2010-06-04 8:29 [PATCH 00/32] Health Device Prifile (HDP) -- updated Jose Antonio Santos Cadenas
2010-06-04 8:29 ` [PATCH 01/32] Add Health api description Jose Antonio Santos Cadenas
2010-06-04 8:29 ` [PATCH 02/32] Initial support for HDP Jose Antonio Santos Cadenas
2010-06-04 8:29 ` [PATCH 03/32] Add functions to resiger health instances in SDP Jose Antonio Santos Cadenas
2010-06-04 8:29 ` [PATCH 04/32] Initial support for hdp_device_drivers Jose Antonio Santos Cadenas
2010-06-04 8:29 ` [PATCH 05/32] Register healt_driver interfaces in d-bus Jose Antonio Santos Cadenas
2010-06-04 8:29 ` [PATCH 06/32] Add delete instance petition Jose Antonio Santos Cadenas
2010-06-04 8:30 ` [PATCH 07/32] Add watcher to control client disconections to delete hdp instance Jose Antonio Santos Cadenas
2010-06-04 8:30 ` [PATCH 08/32] Work in getting remote SDP records Jose Antonio Santos Cadenas
2010-06-04 8:30 ` [PATCH 09/32] Adds functions to get remote suported features from its SDP record Jose Antonio Santos Cadenas
2010-06-04 8:30 ` [PATCH 10/32] Insert end_point in array returned by get_health_instances Jose Antonio Santos Cadenas
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=1275484768-25838-11-git-send-email-santoscadenas@gmail.com \
--to=santoscadenas@gmail.com \
--cc=linux-bluetooth@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).