Changes

664 bytes added ,  18:18, 31 January 2021
no edit summary
Line 166: Line 166:  
== SetSlotMode ==
 
== SetSlotMode ==
 
Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], no output.
 
Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], no output.
 +
 +
Sends a request which is then handled as follows:
 +
* Calls a func for getting the data from [[#DeviceSlotModeList]] etc for passing to another func, that func then does the following:
 +
* Goes through multiple arrays of [[#BdAddress|BdAddress]].
 +
** First array:
 +
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found.
 +
*** Calls the SetTsi wrapper func described below, with the above [[#BdAddress|BdAddress]] and tsi=0xFF (Exit). If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]].
 +
** Second array:
 +
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found.
 +
*** Uses [[Bluetooth_Driver_services#SetBleConnectionParameter|SetBleConnectionParameter]] with bool=true. Then the required EventInfo is loaded, {...}.
 +
** Then it goes through the first array again, except here it does the following:
 +
*** Calls the same func for validating the [[#BdAddress|BdAddress]] with state, skipping it if not found. It is also skipped if the u32 at Address+0x8 is value 0x3.
 +
*** Determines what Tsi value to use, on failure [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used and the loop is continued.
 +
*** Calls the SetTsi wrapper func described below, with the [[#BdAddress|BdAddress]] and the above Tsi value. If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]].
 +
** It then goes through various arrays again for updating state.
 +
** {...}
 +
 +
The SetTsi wrapper func is implemented as follows:
 +
* Uses [[Bluetooth_Driver_services#SetTsi|SetTsi]], on failure true is returned.
 +
* Gets the required EventInfo, returning false if a match wasn't found / EventInfo status indicates failure. True is returned for success.
    
== SetBluetoothMode ==
 
== SetBluetoothMode ==
Line 391: Line 411:  
Takes a 0x44-byte input struct, no output.
 
Takes a 0x44-byte input struct, no output.
   −
This is used by [[HID_services|hid]] at some point when there's new hid connections, leaving "Change Grip/Order" in the [[Controller_Applet]] with new connections also triggers it via [[HID_services|hid]] at some point.
+
Sends a request which is then handled as follows:
 +
* Calls a func for getting the data from the input struct etc for passing to another func, that func is the same one called by [[#SetSlotMode]].
   −
Sends a request which is then handled as follows:
+
The input struct has the following structure:
* Goes through multiple arrays of [[#BdAddress|BdAddress]].
+
 
** First array:
+
{| class="wikitable" border="1"
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found.
+
|-
*** Calls the SetTsi wrapper func described below, with the above [[#BdAddress|BdAddress]] and tsi=0xFF (Exit). If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]].
+
! Offset
** Second array:
+
! Size
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found.
+
! Description
*** Uses [[Bluetooth_Driver_services#SetBleConnectionParameter|SetBleConnectionParameter]] with bool=true. Then the required EventInfo is loaded, {...}.
+
|-
** Then it goes through the first array again, except here it does the following:
+
| 0x0 || 0x10 * 4 || Array of the below struct.
*** Calls the same func for validating the [[#BdAddress|BdAddress]] with state, skipping it if not found. It is also skipped if the u32 at Address+0x8 is value 0x3.
+
|-
*** Determines what Tsi value to use, on failure [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used and the loop is continued.
+
| 0x40 || 0x4 || s32 count, for the array at +0.
*** Calls the SetTsi wrapper func described below, with the [[#BdAddress|BdAddress]] and the above Tsi value. If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]].
+
|}
** It then goes through various arrays again for updating state.
+
 
** {...}
+
Struct for the above array:
   −
The SetTsi wrapper func is implemented as follows:
+
{| class="wikitable" border="1"
* Uses [[Bluetooth_Driver_services#SetTsi|SetTsi]], on failure true is returned.
+
|-
* Gets the required EventInfo, returning false if a match wasn't found / EventInfo status indicates failure. True is returned for success.
+
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x6 || [[#BdAddress|BdAddress]]
 +
|-
 +
| 0x6 || 0x6 || Unused
 +
|-
 +
| 0xC || 0x1 || Used to determine data which is then used for [[Bluetooth_Driver_services#BleConnectionParameter|BleConnectionParameter]].
 +
|-
 +
| 0xD || 0x3 || Padding
 +
|}
    
== Cmd62 ==
 
== Cmd62 ==