make to compile bluez
tools/hciconfig -a to list all controller
tools/hciconfig hci0 up to enable hci0 controller
tools/hcitools lescan to scan LE device
tools/hcitools lecc 00:18:..... to connect LE device
attrib/gatttool -i hci0 -b 00:18:... -m 48 --interactive
>connect
>primary
>characteristics 0x0001 0x000b
>char-desc 0x0001 0x000b
>char-read-uuid 2a06
>disconnect
monitor/btmon to monitor bluetooth messages in detail, one good way to debug
client/bluetoothctl could communicate with bluetoothd to send dbus message to control the connection
>remove 00:18:..... could remove the pairing information between bluetooth controller and device
>connect 00:18:.....
>disconnect
The pairing information is stored in /var/lib/bluetooth/00:26:19:**/00:18:*** after one successful connection. 00:26:19:** is mac address of bluetooth controller. 00:18:*** is the mac address of BLE device.
$ls /var/lib/bluetooth/00:26:19:**/00:18:***
attributes gatt info
$cat info
[LongTermKey]
Key=0x450BB7B3247459D8E27A65887DABC8E1
Authenticated=1
Master=1
EncSize=16
EDiv=53013
Rand=0x3F56CC125FD6E27A
[General]
Name=UJuicer Alert
SupportedTechnologies=LE
AddressType=public
Trusted=false
Blocked=false
Services=00001800-0000-1000-8000-00805f9b34fb;00001801-0000-1000-8000-00805f9b34fb;00001802-0000-1000-8000-00805f9b34fb;00001803-0000-1000-8000-00805f9b34fb;00001804-0000-1000-8000-00805f9b34fb;0000180a-0000-1000-8000-00805f9b34fb;0000180f-0000-1000-8000-00805f9b34fb;7aac6ac0-afca-11e1-9feb-0002a5d5c51b;
[DeviceID]
Source=1
Vendor=13
Product=0
Version=272
$cat attributes #these are attributes defined here
https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
[1]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=1800
EndGroupHandle=11
[12]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=1801
EndGroupHandle=15
[16]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=180A
EndGroupHandle=34
[35]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=1803
EndGroupHandle=37
[38]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=1802
EndGroupHandle=40
[41]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=1804
EndGroupHandle=44
[45]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=180F
EndGroupHandle=49
[50]
UUID=00002800-0000-1000-8000-00805f9b34fb
Value=7AAC6AC0AFCA11E19FEB0002A5D5C51B
EndGroupHandle=65535
没有评论:
发表评论