Bluetooth Driver services: Difference between revisions

No edit summary
Line 275: Line 275:
This is used by [[BTM_services|btm]], this should not be used by other processes.
This is used by [[BTM_services|btm]], this should not be used by other processes.


This first initializes the funcptr table interfaces to the defaults (same as [[#DisableBluetooth]]). [[Settings_services#GetConfigurationId1|GetConfigurationId1]] is used, an error is thrown if the output string is empty, or if it matches "SDEV_00_01_00".
[1.0.0-11.0.1] This first initializes the funcptr table interfaces to the defaults (same as [[#DisableBluetooth]]). [[Settings_services#GetConfigurationId1|GetConfigurationId1]] is used, an error is thrown if the output string is empty, or if it matches "SDEV_00_01_00".


If the flag for [[#IsManufacturingMode]] is 0, or if this cmd was already used where that flag was 1, an interface funcptr is called. This is passed a ptr to a table of funcptrs. The ret is converted to a Result and returned if needed.
If the flag for [[#IsManufacturingMode]] is 0, or if this cmd was already used where that flag was 1, an interface funcptr is called. This is passed a ptr to a table of funcptrs. The ret is converted to a Result and returned if needed. [12.0.0+] A normal func is called instead, with no params/ret. This cmd always returns 0.


The funcptr does the following:
The above called func does the following:
* A func is called, which copies the input funcptr table into global state. These are used for writing events into [[#EventInfo]].
* [1.0.0-11.0.1] A func is called, which copies the input funcptr table into global state. These are used for writing events into [[#EventInfo]].
* A func is called 5 times with input param = [1-5]. This initializes the specified nn::bluetooth::CircularBuffer (sharedmem and internal).
* A func is called 5 times with input param = [1-5]. This initializes the specified nn::bluetooth::CircularBuffer (sharedmem and internal). [12.0.0+] This functionality is now inlined.
* A func is called for creating the "nn.bluetooth.HidMessageHandler" thread.
* A func is called for creating the "nn.bluetooth.HidMessageHandler" thread. [12.0.0+] This functionality is now inlined.


Lastly, the Event is created and returned (which global state the Event is stored in depends on whether the code-path which calls the above funcptr was used).
Lastly, the Event is ([1.0.0-11.0.1] created and) returned (which global state the Event is stored in depends on whether the code-path which calls the above funcptr was used).


== EnableBluetooth ==
== EnableBluetooth ==