On Ubuntu, after installing bluez, according to https://learn.adafruit.com/pibeacon-ibeacon-with-a-raspberry-pi/adding-ibeacon-data we can set the bluetooth low energy / 4.0 advertisement data via
sudo hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1
and using wireshark or python with sudo hcitool lescan
we can see that the data is received by a second btle dongle. Is there also a way to write the advertisement packet in python instead of using hcitool? A library of some kind would be ideal.
In python, I can print the received data using a modified version of How to retrieve advertising payload from iBeacon / BLE (data[44:13:-1]
instead of data[12:6:-1]
), and now I wish to transmit data.
(The backstory: I want to broadcast a message fairly frequently (one-to-many multicasting), I have heard btle advertisement can do every 20ms, to several robots without bothering to pair every robot. I do not care about security, I do not need to connect to the robots, I only need to transmit from a central station and have several robots receive the data. I would also be interested in learning how to do write of advertisement packet data on iOS / Android if people have hints).
Specs: python2.7 / 3.2, two CSR 4.0 USB dongles off of ebay, ubuntu 14.04.