From 63d79739acda75794dc123445e9eebbef1b69583 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Mon, 20 Mar 2017 19:57:05 +0900 Subject: [PATCH] Publish GATT MTU Exchange APIs to Native public API Change-Id: Id1a134752e8c383a5d307ecffd89c48b5b803b19 Signed-off-by: DoHyun Pyun --- include/bluetooth.h | 81 ++++++++++++++++++++++++++++ include/bluetooth_internal.h | 12 +++-- include/bluetooth_private.h | 2 + include/bluetooth_type.h | 32 ++++++++++++ include/bluetooth_type_internal.h | 2 + src/bluetooth-common.c | 25 ++++++--- src/bluetooth-device.c | 2 +- src/bluetooth-gatt.c | 83 +++++++++++++++++++++++++++++ test/bt_unit_test.c | 87 +++++++++++++++++++++++++++++++ test/bt_unit_test.h | 4 ++ 10 files changed, 319 insertions(+), 11 deletions(-) diff --git a/include/bluetooth.h b/include/bluetooth.h index c009349..cfd257a 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -4815,6 +4815,87 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, int bt_gatt_client_write_value(bt_gatt_h gatt_handle, bt_gatt_client_request_completed_cb callback, void *user_data); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Requests a change of the ATT MTU value. + * @since_tizen 4.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/bluetooth + * + * @param[in] client The created GATT client's handle + * @param[in] mtu The new MTU value + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @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_client_set_att_mtu_changed_cb() + */ +int bt_gatt_client_request_att_mtu_change(bt_gatt_client_h client, unsigned int mtu); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Gets the ATT MTU value set for a connection. + * @since_tizen 4.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/bluetooth + * + * @param[in] client The created GATT client's handle + * @param[ot] mtu The MTU value set for a connection + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @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 + */ +int bt_gatt_client_get_att_mtu(bt_gatt_client_h client, unsigned int *mtu); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Registers a callback function to be invoked when the ATT MTU is changed. + * @since_tizen 4.0 + * @param[in] client The created GATT client's handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @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_SUPPORTED Not supported + * + * @pre The Bluetooth service must be initialized with bt_initialize(). + * @post bt_device_connection_state_changed_cb() will be invoked. + * @see bt_initialize() + * @see bt_gatt_client_request_att_mtu_change() + * @see bt_gatt_client_unset_att_mtu_changed_cb() + */ +int bt_gatt_client_set_att_mtu_changed_cb(bt_gatt_client_h client, bt_gatt_client_att_mtu_changed_cb callback, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Unregisters the callback function to be invoked when the ATT MTU is changed. + * @since_tizen 4.0 + * @param[in] client The created GATT client's handle + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth service must be initialized with bt_initialize(). + * @see bt_initialize() + * @see bt_gatt_client_request_att_mtu_change() + * @see bt_gatt_client_set_att_mtu_changed_cb() + */ +int bt_gatt_client_unset_att_mtu_changed_cb(bt_gatt_client_h client); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Registers a callback function to be invoked when the characteristic value is changed on the remote device. diff --git a/include/bluetooth_internal.h b/include/bluetooth_internal.h index 977746d..eebc80f 100644 --- a/include/bluetooth_internal.h +++ b/include/bluetooth_internal.h @@ -947,6 +947,7 @@ int bt_device_set_trusted_profile_cb(bt_device_trusted_profiles_cb callback, voi int bt_device_unset_trusted_profile_cb(void); /** + * @deprecated Deprecated since 4.0. Use bt_gatt_client_request_att_mtu_change instead. * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Request to change ATT MTU value * @since_tizen 3.0 @@ -965,9 +966,10 @@ int bt_device_unset_trusted_profile_cb(void); * @retval #BT_ERROR_PERMISSION_DENIED Permission denied * @retval #BT_ERROR_NOT_SUPPORTED Not supported */ -int bt_device_request_att_mtu(const char *remote_address, unsigned int mtu); +int bt_device_request_att_mtu(const char *remote_address, unsigned int mtu) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 4.0. Use bt_gatt_client_get_att_mtu instead. * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Gets the ATT MTU value set for a connection * @since_tizen 3.0 @@ -986,9 +988,10 @@ int bt_device_request_att_mtu(const char *remote_address, unsigned int mtu); * @retval #BT_ERROR_PERMISSION_DENIED Permission denied * @retval #BT_ERROR_NOT_SUPPORTED Not supported */ -int bt_device_get_att_mtu(const char *remote_address, unsigned int *mtu); +int bt_device_get_att_mtu(const char *remote_address, unsigned int *mtu) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 4.0. Use bt_gatt_client_set_att_mtu_changed_cb instead. * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Registers a callback function to be invoked when the ATT MTU is changed. * @since_tizen 3.0 @@ -1005,9 +1008,10 @@ int bt_device_get_att_mtu(const char *remote_address, unsigned int *mtu); * @see bt_initialize() * @see bt_device_unset_att_mtu_changed_cb() */ -int bt_device_set_att_mtu_changed_cb(bt_device_att_mtu_changed_cb callback, void *user_data); +int bt_device_set_att_mtu_changed_cb(bt_device_att_mtu_changed_cb callback, void *user_data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 4.0. Use bt_gatt_client_unset_att_mtu_changed_cb instead. * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Unregisters the callback function to be invoked when the ATT MTU is changed. * @since_tizen 3.0 @@ -1020,7 +1024,7 @@ int bt_device_set_att_mtu_changed_cb(bt_device_att_mtu_changed_cb callback, void * @see bt_initialize() * @see bt_device_set_att_mtu_changed_cb() */ -int bt_device_unset_att_mtu_changed_cb(void); +int bt_device_unset_att_mtu_changed_cb(void) TIZEN_DEPRECATED_API; /** * @internal diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 5e911f8..6d32366 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -311,8 +311,10 @@ typedef struct { bool services_discovered; bool connected; + bt_gatt_client_att_mtu_changed_cb att_mtu_changed_cb; bt_gatt_client_service_changed_cb service_changed_cb; void *service_changed_user_data; + void *att_mtu_changed_user_data; } bt_gatt_client_s; typedef struct { diff --git a/include/bluetooth_type.h b/include/bluetooth_type.h index a89e68d..2c4f4c1 100644 --- a/include/bluetooth_type.h +++ b/include/bluetooth_type.h @@ -1825,6 +1825,38 @@ typedef void (*bt_gatt_characteristic_descriptor_discovered_cb) (int result, typedef bool (*bt_gatt_foreach_cb) (int total, int index, bt_gatt_h gatt_handle, void *user_data); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Attribute protocol MTU change information structure. + * @since_tizen 4.0 + * + * @see bt_gatt_client_att_mtu_changed_cb() + */ +typedef struct { + char *remote_address; /**< The address of remote device */ + unsigned int mtu; /**< MTU value */ + unsigned int status; /**< Request status*/ +} bt_gatt_client_att_mtu_info_s; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when the ATT MTU value is changed. + * @since_tizen 4.0 + * + * @remarks The @a mtu_info must not be freed by application. + * @a mtu_info can be used only inside the callback. + * If it's needed outside, make a copy. + * + * @param[in] client The handle of a GATT client which is associated with a remote device + * @param[in] mtu_info The MTU information + * @param[in] user_data The user data passed from the callback registration function + * @see bt_gatt_client_set_connection_state_changed_cb() + * @see bt_gatt_client_unset_connection_state_changed_cb() + */ +typedef void (*bt_gatt_client_att_mtu_changed_cb)(bt_gatt_client_h client, + const bt_gatt_client_att_mtu_info_s *mtu_info, + void *user_data); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Called when the client request(e.g. read / write) has been completed diff --git a/include/bluetooth_type_internal.h b/include/bluetooth_type_internal.h index 11960bb..4805553 100644 --- a/include/bluetooth_type_internal.h +++ b/include/bluetooth_type_internal.h @@ -644,6 +644,7 @@ typedef void (*bt_device_trusted_profiles_cb) (int result, char *remote_address, int trusted_profile, bool supported, bool trusted, void *user_data); /** + * @deprecated Deprecated since 4.0. Use bt_gatt_client_att_mtu_info_s instead. * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Attribute protocol MTU change information structure. * @since_tizen 3.0 @@ -657,6 +658,7 @@ typedef struct { } bt_device_att_mtu_info_s; /** + * @deprecated Deprecated since 4.0. Use bt_gatt_client_att_mtu_changed_cb instead. * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Called when the connection state is changed. * @since_tizen 3.0 diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 7d1b12e..8815a90 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -733,9 +733,9 @@ static void __bt_free_bt_device_sdp_info_s(bt_device_sdp_info_s *sdp_info) sdp_info = NULL; } -static int __bt_get_bt_device_att_mtu_info_s(bt_device_att_mtu_info_s **dest, bluetooth_le_att_mtu_info_t *source) +static int __bt_get_bt_gatt_client_att_mtu_info_s(bt_gatt_client_att_mtu_info_s **dest, bluetooth_le_att_mtu_info_t *source) { - *dest = (bt_device_att_mtu_info_s *)g_malloc0(sizeof(bt_device_att_mtu_info_s)); + *dest = (bt_gatt_client_att_mtu_info_s *)g_malloc0(sizeof(bt_gatt_client_att_mtu_info_s)); if (*dest == NULL) return BT_ERROR_OUT_OF_MEMORY; @@ -1048,6 +1048,7 @@ static bool __bt_need_to_handle(int event) case BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED: case BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_COMPLETED: case BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED: + case BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED: case BLUETOOTH_EVENT_TDS_TRANSPORT_DATA_RECEIVED: case BLUETOOTH_EVENT_TDS_ACTIVATION_RESULT: case BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED: @@ -2438,12 +2439,24 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us bt_event_slot_container[event_index].user_data); break; case BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED: { - bt_device_att_mtu_info_s *mtu_info = NULL; + bt_gatt_client_att_mtu_info_s *mtu_info = NULL; + bt_gatt_client_s *client = NULL; BT_INFO("BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED"); - __bt_get_bt_device_att_mtu_info_s(&mtu_info, (bluetooth_le_att_mtu_info_t *)(param->param_data)); - ((bt_device_att_mtu_changed_cb)bt_event_slot_container[event_index].callback) - (_bt_get_error_code(param->result), mtu_info, bt_event_slot_container[event_index].user_data); + __bt_get_bt_gatt_client_att_mtu_info_s(&mtu_info, (bluetooth_le_att_mtu_info_t *)(param->param_data)); + + client = _bt_gatt_get_client(mtu_info->remote_address); + + if (client && client->connected && client->att_mtu_changed_cb) + client->att_mtu_changed_cb(client, + (const bt_gatt_client_att_mtu_info_s *)mtu_info, + client->att_mtu_changed_user_data); + + if (bt_event_slot_container[event_index].callback) + ((bt_device_att_mtu_changed_cb)bt_event_slot_container[event_index].callback) + (_bt_get_error_code(param->result), (bt_device_att_mtu_info_s *)mtu_info, + bt_event_slot_container[event_index].user_data); + break; } case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED: diff --git a/src/bluetooth-device.c b/src/bluetooth-device.c index 94fc700..974eb55 100644 --- a/src/bluetooth-device.c +++ b/src/bluetooth-device.c @@ -401,7 +401,7 @@ int bt_device_unset_att_mtu_changed_cb(void) { BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); BT_CHECK_INIT_STATUS(); - _bt_unset_cb(BT_EVENT_DEVICE_CONNECTION_STATUS); + _bt_unset_cb(BT_EVENT_GATT_ATT_MTU_CHANGE_STATUS); return BT_ERROR_NONE; } diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index 1863192..7d51c4b 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -3246,3 +3246,86 @@ int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client) return BT_ERROR_NONE; } + +int bt_gatt_client_request_att_mtu_change(bt_gatt_client_h client, unsigned int mtu) +{ + int ret; + bluetooth_device_address_t addr_hex = { {0,} }; + bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; + + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_INIT_STATUS(); + BT_CHECK_INPUT_PARAMETER(client); + + _bt_convert_address_to_hex(&addr_hex, client_s->remote_address); + + ret = _bt_get_error_code(bluetooth_request_att_mtu(&addr_hex, mtu)); + if (BT_ERROR_NONE != ret) + BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); + + return ret; +} + +int bt_gatt_client_get_att_mtu(bt_gatt_client_h client, unsigned int *mtu) +{ + bluetooth_device_address_t addr_hex = { {0,} }; + int ret; + unsigned int mtu_value = 0; + bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; + + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_INIT_STATUS(); + BT_CHECK_INPUT_PARAMETER(client); + + _bt_convert_address_to_hex(&addr_hex, client_s->remote_address); + + ret = _bt_get_error_code(bluetooth_get_att_mtu(&addr_hex, &mtu_value)); + + if (ret != BT_ERROR_NONE) { + BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); + return ret; + } + + *mtu = mtu_value; + + return ret; + +} + +int bt_gatt_client_set_att_mtu_changed_cb(bt_gatt_client_h client, bt_gatt_client_att_mtu_changed_cb callback, void *user_data) +{ + bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; + + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_INIT_STATUS(); + BT_CHECK_INPUT_PARAMETER(callback); + BT_CHECK_INPUT_PARAMETER(client); + + if (client_s->att_mtu_changed_cb) { + BT_INFO("Already registered"); + client_s->att_mtu_changed_cb = callback; + client_s->att_mtu_changed_user_data = user_data; + return BT_ERROR_NONE; + } + + BT_INFO("MTU Changed callback registered"); + client_s->att_mtu_changed_cb = callback; + client_s->att_mtu_changed_user_data = user_data; + + return BT_ERROR_NONE; +} + +int bt_gatt_client_unset_att_mtu_changed_cb(bt_gatt_client_h client) +{ + bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; + + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_INIT_STATUS(); + BT_CHECK_INPUT_PARAMETER(client); + + BT_INFO("MTU Changed callback unregistered [%s]", client_s->remote_address); + client_s->service_changed_cb = NULL; + client_s->service_changed_user_data = NULL; + + return BT_ERROR_NONE; +} diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index 273f9f8..a8f0c0e 100644 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -580,10 +580,18 @@ tc_table_t tc_gatt[] = { , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_CHAR_VALUE_CHANGED_CB}, {"bt_gatt_client_foreach_services" , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_FOREACH_SERVICES}, + {"bt_gatt_client_request_att_mtu_change" + , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_REQUEST_ATT_MTU}, + {"bt_gatt_client_get_att_mtu" + , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_GET_ATT_MTU}, {"bt_gatt_client_set_service_changed_cb" , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_SERVICE_CHANGED_CB}, {"bt_gatt_client_unset_service_changed_cb" , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_SERVICE_CHANGED_CB}, + {"bt_gatt_client_set_att_mtu_changed_cb" + , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_ATT_MTU_CHANGED_CB}, + {"bt_gatt_client_unset_att_mtu_changed_cb" + , BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_ATT_MTU_CHANGED_CB}, {"bt_gatt_server_initialize" , BT_UNIT_TEST_FUNCTION_GATT_SERVER_INITIALIZE}, {"bt_gatt_server_deinitilaize" @@ -2169,6 +2177,28 @@ void __bt_gatt_client_service_changed_cb(bt_gatt_client_h c, g_free(addr); } +void __bt_gatt_client_att_mtu_changed_cb(bt_gatt_client_h c, const bt_gatt_client_att_mtu_info_s *mtu_info, void *user_data) +{ + char *addr = NULL; + int ret; + + TC_PRT("__bt_gatt_client_att_mtu_changed_cb"); + + ret = bt_gatt_client_get_remote_address(client, &addr); + if (ret != BT_ERROR_NONE) { + TC_PRT("Cannot get remote address"); + return; + } + + if (mtu_info) { + TC_PRT("status [%d]", mtu_info->status); + TC_PRT("address [%s]", mtu_info->remote_address); + TC_PRT("MTU [%d]", mtu_info->mtu); + } + + g_free(addr); +} + int __bt_gatt_client_set_value(char *type, char *value, bt_gatt_h h) { int ret; @@ -3944,6 +3974,34 @@ int test_set_params(int test_id, char *param) break; } + case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_REQUEST_ATT_MTU: { + if (param_index == 0) { + g_test_param.param_count = 1; + g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count); + param_type = "int(1, 2, 10, ...., 512)"; + } + + if (param_index > 0) { + g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1); + strncpy(g_test_param.params[param_index - 1], param, strlen(param)); + } + + if (param_index == g_test_param.param_count) { + need_to_set_params = false; +#ifdef ARCH64 + test_input_callback((void *)(uintptr_t)test_id); +#else + test_input_callback((void *)test_id); +#endif + param_index = 0; + return 0; + } + + TC_PRT("Input param(%d) : %s", param_index + 1, param_type); + param_index++; + + break; + } case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_CHAR_VALUE_CHANGED_CB: { if (param_index == 0) { g_test_param.param_count = 2; @@ -6697,6 +6755,25 @@ int test_input_callback(void *data) TC_PRT("bt_gatt_client_foreach_services_by_uuid is failed"); break; } + case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_REQUEST_ATT_MTU: { + unsigned int mtu = 512; /* MAX MTU Value */ + + if (g_test_param.param_count > 0) { + mtu = atoi(g_test_param.params[0]); + + __bt_free_test_param(&g_test_param); + } + + ret = bt_gatt_client_request_att_mtu_change(client, mtu); + TC_PRT("returns %s\n", __bt_get_error_message(ret)); + break; + } + case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_GET_ATT_MTU: { + unsigned int mtu = 0; + ret = bt_gatt_client_get_att_mtu(client, &mtu); + TC_PRT("returns %s, MTU %d\n", __bt_get_error_message(ret), mtu); + break; + } case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_SERVICE_CHANGED_CB: { ret = bt_gatt_client_set_service_changed_cb(client, __bt_gatt_client_service_changed_cb, NULL); @@ -6710,6 +6787,16 @@ int test_input_callback(void *data) TC_PRT("bt_gatt_client_unset_service_changed_cb is failed"); break; } + case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_ATT_MTU_CHANGED_CB: { + ret = bt_gatt_client_set_att_mtu_changed_cb(client, __bt_gatt_client_att_mtu_changed_cb, NULL); + TC_PRT("returns %s\n", __bt_get_error_message(ret)); + break; + } + case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_ATT_MTU_CHANGED_CB: { + ret = bt_gatt_client_unset_att_mtu_changed_cb(client); + TC_PRT("returns %s\n", __bt_get_error_message(ret)); + break; + } case BT_UNIT_TEST_FUNCTION_GATT_SERVER_INITIALIZE: { ret = bt_gatt_server_initialize(); diff --git a/test/bt_unit_test.h b/test/bt_unit_test.h index f5b210a..3457df7 100644 --- a/test/bt_unit_test.h +++ b/test/bt_unit_test.h @@ -231,8 +231,12 @@ typedef enum { BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_CHAR_VALUE_CHANGED_CB, BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_CHAR_VALUE_CHANGED_CB, BT_UNIT_TEST_FUNCTION_GATT_CLIENT_FOREACH_SERVICES, + BT_UNIT_TEST_FUNCTION_GATT_CLIENT_REQUEST_ATT_MTU, + BT_UNIT_TEST_FUNCTION_GATT_CLIENT_GET_ATT_MTU, BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_SERVICE_CHANGED_CB, BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_SERVICE_CHANGED_CB, + BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_ATT_MTU_CHANGED_CB, + BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_ATT_MTU_CHANGED_CB, BT_UNIT_TEST_FUNCTION_GATT_SERVER_INITIALIZE, BT_UNIT_TEST_FUNCTION_GATT_SERVER_DEINITIALIZE, BT_UNIT_TEST_FUNCTION_GATT_SERVER_UNREGISTER_ALL_SERVICES, -- 2.34.1