In there , I organize the bluetooth low energy in linux.
There are lots blog/discussing about this (like http://stackoverflow.com/questions/26853011/broadcasting-message-in-bluetooth-low-energy-mode )
First, your linux distribution should be installed bluez package.
Most have been done.
We would use two commandline tools:
hcitool and hciconfig.
hciconfig could inquiry/set devices (bluetooth card in local computer)
hiconfig hci0: Type: BR/EDR Bus: USB BD Address: 74:E5:43:96:87:A2 ACL MTU: 1021:8 SCO MTU: 64:1 DOWN RX bytes:196507 acl:2915 sco:0 events:9293 errors:0 TX bytes:166857 acl:3037 sco:0 commands:6061 errors:0
the hci0 is the device symbol for bluez.
If you have more then one bluetooth device, that would be hci0, hci1...etc.
There is a "DOWN" flag to note this device being disable.
We should use
sudo hciconfig hci0 up : to be on working
sudo hciconfig hci psan : to be scanable (by the other device, like android phone)
sudo hciconfig hci0 up sudo hciconfig hci0 pscan hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 74:E5:43:96:87:A2 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING PSCAN RX bytes:197113 acl:2915 sco:0 events:9329 errors:0 TX bytes:167553 acl:3037 sco:0 commands:6097 errors:0
and also, hciconfig hci0 noscan : stop to be scanable.
hciconfig hci noleadv : stop ble advertising.
hcitool could set what data to advertise and the advertise frequency.
(hcitool -i cmd ....)
The maximum data length be 31 bytes, but availalbe is 29 byte only( 2 bytes for length and type )
hcitool should start as 0x08 and 0x0008, for
#OGF = Operation Group Field = Bluetooth Command Group = 0x08 #OCF = Operation Command Field = HCI_LE_Set_Advertising_Data = 0x0008
the ibeacon(apple's) format be :
<IBEACONPROFIX> <UUID> <MAJOR> <MINOR> <POWER>
Here IBEACONPROFIX are number for identifying apple's format.
IBEACONPROFIX = 1E 02 01 1A 1A FF 4C 00 02 15
UUID: 16 byte data, you could use uuidgen this commandline tool to get this unique number.
MAJOR, MINOR and POWER : 0000 to ffff
Totally, the ibeacon script be :
hcitool cmd 0x08 0x0006 A0 00 A0 00 ...
the first two bytes(A0 00) is "min interval"
And the 2nd two bytes (A0 A0 ) is "Max interval"
A0 00, be 0x00A0(big endian), it is 160 in decimal.
The granularity of ble is 0.625ms.
Here, min and max interval are 160* 625ms = 100ms both.
(ref : http://stackoverflow.com/questions/21124993/is-there-a-way-to-increase-ble-advertisement-frequency-in-bluez)
Then, you could use android app to detect the ibeacon exist.