简体   繁体   中英

Bluetooth GATT service not showing up on BLE Scan on Android

I am working with Bluez on a TinyCore linux box with a USB bluetooth dongle. We have used the example gatt server to add a battery service to send out a decreasing battery level. Using bluetoothctl, the information for our controller (A USB Bluetooth dongle) shows the service:

Controller 00:07:80:C1:AC:89
Name: box
Alias: box
Class: 0x000104
Powered: yes
Discoverable: yes
Pairable: yes
UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d052D
Discovering: no

The goal is to read this on an Android app, but in our custom app and a sample BLE Scanning app, the only services we see are 00001800 (Generic Access Profile) and 00001801 (Generic Attribute Profile).

My question is why can we see the Battery Service on bluetoothctl, but the service does not show up on discoverServices()?

If this can lead you to your solution(I am using Raspberry Pi - not Tiny Core):
The attachment of the bluetooth to the serial interface have issues. Reattaching it solves the problem - in my case:

sudo hciattach /dev/ttyAMA0 bcm43xx 9210600 noflow 

call: hciattach -l to check for you device.

PS: Always appreciate the moderators opinion and thanks for the negative feedbacks - I am collecting them with passion;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM