I am writing an application in Qt that runs on the computer and interacts with a nRF51422 via BLE. Now I have noticed, that I have to tell the framework, which address type is used.
When I try to connect to the nRF51 with Qt set to PublicAddress, I simply get a timeout.
I wanted to establish a connection to the nRF51 and scan for the services to determine if the device is the right one. But then I need to know what type of address I am dealing with.
Is there any algorithm to check if a BLE address is public or random?
In the TI forums I read that the two MSBs differ for the three types of random addresses. But is there a similar code to distinguish a random address from a public address?
Hi Andi G.,
Luckily all that is explained in BT SIG specification. E.g. in v4.2 spec see Volume 6 (Low Energy) Part B (Link Layer) section 1.3 (Device Address) and Volume 3 (Host) Part C (GAP) section 10.8 (Random Device Address). If you want to stick with other spec version you will find similar chapter there.
If we want to be precise we should talk about Address (MAC) field on 3 layers of BT LE:
To make it faster I leave here screenshot from official BT SIG BLE training slides, it should be evident what options are for 48-bit MAC address coding in BLE (note that BLE is using little endian so right-most bytes and bits are in fact most significant aka MSB;)
You obviously also could find this kind of question already answered on this forum, e.g. here;).
I've added few more slides and clarification about Address field role in Low Energy Link Layer, Security Manager and Generic Access profile.
Thanks for your reply. I already knew that the three types of random addresses are distinguishable with their two MSBs. The only way to recognize a public address is this 49th bit with the caption TxAdd/RxAdd. Is this right? But what is the name of this bit? With those keywords, I can not find anything interesting in the Bluetooth SIG document...
I've amended my answer above. You can also find description of these TxAdd/RxAdd flags in BT SIG specification v4.2 Volume 6 (Low Energy) Part B (Link Layer) section 2.3 (Advertising Channel PDU).
Please note few important details:
Wow! Hi endnode, where did you get these pictures about the packets?
Is it from a book? Can you give me a link??
Added : I really appreciate your help. Thanks a Million!!!
Hi Mango922, I recommend this original presentation by BT SIG from 2010 during official introduction of LE as part of BT 4.0 (member login required but registration is for free).