From: Seungyoun Ju Date: Thu, 4 May 2017 04:31:20 +0000 (+0900) Subject: Apply missing changes X-Git-Tag: submit/tizen_3.0/20170517.015909~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=412e747234b90a57879c8935e6e49a2fdbd08b78;p=platform%2Fcore%2Fapi%2Fbluetooth.git Apply missing changes [Model] COMMON [BinType] AP [Customer] OPEN [Issue#] N/A [Request] Internal [Occurrence Version] N/A [Problem] bt_socket_connection_s is not initialized. And __get_write_prop() is misused. [Cause & Measure] Initialize bt_socket_connection_s and fix bt_gatt_characteristic_set_write_type() logic [Checking Method] Code review [Team] Basic connection [Developer] Seungyoun Ju [Solution company] Samsung [Change Type] Specification change Change-Id: I9018b3ace3b4ea2f711105a6cf950ac8035c9b2a --- diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 23038cc..097bbce 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -1351,6 +1351,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us else error_code = _bt_get_error_code(param->result); + memset(&rfcomm_connection, 0x00, sizeof(bt_socket_connection_s)); connection_ind = (bluetooth_rfcomm_connection_t *)(param->param_data); if (connection_ind) { @@ -1384,6 +1385,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED: BT_INFO("bt_socket_connection_state_changed_cb() will be called with BT_SOCKET_DISCONNECTED"); + memset(&rfcomm_connection, 0x00, sizeof(bt_socket_connection_s)); disconnection_ind = (bluetooth_rfcomm_disconnection_t *)(param->param_data); if (disconnection_ind) { diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index 9c4fe73..8f1fa1d 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -2143,24 +2143,13 @@ int bt_gatt_characteristic_set_write_type(bt_gatt_h characteristic, return BT_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */ } - switch (write_type) { - case BT_GATT_WRITE_TYPE_WRITE: - property = BT_GATT_PROPERTY_WRITE; - break; - case BT_GATT_WRITE_TYPE_WRITE_NO_RESPONSE: - property = BT_GATT_PROPERTY_WRITE_WITHOUT_RESPONSE; - break; - default: + ret = __get_write_prop(write_type, &property); + if (ret != BT_ERROR_NONE) return BT_ERROR_NOT_SUPPORTED; - } if (!(chr->properties & property)) return BT_ERROR_NOT_SUPPORTED; - ret = __get_write_prop(write_type, &property); - if (ret != BT_ERROR_NONE) - return BT_ERROR_NOT_SUPPORTED; - chr->write_type = write_type; return BT_ERROR_NONE; }