int bt_hrp_collector_unset_connection_state_changed_cb(bt_hrp_collector_h collector);
/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
+ * @brief Gets number of available packets to be used as a threshold for GATT data batching.
+ * @since_tizen 5.5.0.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] available_packets The number of available packets to be used as a threshold.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see bt_gatt_enable_data_batching()
+ */
+int bt_gatt_get_data_batching_available_packets(int *available_packets);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
+ * @brief Enables GATT data batching.
+ * @since_tizen 5.5.0.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ * @remarks GATT data batching is disabled even if the gatt is disconnected or bt adapter is disabled.
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device for which RSSI is to be monitored.
+ * @param[in] packet_threshold The threshold of packet count for receiving data.
+ * @param[in] timeout The timeout to flush buffer.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_QUOTA_EXCEEDED Quota exceeded
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected
+ * @retval #BT_ERROR_ALREADY_DONE Already enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see bt_gatt_get_data_batching_available_packets()
+ * @see bt_gatt_disable_data_batching()
+ */
+int bt_gatt_enable_data_batching(const char *remote_address, int packet_threshold, int timeout);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
+ * @brief Disables GATT data batching.
+ * @since_tizen 5.5.0.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device for which RSSI is to be monitored.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected
+ * @retval #BT_ERROR_NOT_IN_PROGRESS Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see bt_gatt_enable_data_batching()
+ */
+int bt_gatt_disable_data_batching(const char *remote_address);
+
+/**
* @}
*/
#include <bluetooth-api.h>
#include "bluetooth.h"
-#include "bluetooth_private.h"
#include "bluetooth_internal.h"
-#include "bluetooth_type_internal.h"
+#include "bluetooth_private.h"
#ifdef TIZEN_FEATURE_GATT_RELAY
#include "bluetooth-gatt-server-api.h"
}
/* LCOV_EXCL_START */
+int bt_gatt_get_data_batching_available_packets(int *available_packets)
+{
+ int ret;
+
+ BT_CHECK_GATT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(available_packets);
+
+ ret = _bt_get_error_code(
+ bluetooth_get_gatt_data_batching_available_packets(available_packets));
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
+
+ return ret;
+}
+
+int bt_gatt_enable_data_batching(const char *remote_address, int packet_threshold, int timeout)
+{
+ int ret;
+ bluetooth_device_address_t bd_addr = { {0,} };
+
+ if (packet_threshold <= 0 || packet_threshold > 0x7FFF) {
+ BT_ERR("Invalid buffer_threshold(%d)", packet_threshold);
+ return BT_ERROR_INVALID_PARAMETER;
+ }
+ if (timeout <= 0 || timeout > 0x7FFF) {
+ BT_ERR("Invalid timeout(%d)", timeout);
+ return BT_ERROR_INVALID_PARAMETER;
+ }
+
+ BT_CHECK_GATT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address);
+ _bt_convert_address_to_hex(&bd_addr, remote_address);
+
+ ret = _bt_get_error_code(bluetooth_enable_gatt_data_batching(&bd_addr,
+ packet_threshold, timeout));
+
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
+
+ return ret;
+}
+
+int bt_gatt_disable_data_batching(const char *remote_address)
+{
+ int ret;
+ bluetooth_device_address_t bd_addr = { {0,} };
+
+ BT_CHECK_GATT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address);
+ _bt_convert_address_to_hex(&bd_addr, remote_address);
+
+ ret = _bt_get_error_code(bluetooth_disable_gatt_data_batching(&bd_addr));
+
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
+
+ return ret;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
static void __bt_gatt_free_descriptor(bt_gatt_h gatt_handle)
{
bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s *)gatt_handle;
, BT_UNIT_TEST_FUNCTION_ANCS_NEGATIVE_ACTION},
{"ANCS (Get Noti. Attr.)"
, BT_UNIT_TEST_FUNCTION_ANCS_GET_NOTI_ATTR},
+ {"bt_gatt_get_available_data_batching_packets"
+ , BT_UNIT_TEST_FUNCTION_GATT_GET_DATA_BATCHING_AVAILABLE_PACKETS},
+ {"bt_gatt_enable_data_batching"
+ , BT_UNIT_TEST_FUNCTION_GATT_ENABLE_DATA_BATCHING},
+ {"bt_gatt_disable_data_batching"
+ , BT_UNIT_TEST_FUNCTION_GATT_DISABLE_DATA_BATCHING},
{"Select this menu to set parameters and then select the function again."
, BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS},
{NULL , 0x0000},
{
TC_PRT("[HR]Result : %d", result);
}
+
void _bt_hrp_collector_bsl_read_completed_cb(int result,
bt_hrp_collector_h request_handle, bt_body_sensor_location_e location, void *user_data)
{
param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
break;
+ case BT_UNIT_TEST_FUNCTION_GATT_ENABLE_DATA_BATCHING: {
+ param_count = 2;
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input buffer_threshold (1 ~ 32767)");
+ break;
+ case 1:
+ TC_PRT("Input timeout (1 ~ 32767)");
+ break;
+ }
+ break;
+ }
default:
TC_PRT("There is no param to set\n");
need_to_set_params = false;
break;
}
+ case BT_UNIT_TEST_FUNCTION_GATT_GET_DATA_BATCHING_AVAILABLE_PACKETS: {
+ int available = 0;
+ ret = bt_gatt_get_data_batching_available_packets(&available);
+ TC_PRT("returns %s, (available:%d)\n", __bt_get_error_message(ret), available);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_GATT_ENABLE_DATA_BATCHING: {
+ int packet_threshold = 30;
+ int timeout = 20;
+
+ if (g_test_param.param_count > 0) {
+ packet_threshold = atoi(g_test_param.params[0]);
+ timeout = atoi(g_test_param.params[1]);
+
+ __bt_free_test_param(&g_test_param);
+ }
+
+ ret = bt_gatt_enable_data_batching(remote_addr, packet_threshold, timeout);
+ TC_PRT("returns %s, (packet_threshold:%d, timeout:%d)\n", __bt_get_error_message(ret), packet_threshold, timeout);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_GATT_DISABLE_DATA_BATCHING: {
+ ret = bt_gatt_disable_data_batching(remote_addr);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
need_to_set_params = true;
TC_PRT("Select the function again");
BT_UNIT_TEST_FUNCTION_GATT_READ_CHARACTERISTIC_VALUE,
BT_UNIT_TEST_FUNCTION_GATT_WATCH_CHARACTERISTIC_CHANGES,
BT_UNIT_TEST_FUNCTION_GATT_UNWATCH_CHARACTERISTIC_CHANGES,
+ BT_UNIT_TEST_FUNCTION_GATT_GET_DATA_BATCHING_AVAILABLE_PACKETS,
+ BT_UNIT_TEST_FUNCTION_GATT_ENABLE_DATA_BATCHING,
+ BT_UNIT_TEST_FUNCTION_GATT_DISABLE_DATA_BATCHING,
BT_UNIT_TEST_FUNCTION_HPS_CLIENT_CREATE = 1,
BT_UNIT_TEST_FUNCTION_HPS_CLIENT_DESTROY,
BT_UNIT_TEST_FUNCTION_HPS_CLIENT_PRINT_ALL,