简体   繁体   English

蓝牙GATT服务未在Android的BLE扫描中显示

[英]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. 我正在Bluez上使用USB蓝牙加密狗在TinyCore linux机器上工作。 We have used the example gatt server to add a battery service to send out a decreasing battery level. 我们已使用示例gatt服务器添加了电池服务,以发出不断下降的电池电量。 Using bluetoothctl, the information for our controller (A USB Bluetooth dongle) shows the service: 使用bluetoothctl,我们控制器的信息(USB蓝牙加密狗)显示了该服务:

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). 我们的目标是在Android应用程序上阅读此内容,但是在我们的自定义应用程序和示例BLE扫描应用程序中,我们看到的唯一服务是00001800(通用访问配置文件)和00001801(通用属性配置文件)。

My question is why can we see the Battery Service on bluetoothctl, but the service does not show up on discoverServices()? 我的问题是,为什么我们可以在bluetoothctl上看到电池服务,但是该服务未显示在discoverServices()上?

If this can lead you to your solution(I am using Raspberry Pi - not Tiny Core): 如果这可以将您引向您的解决方案(我正在使用Raspberry Pi-不是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. 致电: hciattach -l检查您的设备。

PS: Always appreciate the moderators opinion and thanks for the negative feedbacks - I am collecting them with passion;) PS:始终感谢主持人的意见,并感谢您的负面反馈-我正在热情地收集他们;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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