diff options
-rw-r--r-- | src/gatt-database.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/gatt-database.c b/src/gatt-database.c index a6b9dbcf..6e659299 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -3043,6 +3043,23 @@ static struct pending_op *acquire_write(struct external_chrc *chrc, return NULL; } +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +static void start_notify_setup(DBusMessageIter *iter, void *user_data) +{ + struct pending_op *op = user_data; + struct btd_device *device = op->device; + char dst_addr[18] = { 0 }; + char *addr_value = dst_addr; + + if (device_get_rpa_exist(device) == true) + ba2str(device_get_rpa(device), dst_addr); + else + ba2str(device_get_address(device), dst_addr); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value); +} +#endif + static void acquire_notify_reply(DBusMessage *message, void *user_data) { struct pending_op *op = user_data; @@ -3088,9 +3105,13 @@ static void acquire_notify_reply(DBusMessage *message, void *user_data) return; retry: +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + g_dbus_proxy_method_call(chrc->proxy, "StartNotify", + start_notify_setup, NULL, op, NULL); +#else g_dbus_proxy_method_call(chrc->proxy, "StartNotify", NULL, NULL, NULL, NULL); - +#endif __sync_fetch_and_add(&chrc->ntfy_cnt, 1); } @@ -3111,6 +3132,23 @@ static void acquire_notify_setup(DBusMessageIter *iter, void *user_data) dbus_message_iter_close_container(iter, &dict); } +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +static void stop_notify_setup(DBusMessageIter *iter, void *user_data) +{ + struct pending_op *op = user_data; + struct btd_device *device = op->device; + char dst_addr[18] = { 0 }; + char *addr_value = dst_addr; + + if (device_get_rpa_exist(device) == true) + ba2str(device_get_rpa(device), dst_addr); + else + ba2str(device_get_address(device), dst_addr); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value); +} +#endif + static uint8_t ccc_write_cb(struct pending_op *op, void *user_data) { struct external_chrc *chrc = user_data; @@ -3143,8 +3181,13 @@ static uint8_t ccc_write_cb(struct pending_op *op, void *user_data) * Send request to stop notifying. This is best-effort * operation, so simply ignore the return the value. */ +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + g_dbus_proxy_method_call(chrc->proxy, "StopNotify", + stop_notify_setup, NULL, op, NULL); +#else g_dbus_proxy_method_call(chrc->proxy, "StopNotify", NULL, NULL, NULL, NULL); +#endif goto done; } @@ -3179,8 +3222,13 @@ static uint8_t ccc_write_cb(struct pending_op *op, void *user_data) * Always call StartNotify for an incoming enable and ignore the return * value for now. */ +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + if (g_dbus_proxy_method_call(chrc->proxy, "StartNotify", start_notify_setup, NULL, + op, NULL) == FALSE) +#else if (g_dbus_proxy_method_call(chrc->proxy, "StartNotify", NULL, NULL, NULL, NULL) == FALSE) +#endif return BT_ATT_ERROR_UNLIKELY; __sync_fetch_and_add(&chrc->ntfy_cnt, 1); |