BT_INFO("LE CODED PHY Support[%s]", *is_supported ? "TRUE" : "FALSE");
return result;
}
+
+BT_EXPORT_API int bluetooth_is_le_extended_advertising_supported(gboolean *is_supported)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(is_supported, return);
+ BT_CHECK_ENABLED_ANY(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_IS_LE_EXTENDED_ADVERTISING_SUPPORTED,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ *is_supported = g_array_index(out_param, int, 0);
+ } else {
+ BT_ERR("Fail to send request");
+ }
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ BT_INFO("LE Extended Advertising Support[%s]", *is_supported ? "TRUE" : "FALSE");
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_is_le_extended_scan_supported(gboolean *is_supported)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(is_supported, return);
+ BT_CHECK_ENABLED_ANY(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_IS_LE_EXTENDED_SCAN_SUPPORTED,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ *is_supported = g_array_index(out_param, int, 0);
+ } else {
+ BT_ERR("Fail to send request");
+ }
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ BT_INFO("LE Extended Scan Support[%s]", *is_supported ? "TRUE" : "FALSE");
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_le_get_maximum_advertising_data_length(gint *data_length)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(data_length, return);
+ BT_CHECK_ENABLED_ANY(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_MAX_ADVERTISING_DATA_LEN,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ *data_length = g_array_index(out_param, int, 0);
+ } else {
+ BT_ERR("Fail to send request");
+ }
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ BT_INFO("LE Max Advertising Data Length [%d]", *data_length);
+ return result;
+}
int max_filter;
int le_2m_phy;
int le_coded_phy;
+ int le_extended_advertising;
+ int le_extended_scan;
+ int max_advertising_len;
} bt_adapter_le_feature_info_t;
typedef struct {
bt_uuid_t app_uuid;
} bt_adapter_le_adv_slot_t;
-static bt_adapter_le_feature_info_t le_feature_info = { 1, 0, 0 };
+static bt_adapter_le_feature_info_t le_feature_info = { 1, 0, 0, 0, 0, 0, 0, 0 };
static bt_adapter_le_adv_slot_t *le_adv_slot = NULL;
typedef struct {
} else if (g_strcmp0(item, "2m_phy") == 0) {
if (g_strcmp0(value, "true") == 0) {
- le_feature_info.le_2m_phy = TRUE;
+ le_feature_info.le_2m_phy = 0x1;
/* Fill LE feature bytes */
- le_features->le_2m_phy_supported = 0x1;
+ le_features->le_2m_phy_supported = TRUE;
} else {
- le_feature_info.le_2m_phy = FALSE;
+ le_feature_info.le_2m_phy = 0x0;
/* Fill LE feature bytes */
- le_features->le_2m_phy_supported = 0x0;
+ le_features->le_2m_phy_supported = FALSE;
}
- INFO("2M PHY Supported [%s]", le_feature_info.le_2m_phy ? "TRUE" : "FALSE");
+ INFO("2M PHY Supported [%s]", le_feature_info.le_2m_phy ? "TRUE" : "FALSE");
} else if (g_strcmp0(item, "coded_phy") == 0) {
if (g_strcmp0(value, "true") == 0) {
- le_feature_info.le_coded_phy = TRUE;
+ le_feature_info.le_coded_phy = 0x1;
/* Fill LE feature bytes */
- le_features->le_coded_phy_supported = 0x1;
+ le_features->le_coded_phy_supported = TRUE;
} else {
- le_feature_info.le_coded_phy = FALSE;
+ le_feature_info.le_coded_phy = 0x0;
/* Fill LE feature bytes */
- le_features->le_coded_phy_supported = 0x0;
+ le_features->le_coded_phy_supported = FALSE;
}
- INFO("CODED PHY Supported [%s]", le_feature_info.le_coded_phy ? "TRUE" : "FALSE");
+ INFO("CODED PHY Supported [%s]", le_feature_info.le_coded_phy ? "TRUE" : "FALSE");
+ } else if (g_strcmp0(item, "ext_advt") == 0) {
+ if (g_strcmp0(value, "true") == 0) {
+ le_feature_info.le_extended_advertising = 0x1;
+ le_features->le_extended_advertising_supported = TRUE;
+ } else {
+ le_feature_info.le_extended_advertising = 0x0;
+ le_features->le_extended_advertising_supported = FALSE;
+ }
+ INFO("LE Extended Advertising Supported [%s]",
+ le_feature_info.le_extended_advertising ? "TRUE" : "FALSE");
+ } else if (g_strcmp0(item, "ext_scan") == 0) {
+ if (g_strcmp0(value, "true") == 0) {
+ le_feature_info.le_extended_scan = 0x1;
+ le_features->extended_scan_support = TRUE;
+ } else {
+ le_feature_info.le_extended_scan = 0x0;
+ le_features->extended_scan_support = FALSE;
+ }
+ INFO("LE Extended Scan Supported [%s]", le_feature_info.le_extended_scan ? "TRUE" : "FALSE");
+ } else if (g_strcmp0(item, "max_advt_len") == 0) {
+ le_feature_info.max_advertising_len = atoi(value);
+ le_features->le_maximum_advertising_data_length = atoi(value);
+ INFO("LE Maximum Advertising Data Length [%d]", le_feature_info.max_advertising_len);
} else {
DBG("No registered item");
return FALSE;
str += ret;
buf_len -= ret;
+ ret = snprintf(str, buf_len, "LE Extended Advertising Support: %s\n",
+ f->le_extended_advertising_supported ? "TRUE" : "FALSE");
+ if (0 > ret) {
+ ERR("snprintf failed with %d", ret);
+ return;
+ }
+ str += ret;
+ buf_len -= ret;
+
+ ret = snprintf(str, buf_len, "LE Extended Scan Support: %s\n",
+ f->extended_scan_support ? "TRUE" : "FALSE");
+ if (0 > ret) {
+ ERR("snprintf failed with %d", ret);
+ return;
+ }
+ str += ret;
+ buf_len -= ret;
+
+ ret = snprintf(str, buf_len, "Maximum Advertising Data Length: %u\n",
+ f->le_maximum_advertising_data_length);
+ if (0 > ret) {
+ ERR("snprintf failed with %d", ret);
+ return;
+ }
+ str += ret;
+ buf_len -= ret;
+
ret = snprintf(str, buf_len, "}");
if (0 > ret) {
ERR("snprintf failed with %d", ret);
str += sprintf(str, "LE Coded PHY support: %s\n",
f->le_coded_phy_supported ? "TRUE" : "FALSE");
+ str += sprintf(str, "LE Extended Advertising support: %s\n",
+ f->le_extended_advertising_supported ? "TRUE" : "FALSE");
+
+ str += sprintf(str, "LE Extended Scan support: %s\n",
+ f->extended_scan_support ? "TRUE" : "FALSE");
+
+ str += sprintf(str, "Max Advertising Data Length: %u\n",
+ f->le_maximum_advertising_data_length);
+
sprintf(str, "}");
}
uint8_t max_adv_filter;
uint8_t le_2m_phy_support;
uint8_t le_coded_phy_support;
+ uint8_t le_extended_advertising_support;
+ uint8_t le_extended_scan_support;
+ uint16_t le_maximum_advertising_data_length;
} event_adapter_le_features_t;
typedef struct {
le_features->max_adv_filter = ((bt_local_le_features_t *)(properties[i].val))->max_adv_filter_supported;
le_features->le_2m_phy_support = ((bt_local_le_features_t *)(properties[i].val))->le_2m_phy_supported;
le_features->le_coded_phy_support = ((bt_local_le_features_t *)(properties[i].val))->le_2m_phy_supported;
+ le_features->le_extended_advertising_support =
+ ((bt_local_le_features_t *)(properties[i].val))->le_extended_advertising_supported;
+ le_features->le_extended_scan_support =
+ ((bt_local_le_features_t *)(properties[i].val))->extended_scan_support;
+ le_features->le_maximum_advertising_data_length =
+ ((bt_local_le_features_t *)(properties[i].val))->le_maximum_advertising_data_length;
BT_INFO("LE 2M PHY Support (%d)", le_features->le_2m_phy_support);
BT_INFO("LE CODED PHY Support (%d)", le_features->le_coded_phy_support);
bool vendor_filter;
int le_2m_phy;
int le_coded_phy;
+ int le_extended_advertising;
+ int le_extended_scan;
+ int max_advertising_len;
} bt_adapter_le_feature_info_t;
/* Set Default values */
-static bt_adapter_le_feature_info_t le_feature_info = {1, 0, 0, false, 0, 0};
+static bt_adapter_le_feature_info_t le_feature_info = {1, 0, 0, false, 0, 0, 0, 0, 0};
typedef struct {
int adv_handle;
le_feature_info.vendor_filter = false;
}
+ le_feature_info.le_extended_advertising = le_features->le_extended_advertising_support;
+ le_feature_info.le_extended_scan = le_features->le_extended_scan_support;
+ le_feature_info.max_advertising_len = le_features->le_maximum_advertising_data_length;
+
BT_INFO("Adapter LE 2M PHY Support [%s]", le_feature_info.le_2m_phy ? "TRUE" : "FALSE");
BT_INFO("Adapter LE CODED PHY Support [%s]", le_feature_info.le_coded_phy ? "TRUE" : "FALSE");
+ BT_INFO("Adapter LE Extended Advertising Support [%s]",
+ le_feature_info.le_extended_advertising ? "TRUE" : "FALSE");
+ BT_INFO("Adapter LE Extended Scan Support [%s]",
+ le_feature_info.le_extended_scan ? "TRUE" : "FALSE");
+ BT_INFO("Adapter Maximum Advertising Data Length [%d]", le_feature_info.max_advertising_len);
break;
}
return FALSE;
}
+gboolean _bt_is_le_extended_advertising_supported(void)
+{
+ if (le_feature_info.le_extended_advertising)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+gboolean _bt_is_le_extended_scan_supported(void)
+{
+ if (le_feature_info.le_extended_scan)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+int _bt_le_get_maximum_advertising_len(void)
+{
+ return le_feature_info.max_advertising_len;
+}
+
int _bt_set_le_privacy(gboolean set_privacy)
{
int result = BLUETOOTH_ERROR_NONE;
g_array_append_vals(*out_param1, &is_coded_phy_supported, sizeof(gboolean));
break;
}
+ case BT_IS_LE_EXTENDED_ADVERTISING_SUPPORTED: {
+ gboolean is_extended_advertising_supported = FALSE;
+
+ is_extended_advertising_supported = _bt_is_le_extended_advertising_supported();
+ g_array_append_vals(*out_param1, &is_extended_advertising_supported,
+ sizeof(gboolean));
+ break;
+ }
+ case BT_IS_LE_EXTENDED_SCAN_SUPPORTED: {
+ gboolean is_extended_scan_supported = FALSE;
+
+ is_extended_scan_supported = _bt_is_le_extended_scan_supported();
+ g_array_append_vals(*out_param1, &is_extended_scan_supported, sizeof(gboolean));
+ break;
+ }
+ case BT_LE_MAX_ADVERTISING_DATA_LEN: {
+ gint max_advertising_len = 0;
+
+ max_advertising_len = _bt_le_get_maximum_advertising_len();
+ g_array_append_vals(*out_param1, &max_advertising_len, sizeof(gint));
+ break;
+ }
case BT_DISCONNECT_DEVICE: {
bluetooth_device_address_t address = { {0} };
case BT_IS_ADVERTISING:
case BT_IS_LE_2M_PHY_SUPPORTED:
case BT_IS_LE_CODED_PHY_SUPPORTED:
+ case BT_IS_LE_EXTENDED_ADVERTISING_SUPPORTED:
+ case BT_IS_LE_EXTENDED_SCAN_SUPPORTED:
+ case BT_LE_MAX_ADVERTISING_DATA_LEN:
case BT_REGISTER_SCAN_FILTER:
case BT_IS_SCAN_FILTER_SUPPORTED:
case BT_GET_ATT_MTU:
gboolean _bt_is_scan_filter_supported(void);
+gboolean _bt_is_le_extended_advertising_supported(void);
+
+gboolean _bt_is_le_extended_scan_supported(void);
+
+int _bt_le_get_maximum_advertising_len(void);
+
int _bt_set_le_static_random_address(gboolean is_enable);
bool _bt_is_le_static_random_address_enabled(void);
*
* This function is a synchronous call.
*
- * @return BLUETOOTH_ERROR_NONE - Succeess \n
+ * @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
* BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
* BLUETOOTH_ERROR_INTERNAL - Internal error \n
*
* This function is a synchronous call.
*
- * @return BLUETOOTH_ERROR_NONE - Succeess \n
+ * @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
* BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
* BLUETOOTH_ERROR_INTERNAL - Internal error \n
int bluetooth_is_le_coded_phy_supported(gboolean *is_supported);
/**
+ * @fn int bluetooth_is_le_extended_advertising_supported(gboolean *is_supported)
+ * @brief Check if Adapter supports LE Extended Advertising feature or not.
+ *
+ * This API is used to check whether LE Adapter supports LE Extended Advertising feature, which is introduced
+ * in BT 5.0 specification.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ * @param[out] is_supported. This boolean variable indicates whether LE Extended Advertising is supported or not
+ *
+ * @remark None
+ */
+int bluetooth_is_le_extended_advertising_supported(gboolean *is_supported);
+
+/**
+ * @fn int bluetooth_is_le_extended_scan_supported(gboolean *is_supported)
+ * @brief Check if Adapter supports LE Extended Scan feature or not.
+ *
+ * This API is used to check whether LE Adapter supports LE Extended Scan feature, which is introduced
+ * in BT 5.0 specification.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ * @param[out] is_supported. This boolean variable indicates whether LE Extended Scan is supported or not
+ *
+ * @remark None
+ */
+int bluetooth_is_le_extended_scan_supported(gboolean *is_supported);
+
+/**
+ * @fn int bluetooth_le_get_maximum_advertising_data_length(gint *data_length)
+ * @brief gives the maximum advertising data length supported by controller.
+ *
+ * This API is used to get the maximum advertising data length supported by controller. This feature is introduced
+ * in BT 5.0 specification.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ * @param[out] data_length. This integer variable indicates the maximum advertising data length supported by the controller
+ *
+ * @remark None
+ */
+int bluetooth_le_get_maximum_advertising_data_length(gint *data_length);
+
+/**
* @fn int bluetooth_l2cap_le_create_socket(int psm)
* @brief Register l2cap_le socket with a specific PSM
*
BT_ENABLE_FORCE_HCI_DUMP,
BT_SET_PASSKEY_NOTIFICATION,
BT_SET_SCAN_TYPE,
+ BT_IS_LE_EXTENDED_ADVERTISING_SUPPORTED,
+ BT_IS_LE_EXTENDED_SCAN_SUPPORTED,
+ BT_LE_MAX_ADVERTISING_DATA_LEN,
BT_BOND_DEVICE = BT_FUNC_DEVICE_BASE,
BT_BOND_DEVICE_BY_TYPE,
BT_CANCEL_BONDING,