Skip to main content

Scanner_Address_Type

DA14530 and DA14531

9 months ago

Posted by aprocha46 90 points 4 replies
0 upvotes

Dear all,

 

Is there any API to get the Scanner_Address_Type from the LE Scan Request Received event as described in the Bluetooth specification ?

Best Regards,

9 months ago

PM_Dialog

Hi aprocha46,

Thanks for your question online. Please checkout the DA14585 DA14586 DA14531 Scan Request Track SW Example. This example demonstrates how a peripheral device can track if it is scanned and which central device performs the scanning procedure. The central device needs to scan in active mode since the peripheral device will track if it is scanned via the scan request from central.

Thanks, PM_Dialog

8 months ago

aprocha46 90 points

Well this was not my question at all, and your example does not help.

We are already using this callback, but as we want to know the type of address used by the the scanning device. More exactly to distinguish between a public address and a random address.

In the Bluetooth protocol there is a field mentioned in my question to get this information: do you have any matching API to know its value ?

BR

accepted answer!

8 months ago

PM_Dialog

Hi aprocha46,

Apologies for the delay – please find my comments below so that you can check if the type of the BD address is public or static.

The event parameter (Scanner_Address_Type)  you had shared in the initial post it is when the device is configured in HCI mode and will get a HCI_LE_Scan_Request_Received event.

According to BLE v5.1 specs and section 3.6.5 Identity Address Information :

- If BD_ADDR is a public device address, then AddrType shall be set to 0x00.

- If BD_ADDR is a static random device address then AddrType shall be set to 0x01.

 

A] DA14531 is acting as a GAP Peripheral

In this case, we recommend using the DA14585 DA14586 DA14531 Scan Request Track SW Example (as suggested in my previous reply) with some modifications (see below) , as it demonstrates how a peripheral device can track if it is scanned and which central device performs the scanning procedure. The application code as it is on our website prints out only the Central’s BD address in user_scan_request_cb() callback function.

To check if the Central BD address is public or static, the following modifications should be done:

1. Include the llm_util.h in user_config.h as follow :

#include "llm_util.h"

2. Modify the scan_req_data_msg structure in user_config.h as below :

struct scan_req_data_msg{
    uint8_t scn_bd_address[6];
	uint8_t scn_req_addr_type;
};

3. Modify the DLG_EVENT_HANDLER_ENTER() in user_config.h as below :

...

struct scan_req_data_msg *ind = KE_MSG_ALLOC(SCAN_REQ_DATA_MSG, TASK_APP, TASK_APP, scan_req_data_msg);         

ind->scn_req_addr_type = llm_util_rxtxadd_getf(rxdesc);															

memcpy(ind->scn_bd_address, (uint8_t*)(_ble_base + (uint8_t*)rxdesc->rxdataptr), 6);                            
               ke_msg_send(ind);  

...

This callback will be triggered each time the Peripheral gets a scan request.

4.   Modify the user_scan_request_cb() in scan_request_track.c as below to print out the BD address type as well.

arch_printf("Scan request from : ");
arch_printf("%02x:%02x:%02x:%02x:%02x:%02x  ", 
                param->scn_bd_address[5],
                param->scn_bd_address[4],
                param->scn_bd_address[3],
                param->scn_bd_address[2],
                param->scn_bd_address[1],
                param->scn_bd_address[0]);
arch_printf("Type :  ");
arch_printf("%02x \n\r", param->scn_req_addr_type);

NOTE: The central device needs to scan in active mode since the peripheral device will track if it is scanned via the scan request from central

I have verified this by using the DA14585/DA14586/DA14531 Central Implementation to configure the two (2) as GAP centrals.

-  Central_1 is using a Public BD address, so USER_CFG_ADDRESS_MODE is set to APP_CFG_ADDR_PUB (Type :  00 in the serial terminal)

-  Central_2 is using a Static BD address, so USER_CFG_ADDRESS_MODE is set to APP_CFG_ADDR_STATIC (Type :  01 in the serial terminal)

 

B] DA14531 is acting as a GAP Central

In this case please check out the SmartBond™ - CodeLess AT Commands and user_on_adv_report_ind() callback function. The source code can be downloaded from here : DA14585-DA14531 Codeless AT Command 

The param->report.adv_addr_type checks if the BD Address is public or static. See also the user guide / section 3.4.1. Advertise/ Scan

http://lpccs-docs.dialog-semiconductor.com/UM-140-DA145x-CodeLess/demo.html#examples-remote-board

The DA14531 should be configured as a GAP Central and according to the note : “the R implies Random address.* “

Thanks, PM_Dialog

8 months ago

aprocha46 90 points

Thanks very much for your support: this is exactly what I need

Happy days !