Bluetooth Driver services: Difference between revisions
No edit summary |
|||
Line 266: | Line 266: | ||
* Calls a modified version of BSA_Boot, which handles BSA server initialization. | * Calls a modified version of BSA_Boot, which handles BSA server initialization. | ||
* Calls a func which uses <code>nn::os::InitializeEvent</code> and <code>nn::os::InitializeMutex</code> with global state. | * Calls a func which uses <code>nn::os::InitializeEvent</code> and <code>nn::os::InitializeMutex</code> with global state. | ||
* Calls a func which handles BSA client initialization. This also sends a message to | * Calls a func which handles BSA client initialization. This also sends a message to the "nn.bluetooth.HidMessageHandler" thread for enabling bluetooth (which updates the interface funcptr tables, etc). | ||
* Calls a func which enables HID-Host with BSA, and opens the UIPC channel where the registered funcptr is used for writing HID DATA [[#GetHidReportEventInfo|reports]] which were received. | * Calls a func which enables HID-Host with BSA, and opens the UIPC channel where the registered funcptr is used for writing HID DATA [[#GetHidReportEventInfo|reports]] which were received. | ||
* Calls a func which initializes global state and uses | * Calls a func which initializes global state and uses BSA for initializing Security. | ||
* If the output flag from [[Settings_services#GetBluetoothBoostEnableFlag|GetBluetoothBoostEnableFlag]] is set, a func is called. | * If the output flag from [[Settings_services#GetBluetoothBoostEnableFlag|GetBluetoothBoostEnableFlag]] is set, a func is called. | ||
* If the output flag from [[Settings_services#GetBluetoothAfhEnableFlag|GetBluetoothAfhEnableFlag]] is not set, a func is called. | * If the output flag from [[Settings_services#GetBluetoothAfhEnableFlag|GetBluetoothAfhEnableFlag]] is not set, a func is called. | ||
Line 283: | Line 283: | ||
This is used by [[BTM_services|btm]]. | This is used by [[BTM_services|btm]]. | ||
This calls an interface funcptr. On success, the funcs for updating the interface funcptr tables are called (same as [[#InitializeBluetooth]]). Then the converted ret is returned as needed. | |||
When bluetooth is already disabled, that funcptr just returns 0. Otherwise when it's already enabled, it does the following: | |||
* Calls a func which closes the HID-Host UIPC channel, and uses BSA for disabling HID-Host. | |||
* Calls a func which uses <code>nn::os::FinalizeMutex</code> and <code>nn::os::FinalizeEvent</code> with global state. | |||
* Uses <code>nn::os::InitializeEvent</code>, <code>nn::os::InitializeTimerEvent</code>, with a ptr for the former Event being written into global state. | |||
* Uses BTA_DisableBluetooth. | |||
* Uses <code>nn::os::StartOneShotTimerEvent</code> with a value of 5 seconds. | |||
* Waits for either of the above to trigger using <code>nn::os::TryWaitEvent</code> and <code>nn::os::TryWaitTimerEvent</code>, with each loop iteration [[SVC|sleeping]] for 5000000 nanoseconds. | |||
** The Event is signaled when disabling bluetooth finishes. | |||
* Cleanup for the above Event/TimerEvent is done. | |||
* Calls a func which handles BSA client cleanup. | |||
* Calls a func which does the following: | |||
** Calls a func which tells the "nn.bluetooth.TimerThread" to exit, then destroys that thread (GKI timer thread). | |||
** Calls a func which just returns. | |||
** Calls a func which handles GKI cleanup (including destroying the task threads). | |||
** Calls a func which waits for the UIPC threads to exit + destroys the threads and handles cleanup. | |||
* Calls the same GPIO func as [[#EnableBluetooth]] with param=0. | |||
* Sends a message to the "nn.bluetooth.HidMessageHandler" thread for disabling bluetooth (which updates the interface funcptr tables, etc). | |||
== FinalizeBluetooth == | == FinalizeBluetooth == |