2017-09-18 6 views
0

私の目標は、BlueZ 4.101(BlueZ 5.Xではなく)を使用して、UbuntuのUSB BLE Dongle(Cambridge Silicon Radio CSR8510 A10) 14.04。 BlueZ 4.101には、gatt-exampleというプラグインが同梱されています。例えば、ポストの最後の答えは、それが動作主張:Bluez: advertise service/gatt server example?Linux BlueZ 4.101はGATT接続を許可しますが、UbuntuでGATTサービスを公開しません

は最終的に、私はこの記事に類似のbluez 4.101で自分のGATTサーバを実装する: http://gaiger-programming.blogspot.tw/2015/01/bluetooth-low-energy-customizing-gatt.html

私は私を使用することができましたBLE広告を見てBLEサーバーに接続するにはiPhoneが必要ですが、BlueZ 4.101に付属のGATT Serverの例では特性やサービスが表示されません。電話機の複数のBLEスキャナアプリは、BLEサーバーの広告を表示して接続を許可しますが、このデバイスにはサービスがないと言われます。 rootとして(

sudo apt-get remove --purge bluez* -y 
sudo apt-get install bison byacc flex -y 
wget http://www.kernel.org/pub/linux/bluetooth/bluez-4.101.tar.gz 
tar xvf bluez-4.101.tar.gz 
cd bluez-4.101 
sudo service bluetooth stop 
sudo make clean 
sudo make distclean 
sudo ./configure CFLAGS='-Wall -Wextra -O2 -Wno-error' --prefix=/usr --enable-maintainer-mode 
sudo make all 
sudo make install 
sudo vim /etc/bluetooth/main.conf 

# Enable the GATT functionality. Default is false 
EnableGatt = true 

# Enable the GATT Attribute Server. Default is false, because it is only 
# useful for testing. Attribute server is not enabled over LE if EnableLE 
# is false. 
AttributeServer = true 

私は、このようなGATTサーバを起動します。私は完全に次の命令のセットで自分自身をUbuntuの14.04でのbluez 4.101のパッケージマネージャのバージョンを削除し、それをコンパイルするために管理してきました

):

#!/bin/sh 

killall bluetoothd 2>/dev/null 
bluez-4.101/tools/hciconfig hci1 down 
bluez-4.101/mgmt/btmgmt -i hci1 power off 
bluez-4.101/mgmt/btmgmt -i hci1 le on 
bluez-4.101/tools/hciconfig hci1 up 
bluez-4.101/tools/hciconfig hci1 sspmode 1 
bluez-4.101/tools/hcitool -i hci1 cmd 0x08 0x0008 48 45 4c 4c 4f 57 4f 52 4c 44 
bluez-4.101/mgmt/btmgmt -i hci1 bondable off 
bluez-4.101/mgmt/btmgmt -i hci1 connectable on 
bluez-4.101/mgmt/btmgmt -i hci1 bredr off 
bluez-4.101/mgmt/btmgmt -i hci1 advertising on 
bluez-4.101/mgmt/btmgmt -i hci1 power on 
#tools/hcitool -i hci1 cmd 0x08 0x0008 15 02 01 06 11 06 fe f8 46 3e 16 00 0d b5 e2 11 62 75 10 18 98 b6 
#src/bluetoothd -d -n --noplugin=time,audio,input,serial,network,alert,proximity,thermometer & 
#src/bluetoothd -d -n --plugin=thermometer & 
#src/bluetoothd -d -n --plugin=gatt_example & 
bluez-4.101/src/bluetoothd -d -n & 
sleep 3 
bluez-4.101/mgmt/btmgmt -i hci1 name "MyCustomBLETest" 
bluez-4.101/tools/hciconfig hci1 leadv 

私はちょうど1プラグイン「時間」を有効にしよう - 私は次のエラーを取得すると、デバイスが検出可能ではありません。

bluetoothd[6373]: Bluetooth daemon 4.101 
bluetoothd[6373]: src/main.c:parse_config() parsing main.conf 
bluetoothd[6373]: src/main.c:parse_config() discovto=0 
bluetoothd[6373]: src/main.c:parse_config() pairto=0 
bluetoothd[6373]: src/main.c:parse_config() pageto=8192 
bluetoothd[6373]: src/main.c:parse_config() auto_to=60 
bluetoothd[6373]: src/main.c:parse_config() name=%h-%d 
bluetoothd[6373]: src/main.c:parse_config() class=0x000100 
bluetoothd[6373]: src/main.c:parse_config() Key file does not have key 'DeviceID' in group 'General' 
bluetoothd[6373]: Starting SDP server 
bluetoothd[6373]: src/plugin.c:plugin_init() Loading builtin plugins 
bluetoothd[6373]: Ignoring (cli) audio 
bluetoothd[6373]: Ignoring (cli) input 
bluetoothd[6373]: Ignoring (cli) serial 
bluetoothd[6373]: Ignoring (cli) network 
bluetoothd[6373]: Ignoring (cli) service 
bluetoothd[6373]: Ignoring (cli) thermometer 
bluetoothd[6373]: Ignoring (cli) alert 
bluetoothd[6373]: src/plugin.c:add_plugin() Loading time plugin 
bluetoothd[6373]: Ignoring (cli) gatt_example 
bluetoothd[6373]: Ignoring (cli) proximity 
bluetoothd[6373]: Ignoring (cli) deviceinfo 
bluetoothd[6373]: Ignoring (cli) hciops 
bluetoothd[6373]: Ignoring (cli) mgmtops 
bluetoothd[6373]: Ignoring (cli) formfactor 
bluetoothd[6373]: Ignoring (cli) storage 
bluetoothd[6373]: Ignoring (cli) adaptername 
bluetoothd[6373]: src/plugin.c:plugin_init() Loading plugins /home/pi/Desktop/bluez-4.101/plugins/.libs 
bluetoothd[6373]: Ignoring (cli) external_dummy 
bluetoothd[6373]: Not enough free handles to register service 
bluetoothd[6373]: adapter_ops_setup failed 

今すぐ電話が見るとドングルに接続しますが、これまでのすべてのサービスを参照するか、いずれかの特性を読み取ることができないことができます。

enter image description here enter image description here

私はGATTサーバーが完全に動作し、適切に宣伝してもらうにはどうすればよいとそれがサービスと特性を相互作用させることを許可するか?

答えて

0

明らかに、これは使用されているラジオと関係があります。 CSR BLE DongleはGATTサーバとして機能しません。私はテキサスインスツルメンツWL1271と別のボード上でこれらの正確な手順を実行し、それは動作します! iPhoneはGATTサービス/特性を見ることができます。

関連する問題