打开系统蓝牙
sudo service bluetooth start
进入bluetoothctl
Sudo bluetoothctl
输入以下命令
power on
agent on
default-agent
scan on
pair C0:50:27:32:09:33
连接成功以后
[bluetooth]# pair c0:50:27:32:09:33
Attempting to pair with C0:50:27:32:09:33
[CHG] Device C0:50:27:32:09:33 Connected: yes
[NEW] Primary Service
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0001
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
[NEW] Characteristic
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0001/char0002
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
[NEW] Descriptor
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0001/char0002/desc0004
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Primary Service
/org/bluez/hci0/dev_C0_50_27_32_09_33/service000c
00000000-000e-11e1-9ab4-0002a5d5c51b
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C0_50_27_32_09_33/service000c/char000d
00000001-000e-11e1-ac36-0002a5d5c51b
Vendor specific
[NEW] Descriptor
/org/bluez/hci0/dev_C0_50_27_32_09_33/service000c/char000d/desc000f
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Characteristic
/org/bluez/hci0/dev_C0_50_27_32_09_33/service000c/char0010
00000002-000e-11e1-ac36-0002a5d5c51b
Vendor specific
[NEW] Descriptor
/org/bluez/hci0/dev_C0_50_27_32_09_33/service000c/char0010/desc0012
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Primary Service
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0013
00000000-0003-11e1-9ab4-0002a5d5c51b
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0013/char0014
00000100-0001-11e1-ac36-0002a5d5c51b
Vendor specific
[NEW] Descriptor
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0013/char0014/desc0016
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Primary Service
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0017
00000000-0001-11e1-9ab4-0002a5d5c51b
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0017/char0018
00020000-0001-11e1-ac36-0002a5d5c51b
Vendor specific
[NEW] Descriptor
/org/bluez/hci0/dev_C0_50_27_32_09_33/service0017/char0018/desc001a
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
而且可以通过info看到
[TILEBOX]# info
Device C0:50:27:32:09:33 (public)
Name: TILEBOX
Alias: TILEBOX
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Vendor specific (00000000-0001-11e1-9ab4-0002a5d5c51b)
UUID: Vendor specific (00000000-0003-11e1-9ab4-0002a5d5c51b)
UUID: Vendor specific (00000000-000e-11e1-9ab4-0002a5d5c51b)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
很可惜,这个连接不稳定,很快出现
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device C0:50:27:32:09:33 Connected: no
出现这个问题后,再次连接不成功,即使重启树莓派也无效,但此时只需要重启SensorTile.Box就可以再次连接。
原因暂不明,怀疑是我手上的SensorTile.Box蓝牙不稳定造成。 |