Differentiating Android BLE Channel - bluetooth-lowenergy

When I make a BLE device talk to an Android device, is there a way for the android device to distinguish what advertising channel the BLE device is on? If doing so is impossible in Android, is it possible with Adafruit BLE devices?

No, it's not. The information is discarded before the advertisement packet is sent by the receiving Bluetooth controller to its host (Android) over hci. Why do you want this info anyway?
It seems you can do it on Adafruit though, since it uses nRF softdevice, which gives you this info.

Related

Is there any way how to scan for advertisement channels to get access to HC-06 bluetooth controller?

I'm quite new in Arduino and Bluetooth devices, but need to demostrate some vulnerabilities of IoT devices and I want to try hack HC-06 bluetooth controller to send instruction to Arduino. I want to try MAC spoofing method and second method is about exploiting advertisement channels of BLE devices by sniffing. I don't actually know if HC-06 is considered as BLE device or if it has advertisement channels.
I'm really new in this field and I've just read some articles about basics. This is used as a school project.
HC-06 is not a BLE device, is Bluetooth v2.0 + EDR and it does not has advertisement channels.
Go for HM-10 to have a proper BLE device.
Some references that may help you to get into the topic:
Old documentation about BR/EDR versions:
https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-121r2.pdf
Recent documentation on BLE security:
https://csrc.nist.gov/csrc/media/publications/sp/800-121/rev-1/final/documents/draft-sp800-121_rev1.pdf

BLE Pairing with Android things acting as Peripheral

I'm using Android Things 1.0.4 in a prototype where it acts as BLE peripheral device: advertising services and running a GATT server.
I encounter an issue in the BLE pairing process when trying to bond the Android Things board (Raspberry Pi 3) and a smartphone.
Since the device has no display, I set using BluetoothConfigManager:
IoCapability = BluetoothConfigManager.IO_CAPABILITY_NONE
which results in the error AUTH_FAILED every time.
Instead,
IoCapability = BluetoothConfigManager.IO_CAPABILITY_OUT
logs the pairing key and prompts the smartphone to enter it during pairing, but it results in the REMOVED error.
Questions:
Is Android Things in peripheral role capable of handling BLE pairing or not yet?
Are there more things that need to be implemented in the app's code to replicate the full-fledged Android logic?
Here's the source code of the Android Things app to test BLE pairing and bonding
The same code stripped from Android Things specific elements completes BLE pairing and bonding successfully when running on an Android phone as Peripheral (server), and an Android device or iPhone as Central (client).
Generally speaking, if you attempt to read an encrypted GATT characteristic before pairing (which triggers the pairing logic automatically), this results in GATT error 137 returned from the read request (AUTH_FAIL). This is because the device doesn't have enough time to finish setting up the bond before a response is sent by the Bluetooth stack. Retying the read request again generally succeeds.
I have not tested this with an iOS client device, but it certainly holds true with an Android client connecting to an Android (Things) peripheral. As such, I would recommend a few things:
Have the client (mobile) device explicitly initiate pairing, and Android Things should simply react to these incoming requests in the BluetoothPairingCallback. This lets the mobile device decide the pairing type based on the reported capabilities of the IoT device.
Separate the pairing flow from the GATT flow. Pair to the discovered device separately from making any attempts to read the characteristics. This tends to be the best way to avoid timing problems.
Regarding capability choices, this depends on your device. In my experience, if you choose IO_CAPABILITY_NONE this results in PAIRING_VARIANT_CONSENT inside of onPairingInitiated() and the pairing operation succeeds once finishPairing() is called. If you adjust your capabilities, you should be prepared for any number of the variants requiring you to display a PIN for the mobile device to enter. I have not not personally tested these paths.

Is running HM10 on a soft-serial enable the Low Energy charecteristics ? If so, how can the UUIDs and GATT profiles be tweaked in this case ?

I've been tinkering with the HM-10 board for a few weeks now, trying to push data from phone to module and vice-versa. The ultimate goal was to enable the BLE mode and tweak with the characteristics and GATT profiles. I'm pretty new to this domain so can anyone help me out ?
And is there any way we can interface the HM-10 with the hardware rx-tx channel instead of soft-serial ?
Your question is still not very clear, but i think you mean sending AT-commands over BLE-radio.
To make this possible you have to change the MODE using serial connection.
In standard mode the device can only be configured over the serial connection (pins RXD and TXD) using AT commands.
AT+MODE0: It only accepts AT-commands over the serial connection (RXD/TXD)
until a central device connects to the module.
AT+MODE1: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE and manipulate some PIO pins on
the device.
AT+MODE2: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE.
To test it just send a string to hm-10 as "AT\r\n" and it will respond with OK.
Update:
You cannot change the services and characteristics with AT-commands.
There are a lot of other things you can change,like advertising, setup a beacon and change a lot of settings.
For a full list of AT commands and more see the official data sheet:
http://www.jnhuamao.cn/bluetooth41_en.zip

Programming a BLE Beacon to connect with server

I am developing a solution where, Fixed BLE beacon detects a moving BLE device and sends the relevant data to the server using wifi/ethernet/etc. All the examples I have found have BLE beacons talking to the mobile phone which in my case isnt true. AFIK an embedded systems engineer can configure the fixed beacon to send data to server. BUT is there any ready to use solution that lets the beacon connect to backend? Thanks.
You mention having a "[f]ixed BLE beacon [detect] a moving BLE device". Understand that this is very different from the way an Apple-style BLE iBeacon works, which is a transmit only device. (I mention this because the question is tagged with ibeacon.)
What you are describing is probably better described as either a beacon scanner or a BLE scanner. My company has a Raspberry Pi-based product that can scan for beacons and take programmatic action based on detections. We have a blog post about how to make a beacon turn on a lamp using this device, but you could just as easily make it contact a server when a BLE device is detected.

Receive BLE signal from iBeacon to Bluno(arduino with BLE)

I want to receive rssi signal and UUID from iBeacon to Bluno which the Arduino board has BLE.
there are some questions for this.
Are there any solutions to receive UUID and rssi from BLE to BLE?
Is it possible to communicate two BLE device each other?
I want some sites to reference for this problem.
I also need to connect bluno with AR.Drone. Could you give me some advices for this?
thank you for your help
The Bluno has the ability to act as an iBeacon (transmitter), but it doesn't have the ability to receive iBeacon announcements and pass these to the Arduino.
BLE devices can communicate and can receive UUIDs and RSSIs, but it depends on the capability of the device and the interfaces it exposes. An iOS device, for example, exposes a very sophisticated BLE API. The Bluno board does not. It exposes a "serial port" to the Arduino and maps send/receive data to a set of BLE GATT characteristics. A pair of Bluno devices can be configured to act as a wireless serial link, or software on a computer or mobile device can exchange data with the Arduino via the bluetooth stack.
There is an AT command that will return the rssi of the paired device, but the documentation isn't clear as to whether this is available to the Arduino or only via the USB connection to a computer.
The best reference (such as it is) for the Bluno specifically, seems to be the DFRobot Wiki
I doubt you will be able to connect to the AR.Drone using Bluetooth Low Energy directly from a Bluno doesn't have Bluetooth LE. In theory you could connect another Bluno to the USB port on the AR.Drone and write software, but it would be simpler to get a WiFi shield for an Arduino and use the WiFi networking that is built in to the AR.Drone

Resources