aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/client.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2010-07-30 16:11:12 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-08-09 18:06:47 -0400
commitba800b48e1f95ba5466a383ebf7b728683e0cab6 (patch)
tree3c3a7d581dd9374f9ccf4e05c3084f8fcb3eb315 /attrib/client.c
parenta6a0f24a24b52d66e98b1916028fba4c90dcc8e2 (diff)
downloadbluez-ba800b48e1f95ba5466a383ebf7b728683e0cab6.tar.gz
bluez-ba800b48e1f95ba5466a383ebf7b728683e0cab6.tar.xz
bluez-ba800b48e1f95ba5466a383ebf7b728683e0cab6.zip
Fix characteristics and primary service methods
Characteristic objects shall provide GetProperties() method. Primary service objects: GetCharacteristics(), RegisterCharacteristicsWatcher() and UnregisterCharacteristicsWatcher().
Diffstat (limited to 'attrib/client.c')
-rw-r--r--attrib/client.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/attrib/client.c b/attrib/client.c
index 8aa47947..2bb97bc6 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -130,7 +130,7 @@ static DBusMessage *unregister_watcher(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}
-static GDBusMethodTable char_methods[] = {
+static GDBusMethodTable prim_methods[] = {
{ "GetCharacteristics", "", "a{oa{sv}}", get_characteristics},
{ "RegisterCharacteristicsWatcher", "o", "",
register_watcher },
@@ -139,6 +139,30 @@ static GDBusMethodTable char_methods[] = {
{ }
};
+static DBusMessage *get_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ return dbus_message_new_method_return(msg);
+}
+
+static GDBusMethodTable char_methods[] = {
+ { "GetProperties", "", "a{sv}", get_properties },
+ { }
+};
+
+static void register_primary(struct gatt_service *gatt)
+{
+ GSList *l;
+
+ for (l = gatt->primary; l; l = l->next) {
+ struct primary *prim = l->data;
+ g_dbus_register_interface(connection, prim->path,
+ CHAR_INTERFACE, prim_methods,
+ NULL, NULL, prim, NULL);
+ DBG("Registered: %s", prim->path);
+ }
+}
+
static void register_characteristics(struct gatt_service *gatt)
{
GSList *lp, *lc;
@@ -474,6 +498,7 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
return;
store_primary_services(gatt);
+ register_primary(gatt);
/* Start Characteristic Discovery */
gatt->cur_prim = gatt->primary;