From 4d502d87556b6c407482dd654d6b0f417af971a5 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Tue, 27 Feb 2024 13:51:09 +0900 Subject: [PATCH] Add new L2CAP socket API to get the maximum buffer size Change-Id: Id530fded18e3803f5a26064ca5233ed45da9f4e5 Signed-off-by: Wootak Jung --- bt-api/bt-l2cap-le-client.c | 10 ++++++++++ include/bluetooth-api.h | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/bt-api/bt-l2cap-le-client.c b/bt-api/bt-l2cap-le-client.c index 65925db..639d0cb 100644 --- a/bt-api/bt-l2cap-le-client.c +++ b/bt-api/bt-l2cap-le-client.c @@ -543,3 +543,13 @@ BT_EXPORT_API int bluetooth_l2cap_le_write(int fd, const char *buf, int length) return result; } + +BT_EXPORT_API int bluetooth_l2cap_le_get_max_buffer_size(int *size) +{ + BT_CHECK_ENABLED_LE(return); + BT_CHECK_PARAMETER(size, return); + + *size = BT_L2CAP_LE_BUFFER_LEN; + + return BLUETOOTH_ERROR_NONE; +} diff --git a/include/bluetooth-api.h b/include/bluetooth-api.h index 30a313c..1ecd95c 100644 --- a/include/bluetooth-api.h +++ b/include/bluetooth-api.h @@ -8588,6 +8588,23 @@ int bluetooth_l2cap_le_server_is_connected( */ int bluetooth_l2cap_le_get_psm(int id, int *psm); +/** + * @fn gboolean bluetooth_l2cap_le_get_max_buffer_size(int *size) + * @brief gives the maximum size of buffer. + * + * This function is a synchronous call. + * + * @return BLUETOOTH_ERROR_NONE - Success \n + * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n + * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n + * + * @param[out] int *size + * + * @exception None + * + * @remark None + */ +int bluetooth_l2cap_le_get_max_buffer_size(int *size); /** * @} -- 2.7.4