From b5f78bbeda8911eebeae5c904b84ace45e877bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20=C3=93=20hAol=C3=A1in?= Date: Sat, 4 Feb 2023 21:33:32 +0000 Subject: [PATCH] Use the scan response to advertise some of the available service UUIDs rather than just repeating the device name --- source/Core/BSP/Pinecilv2/ble_peripheral.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/Core/BSP/Pinecilv2/ble_peripheral.c b/source/Core/BSP/Pinecilv2/ble_peripheral.c index 78d8e2aa..35cbdcee 100644 --- a/source/Core/BSP/Pinecilv2/ble_peripheral.c +++ b/source/Core/BSP/Pinecilv2/ble_peripheral.c @@ -268,12 +268,17 @@ int ble_start_adv(void) { .interval_max = BT_GAP_ADV_FAST_INT_MAX_3, }; + // scan and response data must each stay < 31 bytes struct bt_data adv_data[2] = { BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_NO_BREDR | BT_LE_AD_GENERAL)), - BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_BLE_NAME, strlen(DEVICE_BLE_NAME)), + BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_BLE_NAME, strlen(DEVICE_BLE_NAME)) }; - return bt_le_adv_start(&adv_param, adv_data, ARRAY_SIZE(adv_data), &adv_data[1], 1); + struct bt_data scan_response_data[1] = { + BT_DATA(BT_DATA_UUID128_SOME, ((struct bt_uuid_128 *)BT_UUID_SVC_BULK_DATA)->val, 16) + }; + + return bt_le_adv_start(&adv_param, adv_data, ARRAY_SIZE(adv_data), scan_response_data, ARRAY_SIZE(scan_response_data)); } // Callback that the ble stack will call once it has been kicked off running