0

I found some commands to simulate a Beacon and they are working fine but I don't really understand them.

sudo hciconfig hci0 up
sudo hcitool -i hci0 cmd 0x08 0x0008 1e 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 00 00 00 00 00 00 00 00 00 00 00 00 00
sudo hcitool -i hci0 cmd 0x08 0x0006 A0 00 A0 00 03 00 00 00 00 00 00 00 00 07 00
sudo hcitool -i hci0 cmd 0x08 0x000a 01

How are this nubers coded ? If I want to put a String, ex. 9c4fca50-1c13-11e6-bdf4-0800200c9a66 as UUID in which form shall I convert it to get this couple of 'bit' ?

user3235881
  • 487
  • 2
  • 9
  • 24

1 Answers1

1

The commands specify data bytes in hexadecimal format separated by spaces. When you want to convert a field to this format, you must also know whether it needs to be expressed "big endian" (most significant byte first) or "little endian" (least significant byte first). Different fields have varying endianness. Most beacon fields (like Proximity UUID) are big endian, but some lower-level Bluetooth LE fields are little endian.

A Proximity UUID is easy to convert to the format used by BlueZ because it's text expression is also in hexadecimal with the most significant parts first. So to convert it to big endian bytes, you simply need to strip out the dashes and add spaces. So this:

9c4fca50-1c13-11e6-bdf4-0800200c9a66

Becomes this:

9c 4f ca 50 1c 13 11 e6 bd f4 08 00 20 0c 9a 66
davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Thank you, but what is the type of the min and max interval values? What should the values be if for example I want to set the transmission at 5Hz? – user3235881 May 17 '16 at 15:43
  • For configuring the advertising rate, see my answer here: http://stackoverflow.com/a/21126744/1461050 The min and max values are not specified by BlueZ, but are limits of your underlying Bluetooth LE chip on your system. – davidgyoung May 17 '16 at 21:15