Fix the malfunction of gatt write request 92/232492/1 submit/tizen/20200506.041322
authorinjun.yang <injun.yang@samsung.com>
Wed, 29 Apr 2020 10:46:12 +0000 (19:46 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 6 May 2020 02:12:17 +0000 (11:12 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] P200428-04425
[Request] Internal
[Occurrence Version] N/A

[Problem] Some application call bt_gatt_client_write_value() repeately. (Write req)
 If gatt client app call API before callback invoked,
 inprogress error is not returned.
[Cause & Measure] ATT is sequential transaction protocol. So return inprogress error
 before write completed callback invoked.
[Checking Method] n/a

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I76eb97e124a739990d3210c3f3c3fa7354b605f1
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/bluetooth-gatt.c

index bb20e53..aab2dc2 100644 (file)
@@ -3956,6 +3956,8 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle,
                                                &chr_handle,
                                                &write_data,
                                                BLUETOOTH_GATT_TYPE_WRITE));
+                       if (ret == BT_ERROR_NONE)
+                               _bt_set_cb(BT_EVENT_GATT_CLIENT_WRITE_CHARACTERISTIC, callback, NULL);
                } else if (chr->write_type == BT_GATT_WRITE_TYPE_WRITE_NO_RESPONSE) {
                        ret = _bt_get_error_code(
                                        bluetooth_gatt_client_write_characteristic_value_by_type(
@@ -4854,6 +4856,8 @@ void _bt_handle_gatt_client_char_write_completed_event(int result,
 
        BT_INFO("GATT Char Write Clalback result [%d]", result);
 
+       _bt_unset_cb(BT_EVENT_GATT_CLIENT_WRITE_CHARACTERISTIC);
+
        if (result != BLUETOOTH_ERROR_NONE) {
                char_prop2 = (bluetooth_gatt_client_char_prop_info_t*)resp;
                char *device_addr = NULL;