Monday, July 27, 2015

                                                    Bluetooth



BT ON/OFF

When we will do the BT ON/OFF on the UI, the call will go to the BluetoothManagerService and it will register the
BluetoothAdapter in this state it will init the stack and load the config file etc.

then the call will go to BluetoothAdapterProperties, BT state will change from 10->11.

after then it will start all the profile severice( like a2dp, pbap, hfp,avrcp etc), after then BT state will change from 11->12.

Now we will go for the bonding of the device{ When Remote device start the bonding or try to connect with local device.

The call will come to (btif_dm.c file) it will change the state to (BT_BOND_sTATE_BONDING) -> HAL(bluetooth.h)[bond_state_changed_callback]-> JNI(com_android_bluetooth_btservice_AdapterService.cpp)[bond_state_changed_callback]-->Application (BondStateMachine.java)[ bondStateChangeCallback]

Then appllication will respond through the JNI and then it will go to the stack {bluetooth.c{create_bond}--> btif_dm.c(btif_dm_create_bond())

Then BTIF layer will get the PIN_Request event (BTA_DM_PIN_REQ_EVT-> btif_dm_pin_req_evt)--> HAL--> JNI-->Application{ setPin--> pinReplyNative}



L BT states:
10[STATE_OFF]- Indicate BT adapter is off.
11[STATE_TURNING_ON]- Indicated the local BT adapter is turning on. However local clients should wait for (@link #STATE_ON) before attempting to use the adapter.
12[STATE_ON]-Indicate the local BT adapter is on, and ready for use.{ Start BREDR Service, Set connectable, discoverable}
13[STATE_TURNING_OFF]- Indicates the local BT adapter is turning off. Local clients should immediately attempt graceful disconnection of any remote links.{ OnBluetoothDisable--> Stop BR-EDR services, clear connectable, discoverable}

M BT state introduce some more states:
14[STATE_BLE_TURNING_ON]-
15[STATE_BLE_ON]-
16[STATE_BLE_TURNING_OFF]-

Turning ON State: 10-->14-->15-->11-->12
Turning OFF State: 12-->13-->15-->16-->10

-------------------- Once the BT is on, now we are going to Connect the i.e for the BOnding:------------
State Machine for BOND:
CREATE_BOND=1
CANCLE_BOND=2
REMOVE_BOND=3
BODING_STATE_CHANGE=4
SSP_REQUEST=5
PIN_REQUEST=6
BOND_STATE_NONE=0
BOND_STATE_BONDING=1
BOND_STATE_BONDED =2




Bonding main file are:
btif_dm.c

Bond types:

1. BOND_TYPE_UNKNOWN
2. BOND_TYPE_PERSISTENT
3. BOND_TYPE_TEMPORARY
4. ENCRYPTED_BREDR
5. ENCRYPTED_LE



Questions:

1. When ACL connection will be initiated??
2. when link key will be stored and how??

No comments:

Post a Comment

Qualcomm Short Term

  113 is the SL. 1st Target by mid July.

Total Pageviews