I want the real MAC address of my mobile's BLE when i connect to ESP32

#1
  1. My goal is: I want the real MAC address of my mobile’s BLE when I connect my mobile to ESP32

  2. My actions are:
    i)- ["bt.random_address", "b", false, {title: "Use random BT address"}]
    using this command ESp32’s MAC ID gets static but not the client’s MAC ID (my mobile).
    I’ve added this to mos.yml… it’s showing address but it is not my mobile’s MAC address.

    When I connect my mobile phones to ESp32’s BLE then this is the output…
    addr

  3. My expectation & question is: My mobile setting shows MAC as B0:55:08:10:4C:8C… and I want to see the same on mos’s output screen.

#2

Did you try bonding ?
If you bond then you can assure that device is the device you want, and the BT MAC will be stored in the “database” and you can read it from there.
I submitted a pull request doing that to Github
Don’t know if that solves your problem but it might help.

1 Like
#3

Thank you for your response @scaprile,

  1. The thing I want to know is when my device(mobile) triggers or connects to the ESP32, which function gets triggered first. and where it stores the address of my device(mobile) (again the address storing function I want)… As I want the real MAC to get stored in ESP…

  2. How can I access the database of BLE mac?

#4

Sadly my knowledge ends there.
BT/BLE is mostly handled by the IDF, with a Mongoose-OS layer on top. Anything you want to do that is not provided by MOS, you can do it by calling the proper IDF function (if it exists…), which in turn requires including the proper header. The IDF docs are tough but useable and MOS source code is instructive as it does that.
This is what I’ve done to get a list of bonded device MACs:

1 Like
#5

Okay…
Not a problem @scaprile
and Thank you for your suggestions :smile: