Android BLE BluetoothGatt.writeDescriptor() return sometimes false

The documentation lacks information. However you can read the source code to find out the rules, which (currently) are the following: For each BluetoothGatt object, you can only have one outstanding request at a time, including requestMtu, readCharacteristic, writeCharacteristic, readDescriptor, writeDescriptor and executeReliableWrite. So if you issue a read request you need to wait for … Read more

Triangulate example for iBeacons

I have been making some experiments to get a precise position using three beacons. Results of trilateration Unluckily, the results were very disappointing in terms of quality. There were mainly two issues: In non-controlled environments, where you can find metals, and other objects that affect the signal, the received signal strength of the beacons changes … Read more

Finding distance from RSSI value of Bluetooth Low Energy enabled device

I answered this in another thread, repeating it here. In line-of-sight (no obstacles causing change in RSSI), -6dB seems to be double the distance. If you at 1m distance read RSSI -40dB then 2m gives -46dB, 4m gives -52dB, 8m gives -58dB, 16m gives -64dB. You can not get an exact position, only a circular … Read more

startLeScan with 128 bit UUIDs doesn’t work on native Android BLE implementation

@Navin’s code is good, but it includes an overflow bug from the original 16-bit Android code. (If either byte is larger than 127 then it becomes a negative integer.) Here’s an implementation which fixes that bug and adds 128-bit support: private List<UUID> parseUuids(byte[] advertisedData) { List<UUID> uuids = new ArrayList<UUID>(); ByteBuffer buffer = ByteBuffer.wrap(advertisedData).order(ByteOrder.LITTLE_ENDIAN); while … Read more

Chipsets/Devices supporting Android 5 BLE peripheral mode

The Android 5.0.X will only allow you to use the new API for BLE. This new API comes with a new feature, which you mentioned in your question: The possibility of advertising, from your own Android device, using it in Peripheral mode. However, the disadvantaged of this new feature is that it is hardware dependent. … Read more

Get MAC address of bluetooth low energy peripheral in iOS

CBPeripheral’s identifier property will serve your purpose, available from a still-unconnected device in CBCentralManager’s didDiscoverPeripheral delegate method: – (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI CBPeripheral *peripheral … NSUUID* serverId = [peripheral identifier]; I have a half dozen LE devices I’m experimenting with, including multiple sets of identical devices. I just confirmed that across … Read more

Android 4.3: How to connect to multiple Bluetooth Low Energy devices

I suspect everyone adding delays is just allowing the BLE system to complete the action you have asked before you submit another one. Android’s BLE system has no form of queueing. If you do BluetoothGatt g; g.writeDescriptor(a); g.writeDescriptor(b); then the first write operation will immediately be overwritten with the second one. Yes it’s really stupid … Read more

Use BlueZ Stack As A Peripheral (Advertiser)

With your Bluetooth dongle plugged in, running the following command will tell you the device name and give its state: $ hciconfig The output should look something like this: hci0: Type: BR/EDR Bus: USB BD Address: 00:01:02:aa:bb:cc ACL MTU: 1021:8 SCO MTU: 64:1 DOWN RX bytes:1000 acl:0 sco:0 events:47 errors:0 TX bytes:1072 acl:0 sco:0 commands:47 … Read more

Should one create a bond with a Bluetooth LE device

Short answer: the correct, common, and reliable scenario is to bond. Bonding means the connection is secure and the link is trusted. It means that your local device will usually find the remote device even if its address is changing. Pairing/bonding is recommended practice in Bluetooth for security and privacy reasons. Long answer: since its … Read more