Labels

Linux (6) OpenCV (4) Deep Learning (3) MATLAB (3) Mac OS X (3) Windows (2) C# (1) Node JS (1)

2014年12月11日 星期四

Adding iBeacon to TI CC254x

The iBeacon is Apple's indoor positioning technology based on Bluetooth Low Energy (BLE). In fact the iBeacon information is embedded in BLE advertisement Protocol Data Unit (PDU). The packet format of iBeacon is as below:



In the source code of TI CC254x, we can find the advertisement data, which is called static uint8 advertData[]. The iBeacon code and simple explanations are:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// GAP - Advertisement data (max size = 31 bytes, we use 30 bytes)  
 static uint8 advertData[] =  
 {  
  0x02,  // length of first data structure (2 bytes excluding length byte)  
  0x01,  // AD Type = Flags  
  0x1A,  // Flags value  
   
  0x1A,  // length of second data structure (26 excluding length byte)  
  0xFF,  // GAP_ADTYPE_MANUFACTURER_SPECIFIC  
   
  0x4c, 0x00,  // Company ID (0x4C00 = Apple)   
  0x02, 0x15,  // iBeacon AD indicator  
    
  // Device UUID (16 bytes)  
  0xB9, 0x40, 0x7F, 0x30, 0xF5, 0xF8, 0x46, 0x6E,   
  0xAF, 0xF9, 0x25, 0x55, 0x6B, 0x57, 0xFE, 0x6D,  
   
  0x00, 0x01,  // Major No. for a group of beacons  
  0x00, 0x01,  // Minor No. for each beacon  
  0xC5, // -59 dBm TX power  
 };