我正在尝试创建一个覆盆子蓝牙外设,我正在使用Raspbian和Bluez v 5.11,我已经尝试了很多,但我找不到解决问题的方法,我正在使用USB蓝牙加密狗Inatek BTA-CSR4B5,如果我这样做:
hciconfig我有:
hci0: Type: BR/EDR Bus: USB
BD Address: 00:1A:7D:DA:71:13 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:5050 acl:79 sco:0 events:493 errors:0
TX bytes:8994 acl:78 sco:0 commands:395 errors:0因此,这个设备看起来工作得很好,如果我试着让它成为一个iBeacon,例如执行下面的脚本:
ibeacon.conf:
export BLUETOOTH_DEVICE=hci0
export UUID="e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0"
export MAJOR="00 16"
export MINOR="00 08"
export POWER="c5"ibeacon_start
#!/bin/sh
. ./ibeacon.conf
echo "Launching virtual iBeacon..."
sudo hciconfig $BLUETOOTH_DEVICE up
sudo hciconfig $BLUETOOTH_DEVICE noleadv
sudo hciconfig $BLUETOOTH_DEVICE leadv 0
sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 $UUID $MAJOR $MINOR $POWER 00
echo "Complete"它起作用了。
但我想做一个蓝牙外设,为此,我使用了这个库:
https://github.com/sandeepmistry/bleno
当我在bleno项目中启动一个测试代码时,我可以找到服务,但是当我尝试使用iOS设备连接到外围设备时,我得到了一个超时连接。
我已经做了很多测试,我已经找到了这个问题的一半解决方案,如果我用bleno启动服务,并且服务是打开的,在另一个终端上我这样做:
sudo hciconfig hci0 up
sudo hciconfig hci0 noleadv
sudo hciconfig hci0 leadv 0当我尝试连接到外设works时,当我断开外设连接并再次尝试连接时,它不再起作用,要使works再次工作,我必须再次执行此操作:
sudo hciconfig hci0 up
sudo hciconfig hci0 noleadv
sudo hciconfig hci0 leadv 0所以我的问题是,我该如何解决我的问题?那么避免每次都做上面的命令,而使蓝牙外设始终接受连接呢?
发布于 2014-11-18 09:13:59
你有没有尝试过hciconfig hci0 sspmode 1?
https://stackoverflow.com/questions/25597203
复制相似问题