Add new L2CAP socket API to get the maximum buffer size
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
index 252c7d9..1ecd95c 100644 (file)
@@ -444,6 +444,8 @@ typedef enum {
  * Advertising data
  */
 typedef struct {
+       /* TODO : Change to BLUETOOTH_EXTENDED_ADVERTISING_DATA_LENGTH_MAX
+        * once LE EXTENDED feature is supported */
        guint8 data[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];
 } bluetooth_advertising_data_t;
 
@@ -623,6 +625,9 @@ typedef struct {
        guint8 filter_policy;
        guint8 type;
        int tx_power_level;
+       gboolean is_legacy;
+       int primary_phy;
+       int secondary_phy;
 } bluetooth_advertising_params_t;
 
 /**
@@ -875,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*/
@@ -1305,6 +1314,11 @@ typedef struct {
        guint8 data[BLUETOOTH_EXTENDED_ADVERTISING_DATA_LENGTH_MAX];
 } bluetooth_extended_advertising_data_t;
 
+typedef struct{
+       gboolean use_reserved_slot;
+       gboolean is_legacy;
+} bluetooth_le_slot_and_adv_type_t;
+
 typedef struct {
        int data_len;           /**< manafacturer specific data length */
        bluetooth_extended_advertising_data_t data;             /**< manafacturer specific data */
@@ -1351,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
  */
@@ -6306,7 +6327,7 @@ int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *len
  *
  * @remark     None
  */
-int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
+int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length, bool is_legacy);
 
 /**
  * @fn int bluetooth_check_privilege_advertising_parameter(void);
@@ -6664,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.
@@ -8485,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);
 
 /**
  * @}