This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
i need to connect my ble central device to a peripheral device with a specific MAC id. So i need to read the peripheral's mac id when it is discovered in the central device. How can i do that?
Hi Athul,
Are you talking about the device's unique public 48-bit Bluetooth Address (BD_ADDR from the BLE spec?) When you do scanning with your central device to see devices that are advertising, if you look at the SimpleBLECentral project for CC2541 that is included with the BLE-STACK v1.4.2 for CC2541, you can find that the GAP_DEVICE_DISCOVERY_EVENT has a structure (discCmpl) that contains a pointer (pDevList) to an array of discovered devices. This array of structs of gapDevRec_t type contains an addr field for the device address. So basically, when you discover devices using the stack there will be an array available to you that includes all of the discovered device addresses, so you could look through this.
However, you also need to know a bit about the peripheral device that you are connecting to and how it behaves as well - are you also creating the peripheral device and can control it's behavior? Basically, a peripheral device can either be advertising with it's public bluetooth address BD_ADDR that will be the same every time, but it could also be advertising with a random bluetooth address which will make things more complicated for you to identify the correct peripheral device but there are methods to do that. It really is going to depend on the peripheral device and your use-case/security concerns.
While it is for a different part than the CC2541 you are currently using (though it might be good for you to get a LAUNCHXL-CC2640R2 anyway as I think it would be a better place to start learning BLE) I would recommend trying to read through and understand some of the SimpleLink Academy modules on Scanning/Advertising and on Connections in order to better understand the sequence of what is happening. If you are totally new to BLE, I recommend going through the Fundamentals lab first. There are also a lot of good resource found in the BLE Getting Started sticky post at the top of the forum: https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/t/404236
Regards,
Katie