From 5890cebf97ad2e0a09598aa698683a0afc5de0b6 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Mon, 11 Apr 2022 08:47:16 +0900 Subject: [PATCH] Add new APIs for L2CAP LE CoC functionality - add new feature: tizen.org/feature/network.bluetooth.le.coc To avoid build conflict please merge this patch after merging framework patch:(Change-Id: Icf4d8a51acc444765a9b61224a3a5d3fd26bfa65) Change-Id: I193513b0524daeac8e8c538f8226285ccc07a895 Signed-off-by: Anuj Jain --- doc/bluetooth_doc.h | 83 +++++++++++++++++++++++++++++++++++++ include/bluetooth_private.h | 1 + src/bluetooth-common.c | 1 + 3 files changed, 85 insertions(+) diff --git a/doc/bluetooth_doc.h b/doc/bluetooth_doc.h index 9fb2f01..30d039c 100644 --- a/doc/bluetooth_doc.h +++ b/doc/bluetooth_doc.h @@ -391,6 +391,89 @@ * Please refer Bluetooth Tutorial if you want to get more detailed usages and information of this api. */ +/** + * @defgroup CAPI_NETWORK_BLUETOOTH_L2CAP_SOCKET_MODULE Bluetooth L2CAP Socket + * @brief Bluetooth L2CAP Socket API provides functions for managing connections to other devices and exchanging data. + * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE + * + * @section CAPI_NETWORK_BLUETOOTH_L2CAP_SOCKET_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_NETWORK_BLUETOOTH_L2CAP_SOCKET_MODULE_OVERVIEW Overview + * This set of functions is used for exchanging data between two bluetooth + * devices, our device can have both roles as server (service provider) and client + * (service user). + * Depending on the role, there is difference in creating a connection. + * After that, processes of exchanging data and disconnection are same. + * + * To start communication, you should first register for #bt_socket_set_l2cap_channel_connection_state_changed_cb() + * and #bt_socket_set_data_received_cb(). + * Next step depends on the role of your application.\n + * If you want to be \b server \b role, application should create socket + * (#bt_socket_create_l2cap_channel()), and start listening and accepting incoming connections + * (#bt_socket_listen_and_accept_l2cap_channel()). + * If you want to connect to specific device and use it's services (\a client \a role), + * you have to start connection with #bt_socket_connect_l2cap_channel() and wait for connection.\n + * After connection has been established (information is passed to your program with + * #bt_socket_l2cap_channel_connection_state_changed_cb() function call), you can exchange data by + * calling #bt_socket_send_data_l2cap_channel(). \n + * If you receive data from remote device, #bt_socket_data_received_cb() functions will be called. + * When you finish exchanging data, you should disconnect connection + * with #bt_socket_disconnect_l2cap_channel() and unregister callback functions (with using + * #bt_socket_unset_data_received_cb(), #bt_socket_unset_l2cap_channel_connection_state_changed_cb()). + * + * @section CAPI_NETWORK_BLUETOOTH_L2CAP_SOCKET_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - %http://tizen.org/feature/network.bluetooth.le.coc\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE,thereby controlling the procedure of your application.\n + * + * 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 Feature Element. + * + * @section CAPI_NETWORK_BLUETOOTH_L2CAP_SOCKET_MODULE_ASYNCHRONOUS_OPERATIONS Asynchronous Operations + *
+ * + * + * + * + * + * + * + * + * + * + *
FUNCTIONCALLBACKDESCRIPTION
bt_socket_listen_and_accept_l2cap_channel()
+ * bt_socket_connect_l2cap_channel()
bt_socket_l2cap_channel_connection_state_changed_cb()Used to connect a device.
+ * + * @section CAPI_NETWORK_BLUETOOTH_L2CAP_SOCKET_MODULE_CALLBACK_OPERATIONS Callback(Event) Operations + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
REGISTERUNREGISTERCALLBACKDESCRIPTION
bt_socket_set_data_received_cb()bt_socket_unset_data_received_cb()bt_socket_data_received_cb()Used to be notified of received data.
bt_socket_set_l2cap_channel_connection_state_changed_cb()bt_socket_unset_l2cap_channel_connection_state_changed_cb()bt_socket_l2cap_channel_connection_state_changed_cb()Used to be notified when the state of connection changes.
+ * + *
+ * Please refer Bluetooth Tutorial if you want to get more detailed usages and information of this api. + */ /** * @defgroup CAPI_NETWORK_BLUETOOTH_OPP_MODULE Bluetooth OPP diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 266dd68..0617f8b 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -606,6 +606,7 @@ typedef enum { BT_FEATURE_COMMON = BT_FEATURE_BASE, BT_FEATURE_LE, BT_FEATURE_LE_5_0, + BT_FEATURE_LE_COC, BT_FEATURE_IPSP, BT_FEATURE_MESH, BT_FEATURE_AUDIO_CALL, diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 2c5c91b..d786e12 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -310,6 +310,7 @@ static bt_feature_table_t feature_table[] = { {"tizen.org/feature/network.bluetooth", FALSE, FALSE}, /* BT_FEATURE_COMMON */ {"tizen.org/feature/network.bluetooth.le", FALSE, FALSE}, /* BT_FEATURE_LE */ {"tizen.org/feature/network.bluetooth.le.5_0", FALSE, FALSE}, /* BT_FEATURE_LE_5_0 */ + {"tizen.org/feature/network.bluetooth.le.coc", FALSE, FALSE}, /* BT_FEATURE_LE_COC */ {"tizen.org/feature/network.bluetooth.le.ipsp", FALSE, FALSE}, /* BT_FEATURE_IPSP */ {"tizen.org/feature/network.bluetooth.le.mesh", TRUE, TRUE}, /* BT_FEATURE_MESH */ {"tizen.org/feature/network.bluetooth.audio.call", FALSE, FALSE}, /* BT_FEATURE_AUDIO_CALL */ -- 2.34.1