我需要用BLE按钮创建应用程序。我在RPi3上使用了简单的ab shutter和java应用程序。但tinyB并没有找到正确的主服务。然后我试着在bluez和gatttool的原生工具中寻找它。有人能帮忙吗:Blues 5.65正确连接到设备。然后info命令打印设备上的所有服务,gatttool也是。但命令列表属性只显示其中的一部分。特征,我需要-HID(00001812-0000-1000-800-000805f9b34bb(。如何在列表属性中找到它?原因tinyB库只显示前的列表
bluetoothctl信息:
info
Device 31:F7:32:16:2E:B2 (public)
Name: AB Shutter3
Alias: AB Shutter3
Appearance: 0x03c1
Icon: input-keyboard
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)
UUID: Unknown (0000ae40-0000-1000-8000-00805f9b34fb)
Modalias: usb:v2717p0040d0023
Battery Percentage: 0x58 (88)
列表属性:
list-attributes 31:F7:32:16:2E:B2
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service0008
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service0008/char0009
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service0008/char0009/desc000b
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c
0000180a-0000-1000-8000-00805f9b34fb
Device Information
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char000d
00002a29-0000-1000-8000-00805f9b34fb
Manufacturer Name String
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char000f
00002a24-0000-1000-8000-00805f9b34fb
Model Number String
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char0011
00002a25-0000-1000-8000-00805f9b34fb
Serial Number String
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char0013
00002a27-0000-1000-8000-00805f9b34fb
Hardware Revision String
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char0015
00002a26-0000-1000-8000-00805f9b34fb
Firmware Revision String
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char0017
00002a28-0000-1000-8000-00805f9b34fb
Software Revision String
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char0019
00002a23-0000-1000-8000-00805f9b34fb
System ID
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char001b
00002a2a-0000-1000-8000-00805f9b34fb
IEEE 11073-20601 Regulatory Cert. Data List
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service000c/char001d
00002a50-0000-1000-8000-00805f9b34fb
PnP ID
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service001f
0000180f-0000-1000-8000-00805f9b34fb
Battery Service
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service001f/char0020
00002a19-0000-1000-8000-00805f9b34fb
Battery Level
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service001f/char0020/desc0022
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service003e
0000ae40-0000-1000-8000-00805f9b34fb
Unknown
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service003e/char003f
0000ae41-0000-1000-8000-00805f9b34fb
Unknown
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service003e/char0041
0000ae42-0000-1000-8000-00805f9b34fb
Unknown
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_31_F7_32_16_2E_B2/service003e/char0041/desc0043
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
gatttool:
[31:F7:32:16:2E:B2][LE]> primary
命令失败:已断开连接连接成功[31:F7:32:16:2E:B2][LE]>主要的,重要的属性句柄:0x0001,结束grp句柄:0x0007 uuid:00001800-0000-1000-8000-00805f9b34bb属性句柄:0x0008,结束grp句柄:0x000b uuid:00001801-0000-1000-800-00805f9b34bb属性句柄:0x000c,结束grp句柄:0x001e uuid:0000180a-0000-1000-8000-00805f9b34bb属性句柄:0x001f,结束grp句柄:0x0022 uuid:0000180f-0000-1000-8000-00805f9b34fb属性句柄:0x0023,结束grp句柄:0x003d uuid:00001812-0000-1000-800-00805f9b34bb属性句柄:0x003e,结束grp句柄:0x0043 uuid:0000ae40-0000-1000-8000-00805f9b34fb
通过在单元文件(/lib/systemd/system/bluetooth.service(中添加--noplugin=input,hog at exec ,解决了问题