验证扫描者的身份

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
9个职位/0个新职位
Last post
hamiddhosseini
Offline
最后一次见到:6 months 1 week ago
Joined:2020-05-12 12:04
验证扫描者的身份

Hello there,

Is there a way to detect a previously paired device?

我用的是scan_request trackerexample andble\应用程序\安全我可以打印出发送扫描请求的设备的地址。但是,我想检查这个地址,并知道什么时候一个已经配对并断开连接的设备会发送一个扫描请求。

Is there a way to verify if a device has been previously paired with?

当做,

Hamid

Device:
PM\U对话框
Offline
最后一次见到:10 hours 38 min ago
Staff
Joined:2018-02-08 11:03
Hi Hamid,

Hi Hamid,

Please check the ble_app_security example of the SDK. The example uses either an SPI Flash or an EEPROM to store the bonding data. Once the device has been paired, all the pairing/bonding information are stored in the non-volatile memory, so you could check there if a device has been previously paired.

谢谢,下午好

hamiddhosseini
Offline
最后一次见到:6 months 1 week ago
Joined:2020-05-12 12:04
是的,我看得出来

是的,我看得出来example stores the data of the previously paired device. But, my question is how these data can be checked on the scan request where we only have the address of the scanner?

PM\U对话框
Offline
最后一次见到:10 hours 38 min ago
Staff
Joined:2018-02-08 11:03
Hi Hamid,

Hi Hamid,

Once you get the BD address of the peer device, you should check into the pairing information which is stored into the non-volatile memory. Could you please let me know what is your requirement here? Do you need to block scanning from the devices that are not paired?

谢谢,下午好

hamiddhosseini
Offline
最后一次见到:6 months 1 week ago
Joined:2020-05-12 12:04
Hello there,

Hello there,

In order to increase the quality of service, we want to trigger an event once a paired user sends a scan request. In other words, we don't want to block scanning from other devices, we only need to be notified once a paired device has sent a scan request.
The following code is what I'm using for this purpose but I'm not sure if this is the right method. (especiallly for legacy pairing)

bool user_check_bonding(struct bd_addr peer_addr, uint8_t addr_type) { const struct app_sec_bond_data_env_tag *pbd = NULL; uint8_t bdaddr_type; // Check if peer's BD address is public or random static bdaddr_type = app_get_address_type(addr_type, peer_addr); if ((bdaddr_type == APP_PUBLIC_ADDR_TYPE) || (bdaddr_type == APP_RANDOM_STATIC_ADDR_TYPE) || (bdaddr_type == APP_ID_ADDR_TYPE)) { if (bdaddr_type == APP_ID_ADDR_TYPE) { // Search DB by peer's BD address pbd = app_easy_security_bdb_search_entry(SEARCH_BY_ID_TYPE, (void *) peer_addr.addr, BD_ADDR_LEN); } else { // Search DB by peer's BD address pbd = app_easy_security_bdb_search_entry(SEARCH_BY_BDA_TYPE, (void *) peer_addr.addr, BD_ADDR_LEN); } // If peer has been found in DB if(pbd) { // Store device bond data to security environmen // Accept encryption return true; } // If peer has not been found in DB else { // Reject encryption, disconnect return false; } } // Check if peer's BD address is Resolvable Private Address else if (bdaddr_type == APP_RANDOM_PRIVATE_RESOLV_ADDR_TYPE) { // Start BD address resolving procedure if(!user_app_easy_security_resolve_bdaddr(peer_addr)) { return false; } return true; } // Check if peer's BD address is non-Resolvable Private Address else { // Reject encryption, disconnect return false; } }

您认为这会涵盖所有配对情况吗(我们可能需要更改配对方法和安全级别,因此我希望此函数更通用)?

当做,

Hamid

hamiddhosseini
Offline
最后一次见到:6 months 1 week ago
Joined:2020-05-12 12:04
Ok, now I'm able to search

Ok, now I'm able to search for the device but I have a new issue. How can I identify the scanner's address type?

PM\U对话框
Offline
最后一次见到:10 hours 38 min ago
Staff
Joined:2018-02-08 11:03
Hi Hamid,

Hi Hamid,

你是说如何获取对等设备的BD地址?请参阅app\u get\u address\u type()API,因为它返回BD地址的类型。

谢谢,下午好

hamiddhosseini
Offline
最后一次见到:6 months 1 week ago
Joined:2020-05-12 12:04
Yes, I want to know the

Yes, I want to know the address type of the scanner. As we discussed earlier we can have the address of the scanner in the scan_request_track. However, how should I determine the address type.

I've actually tried using this API but I'm stuck with the input parameter of the app_get_address_type() as I'm supposed to pass an address type to this function.

enum app_addr_types app_get_address_type (uint8_tddr_type, struct bd_addr addr) { typedef enum app_addr_types (* app_get_address_type_t)(uint8_t addr_type, struct bd_addr addr); if ((addr_type == ADDR_RPA_PUBLIC) || (addr_type == ADDR_RPA_RAND)) { return APP_ID_ADDR_TYPE; } else { app_get_address_type_t f = (app_get_address_type_t) (app_get_address_type_ROM); return f(addr_type, addr); } }

What should I put for this address type when I want to know to address?

PM\U对话框
Offline
最后一次见到:10 hours 38 min ago
Staff
Joined:2018-02-08 11:03
Hi Hamid,

Hi Hamid,

Apologies for the delay. What kind of BD address does the Central use? This depends on the Central BD Address.

谢谢,下午好