Add new L2CAP socket API to get the maximum buffer size
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
index b892916..1ecd95c 100644 (file)
@@ -880,6 +880,10 @@ typedef enum {
        BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED, /** <GATT Client service change event */
        BLUETOOTH_EVENT_GATT_SERVER_ACQUIRE_WRITE, /** <GATT Characteristic/Descriptor Value change event */
        BLUETOOTH_EVENT_GATT_SERVER_ACQUIRE_NOTIFY,
+       BLUETOOTH_EVENT_GATT_SERVER_PHY_READ, /**<Local Gatt Server PHY Read event */
+       BLUETOOTH_EVENT_GATT_SERVER_PHY_UPDATED, /**<Local Gatt Server PHY Updated event */
+       BLUETOOTH_EVENT_GATT_CLIENT_PHY_READ, /**<Gatt Client PHY Read event */
+       BLUETOOTH_EVENT_GATT_CLIENT_PHY_UPDATED, /**<Gatt Client PHY Updated event */
        BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
        BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
        BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
@@ -1361,6 +1365,13 @@ typedef struct {
        unsigned int status; /** < status of the MTU exchange */
 } bluetooth_le_att_mtu_info_t;
 
+typedef struct {
+       bluetooth_device_address_t device_address;      /**< device address */
+       int tx_phy;     /** < tx_phy set for the gatt connection */
+       int rx_phy; /** < rx_phy set for the gatt connection */
+       int status; /** < status of the PHY */
+} bluetooth_le_phy_info_t;
+
 /**
  * structure to hold the paired device information
  */
@@ -6674,6 +6685,88 @@ int bluetooth_get_att_mtu(const bluetooth_device_address_t *device_address,
                                unsigned int *mtu);
 
 /**
+ * @fn int bluetooth_gatt_server_read_phy(const bluetooth_device_address_t *device_address)
+ * @brief Gets the PHY values set for a connection.
+ *
+ * This function is a asynchronous call. The updated PHYs are notified
+ * through callback event.
+ *
+ * @return   BLUETOOTH_ERROR_NONE  - Success \n
+ *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ *           BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
+ *
+ * @exception  None
+ * @param[in]  address - remote device address value.
+ *
+ * @remark       None
+ */
+int bluetooth_gatt_server_read_phy(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_gatt_server_set_phy(const bluetooth_device_address_t *device_address,
+                               int tx_phy, int rx_phy, int phy_options)
+ * @brief Request a change of the PHY values.
+ *
+ * This function is a asynchronous call. The updated PHYs are notified
+ * through callback event.
+ *
+ * @return      BLUETOOTH_ERROR_NONE  - Success \n
+ *                      BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ *                      BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
+ *
+ * @exception  None
+ * @param[in]  address - remote device address value.
+ * @param[in]  tx_phy The preferred sender PHY
+ * @param[in]  rx_phy The preferred receiver PHY
+ * @param[in]  phy_options The preferred coding to use when transmitting on LE CODED PHY
+ *
+ * @remark              None
+ */
+int bluetooth_gatt_server_set_phy(const bluetooth_device_address_t *device_address,
+                                       int tx_phy, int rx_phy, int phy_options);
+
+/**
+ * @fn int bluetooth_gatt_client_read_phy(const bluetooth_device_address_t *device_address)
+ * @brief Gets the PHY values set for a connection.
+ *
+ * This function is a asynchronous call. The updated PHYs are notified
+ * through callback event.
+ *
+ * @return   BLUETOOTH_ERROR_NONE  - Success \n
+ *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ *           BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
+ *
+ * @exception  None
+ * @param[in]  address - remote device address value.
+ *
+ * @remark       None
+ */
+int bluetooth_gatt_client_read_phy(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_gatt_client_set_phy(const bluetooth_device_address_t *device_address,
+                               int tx_phy, int rx_phy, int phy_options)
+ * @brief Request a change of the PHY values.
+ *
+ * This function is a asynchronous call. The updated PHYs are notified
+ * through callback event.
+ *
+ * @return      BLUETOOTH_ERROR_NONE  - Success \n
+ *                      BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ *                      BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
+ *
+ * @exception  None
+ * @param[in]  address - remote device address value.
+ * @param[in]  tx_phy The preferred sender PHY
+ * @param[in]  rx_phy The preferred receiver PHY
+ * @param[in]  phy_options The preferred coding to use when transmitting on LE CODED PHY
+ *
+ * @remark              None
+ */
+int bluetooth_gatt_client_set_phy(const bluetooth_device_address_t *device_address,
+                                       int tx_phy, int rx_phy, int phy_options);
+
+/**
  * @fn int bluetooth_get_device_ida(const bluetooth_device_address_t *device_rpa,
  *                                     bluetooth_device_address_t *id_address)
  * @brief Gets the Identity address of remote device.
@@ -8495,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);
 
 /**
  * @}