Return-Path: MIME-Version: 1.0 In-Reply-To: <1424927610-26226-13-git-send-email-armansito@chromium.org> References: <1424927610-26226-1-git-send-email-armansito@chromium.org> <1424927610-26226-13-git-send-email-armansito@chromium.org> Date: Thu, 26 Feb 2015 10:51:57 +0200 Message-ID: Subject: Re: [PATCH BlueZ v1 12/17] core/gatt: Add btd_gatt_database_notify function From: Luiz Augusto von Dentz To: Arman Uguray Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Arman, On Thu, Feb 26, 2015 at 7:13 AM, Arman Uguray wrote: > This patch add the btd_gatt_database_notify function to database's > public API. This allows upper layers to send out notifications > and indications to all connected devices that have configured the > specified CCC descriptor. > --- > src/gatt-database.c | 4 ++-- > src/gatt-database.h | 5 +++++ > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/src/gatt-database.c b/src/gatt-database.c > index ebfcf2d..d75b971 100644 > --- a/src/gatt-database.c > +++ b/src/gatt-database.c > @@ -737,7 +737,7 @@ static void send_notification_to_device(void *data, void *user_data) > NULL, NULL); > } > > -static void send_notification_to_devices(struct btd_gatt_database *database, > +void btd_gatt_database_notify(struct btd_gatt_database *database, > uint16_t handle, const uint8_t *value, > uint16_t len, uint16_t ccc_handle, > bool indicate) > @@ -781,7 +781,7 @@ static void send_service_changed(struct btd_gatt_database *database, > put_le16(start, value); > put_le16(end, value + 2); > > - send_notification_to_devices(database, handle, value, sizeof(value), > + btd_gatt_database_notify(database, handle, value, sizeof(value), > ccc_handle, true); > } > > diff --git a/src/gatt-database.h b/src/gatt-database.h > index 163b601..2a89ad6 100644 > --- a/src/gatt-database.h > +++ b/src/gatt-database.h > @@ -34,3 +34,8 @@ btd_gatt_database_add_ccc(struct btd_gatt_database *database, > btd_gatt_database_ccc_write_t write_callback, > void *user_data, > btd_gatt_database_destroy_t destroy); > + > +void btd_gatt_database_notify(struct btd_gatt_database *database, > + uint16_t handle, const uint8_t *value, > + uint16_t len, uint16_t ccc_handle, > + bool indicate); > -- > 2.2.0.rc0.207.ga3a616c I think we should make gatt_db notify about database changes directly so anyone interested in attribute value changes can subscribe to it. -- Luiz Augusto von Dentz