diff options
-rw-r--r-- | doc/bluetooth_doc.h | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | include/bluetooth_private.h | 3 | ||||
-rwxr-xr-x | include/mobile/bluetooth.h | 28 | ||||
-rw-r--r-- | include/mobile/bluetooth_internal.h | 6 | ||||
-rwxr-xr-x | include/wearable/bluetooth.h | 28 | ||||
-rwxr-xr-x | src/bluetooth-adapter.c | 3 | ||||
-rw-r--r-- | src/bluetooth-common.c | 55 | ||||
-rw-r--r-- | src/bluetooth-gatt.c | 40 | ||||
-rw-r--r-- | test/bt_unit_test.c | 11 |
9 files changed, 54 insertions, 154 deletions
diff --git a/doc/bluetooth_doc.h b/doc/bluetooth_doc.h index a2229b4..13a5d07 100644 --- a/doc/bluetooth_doc.h +++ b/doc/bluetooth_doc.h @@ -44,7 +44,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -75,7 +75,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * * @section CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE_ASYNCHRONOUS_OPERATIONS Asynchronous Operations * <div><table class="doxtable" > @@ -175,7 +175,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -206,7 +206,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * * @section CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE_ASYNCHRONOUS_OPERATIONS Asynchronous Operations * <div><table class="doxtable" > @@ -318,7 +318,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * * @section CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE_ASYNCHRONOUS_OPERATIONS Asynchronous Operations * <div><table class="doxtable" > @@ -396,7 +396,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -421,7 +421,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -445,7 +445,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -471,7 +471,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -497,7 +497,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -524,7 +524,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -550,7 +550,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -578,7 +578,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -606,7 +606,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -633,7 +633,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -659,7 +659,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ @@ -688,7 +688,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> * */ diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index afbef1a..df37dd8 100644..100755 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -299,9 +299,6 @@ typedef struct { bt_gatt_server_read_value_requested_cb read_requested_cb; void *read_requested_user_data; - bt_gatt_server_notification_sent_cb indication_confirm_cb; - void *indication_confirm_user_data; - bt_gatt_server_notification_state_change_cb notification_changed_cb; void *notification_changed_user_data; diff --git a/include/mobile/bluetooth.h b/include/mobile/bluetooth.h index 3e0b269..1c1ad99 100755 --- a/include/mobile/bluetooth.h +++ b/include/mobile/bluetooth.h @@ -2683,8 +2683,8 @@ int bt_avrcp_target_deinitialize(void); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the equalize state to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] state The state of equalizer * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2706,8 +2706,8 @@ int bt_avrcp_target_notify_equalizer_state(bt_avrcp_equalizer_state_e state); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the repeat mode to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] mode The repeat mode * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2729,8 +2729,8 @@ int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the shuffle mode to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] mode The repeat mode * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2752,8 +2752,8 @@ int bt_avrcp_target_notify_shuffle_mode(bt_avrcp_shuffle_mode_e mode); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the scan mode to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] mode The scan mode * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2775,8 +2775,8 @@ int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the player state to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] state The player state * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2798,8 +2798,8 @@ int bt_avrcp_target_notify_player_state(bt_avrcp_player_state_e state); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the current position of song to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] position The current position in milliseconds * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2821,8 +2821,8 @@ int bt_avrcp_target_notify_position(unsigned int position); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the track to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] title The title of track * @param[in] artist The artist of track * @param[in] album The album of track diff --git a/include/mobile/bluetooth_internal.h b/include/mobile/bluetooth_internal.h index 598bdd5..c1fc1d6 100644 --- a/include/mobile/bluetooth_internal.h +++ b/include/mobile/bluetooth_internal.h @@ -2157,13 +2157,12 @@ int bt_gatt_server_send_response(int request_id, /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE - * @brief Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor + * @brief Notifys a value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor * @since_tizen 2.4 * * @param[in] characteristic The characteristic which has a changed value * @param[in] need_confirm If it is true, an indication is sent. If it is false, a notification is sent. * @param[in] callback The function to be invoked on each remote device when a sending operation is done - * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled. * @param[in] user_data The user data to be passed to @a callback function * @return 0 on success, otherwise a negative error value * @retval #BT_ERROR_NONE Successful @@ -2173,8 +2172,7 @@ int bt_gatt_server_send_response(int request_id, * @see bt_gatt_server_notification_sent_cb() */ int bt_gatt_server_notify(bt_gatt_h characteristic, bool need_confirm, - bt_gatt_server_notification_sent_cb callback, - const char *device_address, void *user_data); + bt_gatt_server_notification_sent_cb callback, void *user_data); /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE diff --git a/include/wearable/bluetooth.h b/include/wearable/bluetooth.h index 962012b..2f7bc2f 100755 --- a/include/wearable/bluetooth.h +++ b/include/wearable/bluetooth.h @@ -2456,8 +2456,8 @@ int bt_avrcp_target_deinitialize(void); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the equalize state to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] state The state of equalizer * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2479,8 +2479,8 @@ int bt_avrcp_target_notify_equalizer_state(bt_avrcp_equalizer_state_e state); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the repeat mode to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] mode The repeat mode * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2502,8 +2502,8 @@ int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the shuffle mode to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] mode The repeat mode * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2525,8 +2525,8 @@ int bt_avrcp_target_notify_shuffle_mode(bt_avrcp_shuffle_mode_e mode); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the scan mode to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] mode The scan mode * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2548,8 +2548,8 @@ int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the player state to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] state The player state * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2571,8 +2571,8 @@ int bt_avrcp_target_notify_player_state(bt_avrcp_player_state_e state); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the current position of song to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] position The current position in milliseconds * @return 0 on success, otherwise a negative error value. * @retval #BT_ERROR_NONE Successful @@ -2594,8 +2594,8 @@ int bt_avrcp_target_notify_position(unsigned int position); * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE * @brief Notifies the track to the remote device. * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/bluetooth + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin * @param[in] title The title of track * @param[in] artist The artist of track * @param[in] album The album of track diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c index 8824c2d..1c5ff8c 100755 --- a/src/bluetooth-adapter.c +++ b/src/bluetooth-adapter.c @@ -1422,10 +1422,7 @@ static int __bt_convert_string_to_uuid(const char *string, char **uuid, int *bit ret = sscanf(string, "%08x-%04hx-%04hx-%04hx-%08x%04hx", &val0, &val1, &val2, &val3, &val4, &val5); if (ret != 6) - { - g_free(data); return BT_ERROR_OPERATION_FAILED; - } val0 = htonl(val0); val1 = htons(val1); diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 90678cb..06f199b 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -610,43 +610,6 @@ static bt_gatt_server_notification_state_change_cb __bt_gatt_attribute_get_notif return NULL; } -static bt_gatt_server_notification_sent_cb __bt_gatt_attribute_get_indication_confrim_cb( - bt_gatt_h service, bt_gatt_h attribute, void **user_data) -{ - gchar *svc_path = (gchar *)service; - gchar *att_path = (gchar *)attribute; - const GSList *gatt_server_list = NULL; - const GSList *l1, *l2, *l3; - - gatt_server_list = _bt_gatt_get_server_list(); - - for (l1 = gatt_server_list; l1 != NULL; l1 = l1->next) { - bt_gatt_server_s *serv = l1->data; - - if (!serv) - return NULL; - - for (l2 = serv->services; l2 != NULL; l2 = l2->next) { - bt_gatt_service_s *svc = l2->data; - - if (g_strcmp0(svc->path, svc_path) == 0) { - for (l3 = svc->characteristics; l3 != NULL; l3 = l3->next) { - bt_gatt_characteristic_s *chr = l3->data; - - if (chr && g_strcmp0(chr->path, att_path) == 0) { - if (chr->indication_confirm_cb) { - *user_data = chr->indication_confirm_user_data; - return chr->indication_confirm_cb; - } else - return NULL; - } - } - } - } - } - return NULL; -} - static void __bt_free_bt_device_connection_info_s(bt_device_connection_info_s *conn_info) { if (conn_info == NULL) @@ -778,7 +741,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us if (event == BLUETOOTH_EVENT_GATT_SERVER_VALUE_CHANGED || event == BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED || event == BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED || event == BLUETOOTH_EVENT_ADVERTISING_STARTED || - event == BLUETOOTH_EVENT_GATT_SERVER_INDICATE_CONFIRMED || event == BLUETOOTH_EVENT_ADVERTISING_STOPPED) + event == BLUETOOTH_EVENT_ADVERTISING_STOPPED) BT_INFO("NOT use bt_event_slot_container"); else if (event_index == -1 || bt_event_slot_container[event_index].callback == NULL) return; @@ -1684,23 +1647,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us value_change->att_handle, user_data); break; } - case BLUETOOTH_EVENT_GATT_SERVER_INDICATE_CONFIRMED: { - bt_gatt_indicate_confirm_t *confrim_status = param->param_data; - bt_gatt_server_notification_sent_cb cb; - void *user_data = NULL; - cb = __bt_gatt_attribute_get_indication_confrim_cb(confrim_status->service_handle, - confrim_status->att_handle, &user_data); - - BT_INFO("BLUETOOTH_EVENT_GATT_SERVER_INDICATE_CONFIRMED"); - if (cb == NULL) - return; - - cb(_bt_get_error_code(param->result), confrim_status->address, - confrim_status->service_handle, - confrim_status->att_handle, confrim_status->complete, user_data); - break; - } #ifdef BT_ENABLE_LEGACY_GATT_CLIENT case BLUETOOTH_EVENT_GATT_SVC_CHAR_DESC_DISCOVERED: { BT_INFO("BLUETOOTH_EVENT_GATT_SVC_CHAR_DESC_DISCOVERED"); diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index 21929dc..8e497bf 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -1021,7 +1021,7 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, int value_length } if (handle->role == BT_GATT_ROLE_SERVER && handle->path) { - ret = _bt_get_error_code(bluetooth_gatt_update_characteristic(handle->path, value, value_length)); + ret = _bt_get_error_code(bluetooth_gatt_notify_characteristics_value_change(handle->path, value, value_length, NULL)); if (ret != BT_ERROR_NONE) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); return ret; @@ -1131,7 +1131,7 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type, int va } if (handle->role == BT_GATT_ROLE_SERVER && handle->path) { - ret = _bt_get_error_code(bluetooth_gatt_update_characteristic(handle->path, *val, *val_len)); + ret = _bt_get_error_code(bluetooth_gatt_notify_characteristics_value_change(handle->path, *val, *val_len, NULL)); if (ret != BT_ERROR_NONE) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); return ret; @@ -1236,7 +1236,7 @@ int bt_gatt_set_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type, } if (handle->role == BT_GATT_ROLE_SERVER && handle->path) { - ret = _bt_get_error_code(bluetooth_gatt_update_characteristic(handle->path, *val, *val_len)); + ret = _bt_get_error_code(bluetooth_gatt_notify_characteristics_value_change(handle->path, *val, *val_len, NULL)); if (ret != BT_ERROR_NONE) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); return ret; @@ -2112,42 +2112,12 @@ int bt_gatt_server_send_response(int request_id, } int bt_gatt_server_notify(bt_gatt_h characteristic, bool need_confirm, - bt_gatt_server_notification_sent_cb callback, - const char *device_address, void *user_data) + bt_gatt_server_notification_sent_cb callback, void *user_data) { - bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s*)characteristic; - bt_gatt_common_s *handle = (bt_gatt_common_s*)characteristic; - bluetooth_device_address_t addr_hex = { {0,} }; - int ret = BT_ERROR_NONE; - BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); - BT_CHECK_INPUT_PARAMETER(characteristic); - BT_CHECK_INPUT_PARAMETER(callback); - - _bt_convert_address_to_hex(&addr_hex, device_address); - - if (chr->value_length > 0 && chr->value) { - if (handle->role == BT_GATT_ROLE_SERVER && handle->path) { - ret = bluetooth_gatt_server_set_notification(handle->path, &addr_hex); - if (ret != BT_ERROR_NONE) { - BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); - return ret; - } - ret = _bt_get_error_code(bluetooth_gatt_update_characteristic(handle->path, chr->value, chr->value_length)); - if (ret != BT_ERROR_NONE) { - BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); - return ret; - } - } - } - - if (need_confirm) { - chr->indication_confirm_cb = callback; - chr->indication_confirm_user_data = user_data; - } - return ret; + return BT_ERROR_NONE; } int bt_gatt_server_set_value_changed_cb(bt_gatt_h characteristic, diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index 18b5239..22c6fb4 100644 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -4741,10 +4741,6 @@ int test_input_callback(void *data) ret = bt_gatt_set_value(battery_h.chr, char_value, 1); TC_PRT("Value[%d], returns %s\n", char_value[0], __bt_get_error_message(ret)); - /* notify only client remote_addr */ - ret = bt_gatt_server_notify(battery_h.chr, true, __bt_gatt_server_notification_sent_cb, remote_addr, NULL); - TC_PRT("bt_gatt_server_notify : %s\n", __bt_get_error_message(ret)); - break; } case BT_UNIT_TEST_FUNCTION_GATT_SERVER_REGISTER_HEART_RATE_SVC: { @@ -4817,8 +4813,7 @@ int test_input_callback(void *data) ret = bt_gatt_set_int_value(heart_rate_h.chr, BT_DATA_TYPE_UINT16, char_value, 1); TC_PRT("bt_gatt_set_value(value : %d) : %s\n", char_value, __bt_get_error_message(ret)); - /* Notify all client devices */ - ret = bt_gatt_server_notify(heart_rate_h.chr, true, __bt_gatt_server_notification_sent_cb, NULL, NULL); + ret = bt_gatt_server_notify(heart_rate_h.chr, false, __bt_gatt_server_notification_sent_cb, NULL); TC_PRT("bt_gatt_server_notify : %s\n", __bt_get_error_message(ret)); break; @@ -4879,10 +4874,6 @@ int test_input_callback(void *data) ret = bt_gatt_set_float_value(thermometer_h.chr, BT_DATA_TYPE_FLOAT, 123, -2, 1); TC_PRT("bt_gatt_set_value(value : 1.23) : %s\n", __bt_get_error_message(ret)); - /* notify only client remote_addr */ - ret = bt_gatt_server_notify(thermometer_h.chr, true, __bt_gatt_server_notification_sent_cb, remote_addr, NULL); - TC_PRT("bt_gatt_server_notify : %s\n", __bt_get_error_message(ret)); - break; } case BT_UNIT_TEST_FUNCTION_GATT_SERVER_REGISTER_DEVICE_INFORMATION_SVC: { |