2013年3月24日星期日

Bluetooth2.0 vs 4.0


I read Bluetooth4.0 spec roughly, and wrote down some difference between bluetooth2.0/3.0 vs 4.0.

2013年3月11日星期一

bluez learning

use ./bootstrap-configure to configure bluez
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




BLE codes couldn't compile successfully in JellyBean 4.2

after I defined BLE_INCLUDED, GATT_SERVER_ENABLED to compile bluedoird in JellyBean 4.2 code, there are many compilation error. 

The newest Jelly Bean 4.2 codes don’t implement GATT and GAP protocol fully. I found many .h defined and no .c is implemented, examples include: bta/gatt/bta_gatt_co.h defined many functions while all of them are not implemented, GAP function like GAP_BleReadPeerDevName is not defined, and other data structure tBTE_APPL_CFG is not defined….

2013年3月10日星期日

new bluedoid stack in Android

Android bluetooth stack changes to bluedroid stack from broadcom in Android 4.2, there is few introduction on this new bluedroid architecture. Below is my analysis on this new architecture.