/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Gets the ATT MTU value set for a connection.
+ * @since_tizen 5.5
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[out] 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_NOT_SUPPORTED Not supported
+ * @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
+ */
+int bt_gatt_server_get_device_mtu(const char *remote_address, unsigned int *mtu);
+
+/**
* @WEARABLE_ONLY
* @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
* @brief Initializes the Bluetooth PBAP Client.
return ret;
}
+int bt_gatt_server_get_device_mtu(const char *remote_address, unsigned int *mtu)
+{
+ bluetooth_device_address_t addr_hex = { {0,} };
+ int ret;
+ unsigned int mtu_value = 0;
+
+ BT_CHECK_GATT_SERVER_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address);
+
+ _bt_convert_address_to_hex(&addr_hex, 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_server_foreach_services(bt_gatt_server_h server,
bt_gatt_foreach_cb callback, void *user_data)
{
, BT_UNIT_TEST_FUNCTION_GATT_SERVER_UNREGISTER_ALL_SERVICES},
{"bt_gatt_server_foreach_services"
, BT_UNIT_TEST_FUNCTION_GATT_SERVER_FOREACH_SERVICES},
+ {"bt_gatt_server_get_device_mtu"
+ , BT_UNIT_TEST_FUNCTION_GATT_SERVER_GET_DEVICE_MTU},
{"Register Battery Service"
, BT_UNIT_TEST_FUNCTION_GATT_SERVER_REGISTER_BATTERY_SVC},
{"Change Battery Level"
TC_PRT("bt_gatt_server_foreach_services: %s\n", __bt_get_error_message(ret));
break;
}
+ case BT_UNIT_TEST_FUNCTION_GATT_SERVER_GET_DEVICE_MTU: {
+ unsigned int mtu = 0;
+ ret = bt_gatt_server_get_device_mtu(remote_addr, &mtu);
+ TC_PRT("returns %s, MTU %d\n", __bt_get_error_message(ret), mtu);
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ANCS_PAIR: {
bt_device_connection_link_type_e link_type = BT_DEVICE_CONNECTION_LINK_LE;
BT_UNIT_TEST_FUNCTION_GATT_SERVER_DEINITIALIZE,
BT_UNIT_TEST_FUNCTION_GATT_SERVER_UNREGISTER_ALL_SERVICES,
BT_UNIT_TEST_FUNCTION_GATT_SERVER_FOREACH_SERVICES,
+ BT_UNIT_TEST_FUNCTION_GATT_SERVER_GET_DEVICE_MTU,
BT_UNIT_TEST_FUNCTION_GATT_SERVER_REGISTER_BATTERY_SVC,
BT_UNIT_TEST_FUNCTION_GATT_SERVER_CHANGE_BATTERY_LEVEL,
BT_UNIT_TEST_FUNCTION_GATT_SERVER_REGISTER_HEART_RATE_SVC,