esp32-snippets icon indicating copy to clipboard operation
esp32-snippets copied to clipboard

Is it possible to get static MAC of BLE client ?

Open dharmikP17 opened this issue 1 year ago • 0 comments

I am creating a BLE server on esp32 and I am trying to get the MAC address of devices connecting to it.

For this purpose, I have used

class myServerCallback : public BLEServerCallbacks {
  void onConnect(BLEServer* pServer, esp_ble_gatts_cb_param_t *param) {
      newDevice = true;
      clientId = param->connect.conn_id;
      memcpy(&clientMAC, param->connect.remote_bda, 6);
  }
};

The problem I have faced is that I am getting different MACs for the same device.

From what I know, BLE uses dynamic MACs for security. If that is the case, is there any way to always get one static MAC for one device? My goal is to identify whether the same device is connected or a new one and I do not want to use any application on a device.

dharmikP17 avatar Dec 23 '23 15:12 dharmikP17