I've developed an application based on the spp example.
I'd like now to display the full device name when discovered from a client and not truncated after 8 character due having a 128uuid.
I thought the solution could be using the scan response using cmd_le_gap_bt5_set_adv_data before start advertising to set a new devicename. But that's not it, the device name is still the truncated version of the one in the gatt.xml
I've created a new name(different from the one in the gatt.xml file) following the advertsing data format:
When you set up custom advertising data with function gecko_cmd_le_gap_bt5_set_adv_data(), you need to start advertising with discover mode "le_gap_user_data":
the reason is clear, and so i should pass the complete name in the scan data right? What format should have at this point the scan data?the same as the advertising data?Or should be only the remaining data left out?
/****here scan data what should be in order to have a custom length name****/
gecko_cmd_le_gap_bt5_set_adv_data(0,1,sizeof(scan_data), scan_data);
gecko_cmd_le_gap_start_advertising(0, le_gap_user_data, le_gap_connectable_scannable);
The first byte is the length of AD element and it is 0x12 = dec 18. However, the length of the data is 13 bytes (1 byte for the AD type 0x09 and 12 bytes for the name).
You should change the first byte to 13 = 0x0D
Also, you should check the response value of each gecko_cmd_xxx function call. Something like this:
uint16 res = gecko_cmd_le_gap_bt5_set_adv_data(0,1,sizeof(scan_data), scan_data)->result;
if(res)
{
printf("set adv data failed with code 0x%x\r\n", res);
}
Full device name with scan response
Hello,
I've developed an application based on the spp example.
I'd like now to display the full device name when discovered from a client and not truncated after 8 character due having a 128uuid.
I thought the solution could be using the scan response using cmd_le_gap_bt5_set_adv_data before start advertising to set a new devicename. But that's not it, the device name is still the truncated version of the one in the gatt.xml
I've created a new name(different from the one in the gatt.xml file) following the advertsing data format:
uint8 scan_resp_data[14] = {0x12,0x09,0x64,0x75,0x63,0x63,0x69,0x6f,0x31,0x32,0x33,0x34,0x35,0x36};
case gecko_evt_system_boot_id:
reset_variables();
gecko_cmd_gatt_set_max_mtu(247);
gecko_cmd_le_gap_bt5_set_adv_data(0,1,sizeof(scan_resp_data), scan_resp_data);
gecko_cmd_le_gap_start_advertising(0, le_gap_general_discoverable, le_gap_undirected_connectable);
break;
I'm on the wrong way, or am i missing something?
thanks,
Davide
When you set up custom advertising data with function gecko_cmd_le_gap_bt5_set_adv_data(), you need to start advertising with discover mode "le_gap_user_data":
I think in that case you'll have to set up the primary advertising packet as well, including the Flags AdType field. For example:
Still with this solution,adding the private uuid, I'm able only to advertise until my local name i 8 character long.
Following https://www.silabs.com/community/wireless/bluetooth/knowledge-base.entry.html/2017/02/10/bluetooth_advertisin-hGsf
the reason is clear, and so i should pass the complete name in the scan data right? What format should have at this point the scan data?the same as the advertising data?Or should be only the remaining data left out?
gecko_cmd_le_gap_bt5_set_adv_data(0, 0, sizeof(adv_data), adv_data);
gecko_cmd_le_gap_set_advertise_timing(0, 160, 160, 0, 0);
/****here scan data what should be in order to have a custom length name****/
gecko_cmd_le_gap_bt5_set_adv_data(0,1,sizeof(scan_data), scan_data);
gecko_cmd_le_gap_start_advertising(0, le_gap_user_data, le_gap_connectable_scannable);
Thanks,
Davide
This data is not correct:
The first byte is the length of AD element and it is 0x12 = dec 18. However, the length of the data is 13 bytes (1 byte for the AD type 0x09 and 12 bytes for the name).
You should change the first byte to 13 = 0x0D
Also, you should check the response value of each gecko_cmd_xxx function call. Something like this:
Oh!My mistake!
Many thanks.