I am working on the iBeacon technology and I can't find any answer to a particular point concerning the address type. I found the documenation (bluetooth specification) explaining what are the address types but I can't seem to find how to chose between the two types (public and random).
Here is an example where I found it (it is a sniffed packet transmitted by an iBeacon on a Raspberry PI) :
http://i.stack.imgur.com/QF5gf.png and http://i.stack.imgur.com/NHY6x.png (sorry I can't post images yet because of my reputation)
Let's try to ask questions and make it more specific :
Since a public address has to be valid, might it be that there is a command to generate a random one (yet correct in formatting the address) to assign it to the concerned device?
If the above is true : what would be the command? and how do you roll back (to the primary public address)?
Or is there a "switch" that allows to chose between the (valid) public address or to generate a random one?
Thank you.
Here's a command that looks pretty much like what you want. See here for details.
Set Static Address Command
==========================
Command Code: 0x002B
Controller Index: <controller id>
Command Parameters: Address (6 Octets)
Return Parameters:
This command allows for setting the static random address. It is
only supported on controllers with LE support. The static random
address is suppose to be valid for the lifetime of the
controller or at least until the next power cycle. To ensure
such behavior, setting of the address is limited to when the
controller is powered off.
The special BDADDR_ANY address (00:00:00:00:00:00) can be used
to disable the static address.
When a controller has a public address (which is required for
all dual-mode controllers), this address is not used. Only when
the controller information reports BDADDR_ANY (00:00:00:00:00:00),
it is required to configure a static address first.
If privacy mode is enabled and the controller is single mode
LE only without a public address, the static random address is
used as identity address.
This command generates a Command Complete event on success or a
Command Status event on failure.
Possible errors: Rejected
Not Supported
Invalid Parameters
Invalid Index
It looks to me like the privacy features of BlueZ are under current active development and may not be complete yet. See this commit from 2014/02/18. If you want to try this with the latest updates, you will have to compile BlueZ from source.
来源:https://stackoverflow.com/questions/22149897/bluetooth-le-address-type