Skip to main content

Scanner_Address_Type

2 months ago

Scanner_Address_Type

Posted byAprocha46.85 points 4 replies
0 upvotes

Dear all,

Is there any API to get theScanner_Address_Typefrom theLE Scan Request Received eventas described in the Bluetooth specification ?

Best Regards,

2 months ago

PM_Dialog

Hi aprocha46,

Thanks for your question online. Please checkout theDA14585 DA14586 DA14531 Scan Request TrackSW 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

1 month ago

Aprocha46. 85 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

接受答案!

1 month 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

在这种情况下,我们建议使用DA14585 DA14586 DA14531 Scan Request TrackSW 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.修改user_config.h中的dlg_event_handler_enter()如下所示:

... 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);

笔记:The central device needs to scan inactive modesince the peripheral device will track if it is scanned via the scan request from central

I have verified this by using theDA14585/DA14586/DA14531 Central Implementationto 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使用了静态BD地址,因此User_CFG_Address_Mode设置为App_cfg_addr_static(串行终端中的类型:01)

B] DA14531 is acting as a GAP Central

In this case please check out theSmartBond™——无代码的命令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

1 month ago

Aprocha46. 85 points

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

Happy days !