mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-10-06 05:37:28 +00:00
Add ble_resolve_name function for device name resolution
Added a function to resolve advertised device names to their LE addresses. Signed-off-by: Niel Nielsen <nieldk@gmail.com>
This commit is contained in:
@@ -39,6 +39,16 @@ typedef struct {
|
||||
size_t leftover_len;
|
||||
} ble_conn_t;
|
||||
|
||||
// Default time budget for a name -> address scan.
|
||||
#define BLE_SCAN_TIMEOUT_MS 8000
|
||||
|
||||
// Resolve an advertised device name to its LE address via an active HCI scan.
|
||||
// Matches the Complete (0x09) or Shortened (0x08) Local Name, case-insensitively.
|
||||
// On success writes "XX:XX:XX:XX:XX:XX" into out_mac (needs >= 18 bytes) and
|
||||
// returns 0; returns negative on error or if no such device is seen in time.
|
||||
// Needs CAP_NET_RAW+CAP_NET_ADMIN (raw HCI), i.e. more privilege than connect.
|
||||
int ble_resolve_name(const char *name, char *out_mac, size_t out_mac_sz, int timeout_ms);
|
||||
|
||||
// Connect to `mac` (LE public), discover the SPP char, subscribe to notifications.
|
||||
// `chr_uuid16` selects the data characteristic (pass BLE_SPP_CHR_UUID16).
|
||||
// Returns 0 on success (conn filled), negative on error. On error conn->fd == -1.
|
||||
|
||||
Reference in New Issue
Block a user