How to get mac addresses of all connected mesh devices

Hello

I need the code where i can get mac addresses of all mesh connected devices. Suppose  Error in getting the mac address of a microcontroller with available answer in forum <- this is the link to find only one connected device. Is it possible this code only to get all mesh connected devices mac addresses? I need help here

Regards

  • Hi,

    Devices in a Bluetooth mesh network are not "connected", and the Bluetooth mesh protocol uses its own set of addresses on the network, so the Bluetooth addresses don't really matter that much.

    The BLE address is used for sending the BLE advertisement packet that contains the mesh packet, but when a mesh packet is relayed it is always using the BLE address of the relay. (In other words, the BLE address of the original sender is not kept when packets are relayed.) Therefore the receiver of a packet may only see the BLE address of the last node in the chain of relays.

    All nodes having successfully sent messages to the node, will be in the node's Replay Protection List, which basically stores the sender address together with the highest sequence number received from that sender address thus far. In other words, the Replay Protection List contains addresses of the other nodes on the network. Maybe that is enough for your use case?

    If you really need the BLE addresses, then you must create a custom mesh model for sharing that data across the network.

    Regards,
    Terje

  • Hello

    Thanks for your reply. I just need mac addresses to differentiate between different mesh servers, so that i can identify from which server i am getting data. You have any idea how to do this?

    and what do u mean by this -> ,,,,create a custom mesh model for sharing that data across the network,,,, could you tell me exactly how to do this?

    Regards

  • Hi,

    If all you need is to differentiate between nodes on the mesh network, then you can use the originator address from the mesh packets themselves. For that you do not need to implement any custom mesh models.

    Regards,
    Terje

  • Hello

    How exactly to do that any example please?

    Regards

  • Hi,

    You can get that in the addr field of the bt_mesh_msg_ctx in the handler function for the opcode. See for instance Receiving messages, for how these handler functions are typically registered for a model.

    Regards,
    Terje

Related