Qué es el perfil Bluetooth iBeacon


Me gustaría crear mi propio iBeacon con algunos kits de desarrollo bluetooth de baja energía. Apple aún no ha publicado una especificación para iBeacons, sin embargo, algunos desarrolladores de hardware han realizado ingeniería inversa al iBeacon a partir del código de muestra de AirLocate y comenzaron a vender kits de desarrollo de iBeacon.

Entonces, ¿qué es el perfil Bluetooth de iBeacon?

Bluetooth Low Energy utiliza GATT para LE profile service discovery. Así que creo que necesitamos saber el Identificador de Atributo, Tipo de Atributo, Atributo Valor, y tal vez los Permisos de atributo del atributo iBeacon. Entonces, para un iBeacon con un UUID de E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 un valor mayor de 1 y un valor menor de 1 ¿cuál sería el servicio de perfil Bluetooth GATT?

He aquí algunas suposiciones que he hecho de la discusión en los foros de Apple y a través de los documentos.

  1. Solo necesita ver el servicio de perfil (GATT) de un periférico Bluetooth para saber que es un iBeacon.

  2. El Mayor y Las claves menores están codificadas en algún lugar de este servicio de perfil

Aquí hay algunas compañías con Kits de desarrollo de iBeacon que parecen tener esta figura ya:

Esperemos que con el tiempo tendremos un perfil publicado en Bluetooth.org como estos: https://www.bluetooth.org/en-us/specification/adopted-specifications

Author: yousif saeed, 2013-09-20

6 answers

Para un iBeacon con ProximityUUID E2C56DB5-DFFB-48D2-B060-D0F5A71096E0, major 0, minor 0, y potencia Tx calibrada de -59 RSSI, el paquete de publicidad BLE transmitido se ve así:

d6 be 89 8e 40 24 05 a2 17 6e 3d 71 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 52 ab 8d 38 a5

Este paquete se puede dividir de la siguiente manera:

d6 be 89 8e # Access address for advertising data (this is always the same fixed value)
40 # Advertising Channel PDU Header byte 0.  Contains: (type = 0), (tx add = 1), (rx add = 0)
24 # Advertising Channel PDU Header byte 1.  Contains:  (length = total bytes of the advertising payload + 6 bytes for the BLE mac address.)
05 a2 17 6e 3d 71 # Bluetooth Mac address (note this is a spoofed address)
02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 # Bluetooth advertisement
52 ab 8d 38 a5 # checksum

La parte clave de ese paquete es el anuncio Bluetooth, que se puede desglosar de la siguiente manera:

02 # Number of bytes that follow in first AD structure
01 # Flags AD type
1A # Flags value 0x1A = 000011010  
   bit 0 (OFF) LE Limited Discoverable Mode
   bit 1 (ON) LE General Discoverable Mode
   bit 2 (OFF) BR/EDR Not Supported
   bit 3 (ON) Simultaneous LE and BR/EDR to Same Device Capable (controller)
   bit 4 (ON) Simultaneous LE and BR/EDR to Same Device Capable (Host)
1A # Number of bytes that follow in second (and last) AD structure
FF # Manufacturer specific data AD type
4C 00 # Company identifier code (0x004C == Apple)
02 # Byte 0 of iBeacon advertisement indicator
15 # Byte 1 of iBeacon advertisement indicator
e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 # iBeacon proximity uuid
00 00 # major 
00 00 # minor 
c5 # The 2's complement of the calibrated Tx Power

Cualquier dispositivo Bluetooth LE que se pueda configurar para enviar un anuncio específico puede generar el paquete anterior. Tengo configuró un equipo Linux usando Bluez para enviar este anuncio, y los dispositivos iOS7 que ejecutan el código de prueba AirLocate de Apple lo recogen como un iBeacon con los campos especificados anteriormente. Ver: Use BlueZ Stack Como Periférico (Anunciante)

Este blog tiene todos los detalles sobre el proceso de ingeniería inversa.

 220
Author: davidgyoung,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 10:31:35

Parece basado en datos de publicidad, particularmente los datos del fabricante:

4C00 02 15 585CDE931B0142CC9A1325009BEDC65E 0000 0000 C5

<company identifier (2 bytes)> <type (1 byte)> <data length (1 byte)>
    <uuid (16 bytes)> <major (2 bytes)> <minor (2 bytes)> <RSSI @ 1m>
  • Identificador de empresa de Apple (Little Endian), 0x004c
  • tipo de datos, 0x02 = > iBeacon
  • longitud de los datos, 0x15 = 21
  • uuid: 585CDE931B0142CC9A1325009BEDC65E
  • mayor: 0000
  • menor: 0000
  • potencia media a 1 metro: 0xc5 = -59

Tengo este nodo .js script trabajando en Linux con el ejemplo de la aplicación AirLocate.

 45
Author: sandeepmistry,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-27 12:09:07

Solo para reconciliar la diferencia entre la respuesta de sandeepmistry y la respuesta de davidgyoung:

02 01 1a 1a ff 4C 00

Forma parte de la especificación de formato de datos publicitarios[1]

  02 # length of following AD structure
  01 # <<Flags>> AD Structure [2]
  1a # read as b00011010. 
     # In this case, LE General Discoverable,
     # and simultaneous BR/EDR but this may vary by device!

  1a # length of following AD structure
  FF # Manufacturer specific data [3]
4C00 # Apple Inc [4]
0215 # ?? some 2-byte header

Falta en el ANUNCIO una definición de Servicio [5]. Creo que el protocolo iBeacon en sí no tiene relación con el GATT y el descubrimiento de servicios estándar. Si descargas el programa iBeacon de RedBearLab, verás que pasan a usar el GATT para configurar los parámetros de publicidad, pero esto parece ser específico para su implementación, y no parte de la especificación. El programa AirLocate no parece usar el GATT para la configuración, por ejemplo, de acuerdo con LightBlue u otros programas similares que probé.

Referencias:

  1. Core Bluetooth Spec v4, Vol 3, Parte C, 11
  2. Vol 3, Parte C, 18.1
  3. Vol 3, Parte C, 18.11
  4. https://www.bluetooth.org/en-us/specification/assigned-numbers/company-identifiers
  5. Vol. 3, Parte C, 18.2
 20
Author: slackhappy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-04 08:45:00

Si la razón por la que hace esta pregunta es porque desea usar Core Bluetooth para anunciarse como iBeacon en lugar de usar la API estándar, puede hacerlo fácilmente anunciando un NSDictionary como:

{
    kCBAdvDataAppleBeaconKey = <a7c4c5fa a8dd4ba1 b9a8a240 584f02d3 00040fa0 c5>;
}

Ver esta respuesta para más información.

 6
Author: Senseful,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:26:10

Es muy simple, solo anuncia una cadena que contiene unos pocos caracteres que se ajustan al estándar iBeacon de Apple. puedes referir el Enlace http://glimwormbeacons.com/learn/what-makes-an-ibeacon-an-ibeacon /

 4
Author: Amit Shelgaonkar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-30 18:10:05

El perfil de iBeacon contiene 31 Bytes que incluyen los siguientes

  1. Prefijo - 9 Bytes-que incluyen s los datos adv y los datos del fabricante
  2. UUID-16 Bytes
  3. Mayor-2 Bytes
  4. Menor de edad-2 Bytes
  5. TxPower-1 Byte

introduzca la descripción de la imagen aquí

 0
Author: Ambi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-05 12:21:39