1. init创建bt_config文件,并建立bluedroid和java之间回调机制;
2. enable过程完成工作:
Ø 启动HCI和BTSNOOP;
Ø Initialize the mandatory core stack control blocks(BTU, BTM, L2CAP,and SDP);
Ø Initialize any optional stack components(RFCOM,BNEP,PAN,A2DP,AVRCP,GAP,HID_HOST);
Ø BTA初始化;
Ø 注册btu_bta_msg_queuebtu_hci_msg_queue btu_general_alarm_queue对应的 fixed_queue_cb为btu_bta_msg_readybtu_hci_msg_ready alarm_queue_ready,建立BTU与bta hclgeneral_alarm的通信机制;
Ø 通过bta_sys_main的状态机切换: BTA_SYS_HW_OFF_EVT-> BTA_SYS_HW_STARTING -> BTA_SYS_HW_ON进入enable状态,最后进行底初始化:
Ø /* make sure the control block is properly initialized*/bta_dm_init_cb();
Ø /* load BLE local information:ID keys, ER if available */
bta_dm_co_ble_load_local_keys(&key_mask,er, &id_key);
Ø /* initialize bluetooth lowpower manager */
bta_dm_init_pm();
Ø 初始化gatt:
bta_dm_gattc_register();