Skip to content

Commit c9c3d5b

Browse files
committed
Merge branch 'feature/AEGHB-665' into 'master'
feat(ble): Support config UUID in broadasting Closes AEGHB-665 See merge request ae_group/esp-iot-solution!1167
2 parents 4638426 + 49e350b commit c9c3d5b

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

components/bluetooth/ble_conn_mgr/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# ChangeLog
2+
3+
## v0.1.3 - 2024-12-09
4+
5+
### Enhancements:
6+
7+
* Support Config UUID Information in BLE broadcasting.
8+
19
## v0.1.2 - 2024-5-22
210

311
### Bug Fixes:

components/bluetooth/ble_conn_mgr/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "0.1.2"
1+
version: "0.1.3"
22
description: A common layer to manage the BLE connection, support both Bluedroid and Nimble
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/bluetooth/ble_conn_mgr
44
dependencies:

components/bluetooth/ble_conn_mgr/include/esp_ble_conn_mgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ typedef struct {
153153
const char *extended_adv_rsp_data; /*!< Extended advertising responses data */
154154

155155
uint16_t include_service_uuid: 1; /*!< If include service UUID in advertising */
156+
uint16_t adv_uuid16; /*!< NOTE: Only Support one 16-bit UUID */
156157
} esp_ble_conn_config_t;
157158

158159
/**

components/bluetooth/ble_conn_mgr/src/esp_nimble.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,8 @@ esp_err_t esp_ble_conn_init(esp_ble_conn_config_t *config)
18921892
#endif
18931893

18941894
#else
1895+
uint8_t offset = 0;
1896+
esp_nimble_maps_t uuid_data;
18951897
/* Store BLE announce data internally */
18961898
esp_nimble_maps_t announce_data[] = {
18971899
{
@@ -1907,6 +1909,13 @@ esp_err_t esp_ble_conn_init(esp_ble_conn_config_t *config)
19071909
conn_session->adv_data_len += announce_data[i].length + 2;
19081910
}
19091911

1912+
if (config->include_service_uuid) {
1913+
uuid_data.type = BLE_CONN_DATA_UUID16_ALL;
1914+
uuid_data.length = sizeof(config->adv_uuid16);
1915+
uuid_data.value = (uint8_t *)(&(config->adv_uuid16));
1916+
conn_session->adv_data_len += uuid_data.length + 2;
1917+
}
1918+
19101919
if (conn_session->adv_data_len > BLE_ADV_DATA_LEN_MAX) {
19111920
ESP_LOGE(TAG, "Advertisement data too long = %d bytes", conn_session->adv_data_len);
19121921
goto ble_init_error;
@@ -1925,6 +1934,14 @@ esp_err_t esp_ble_conn_init(esp_ble_conn_config_t *config)
19251934
conn_session->adv_data_buf[len++] = announce_data[i].type;
19261935
memcpy(&conn_session->adv_data_buf[len], announce_data[i].value, announce_data[i].length);
19271936
len += announce_data[i].length;
1937+
offset = len;
1938+
}
1939+
1940+
if (config->include_service_uuid) {
1941+
conn_session->adv_data_buf[offset++] = uuid_data.length + 1;
1942+
conn_session->adv_data_buf[offset++] = uuid_data.type;
1943+
memcpy(&conn_session->adv_data_buf[offset], uuid_data.value, uuid_data.length);
1944+
offset += uuid_data.length;
19281945
}
19291946

19301947
/* Store BLE scan response data internally */

0 commit comments

Comments
 (0)