framework开启流程:
BluetoothAdapter::enable()
->BluetoothManagerService::enable()
->sendEnableMessage()
->BluetoothHandler::handleMessage(MESSAGE_ENABLE)
->handleEnable()->doBind()
Binder:
->OnserviceConnected()
->BluetoothHandler::handleMessage(service_connected)
AIDL:
->AdapterService::enable()
->AdapterState::offState::processMessage(BLE_TURN_ON)
->TurningBleOnState::Enter()
->AdapterService::bringUpBle()
->AdapterService::setProfileServiceState()
Start Service
->GattService extends ProfileServcie::create
->loadJni()
->classInitNative()
->GattService::onStartCommand()
->doStart()
->Start()
->initializeNatvie()
JNI
->initializeNatvie()
Callback to framework
AdapterService::onLeServiceUp()
->onBleOnState::processMessage(User_turn_on)
->TurningOnState::enter()
->StartProfileServics()
->SetAllProfileServiceStates()
->各种profileservice初始化,和GATT类似
->->initializeNatvie()
JNI
->initializeNatvie()每个profile执行一次
->ExecuteService()所有profile的service在这里启动
->BTA_AgEnable()
->bta_ag_api_enable()
->bta_ag_co_init()
->BTM_writeVoiceSettings()
->btsnd_hcic_write_voice_settings()发送hci command到底层
HCI
bte_main_hci_send()
->Hci_layer::enqueue_command()
异步
->transmit_fragement()
->hci_transmit()
->sendDataToController()
->uartController:sendCommand()
Android-Q蓝牙开启流程
最新推荐文章于 2024-05-01 23:23:08 发布