BTM services: Difference between revisions

No edit summary
No edit summary
Line 162: Line 162:


== SetBurstMode ==
== SetBurstMode ==
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a bool, no output.
Takes an input [[#BdAddress|BdAddress]] and a bool, no output.


== SetSlotMode ==
== SetSlotMode ==
Line 185: Line 185:


== RemoveDeviceInfo ==
== RemoveDeviceInfo ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


== IncreaseDeviceInfoOrder ==
== IncreaseDeviceInfoOrder ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


== LlrNotify ==
== LlrNotify ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


[9.0.0+] Takes an input [[Bluetooth_Driver_services#Address|Address]] and a s32, no output.
[9.0.0+] Takes an input [[#BdAddress|BdAddress]] and a s32, no output.


== EnableRadio ==
== EnableRadio ==
Line 202: Line 202:


== HidDisconnect ==
== HidDisconnect ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


== HidSetRetransmissionMode ==
== HidSetRetransmissionMode ==
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a type-0x19 input buffer containing a [[#ZeroRetransmissionList]], no output.
Takes an input [[#BdAddress|BdAddress]] and a type-0x19 input buffer containing a [[#ZeroRetransmissionList]], no output.


== AcquireAwakeReqEvent ==
== AcquireAwakeReqEvent ==
Line 222: Line 222:


== ProtectDeviceInfo ==
== ProtectDeviceInfo ==
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a bool, no output.
Takes an input [[#BdAddress|BdAddress]] and a bool, no output.


== AcquireBleScanEvent ==
== AcquireBleScanEvent ==
Line 269: Line 269:


== BleConnect ==
== BleConnect ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


An error is thrown if the [[Bluetooth_Driver_services#Address|Address]] is already connected (listed in the [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] from [[#BleGetConnectionState]]). An error is thrown if 4 [[#BleGetConnectionState|devices]] are already connected.
An error is thrown if the [[#BdAddress|BdAddress]] is already connected (listed in the [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] from [[#BleGetConnectionState]]). An error is thrown if 4 [[#BleGetConnectionState|devices]] are already connected.


== BleOverrideConnection ==
== BleOverrideConnection ==
Line 305: Line 305:


== BleUnpairDevice ==
== BleUnpairDevice ==
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output.
Takes an input [[#BdAddress|BdAddress]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output.


== BleGetPairedAddresses ==
== BleGetPairedAddresses ==
Takes a type-0xA output buffer containing an array of [[Bluetooth_Driver_services#Address|Address]], a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], returns an output u8 total_out.
Takes a type-0xA output buffer containing an array of [[#BdAddress|BdAddress]], a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], returns an output u8 total_out.


The max array entries is 10.
The max array entries is 10.
Line 394: Line 394:


Sends a request which is then handled as follows:
Sends a request which is then handled as follows:
* Goes through multiple arrays of [[Bluetooth_Driver_services#Address|Address]].
* Goes through multiple arrays of [[#BdAddress|BdAddress]].
** First array:
** First array:
*** Validates the [[Bluetooth_Driver_services#Address|Address]] with state, skipping it if not found.
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found.
*** Calls the SetTsi wrapper func described below, with the above [[Bluetooth_Driver_services#Address|Address]] and tsi=0xFF (Exit). If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[Bluetooth_Driver_services#Address|Address]].
*** 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:
** Second array:
*** Validates the [[Bluetooth_Driver_services#Address|Address]] with state, skipping it if not found.
*** 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, {...}.
*** 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:
** Then it goes through the first array again, except here it does the following:
*** Calls the same func for validating the [[Bluetooth_Driver_services#Address|Address]] with state, skipping it if not found. It is also skipped if the u32 at Address+0x8 is value 0x3.
*** 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.
*** 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 [[Bluetooth_Driver_services#Address|Address]] and the above Tsi value. If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[Bluetooth_Driver_services#Address|Address]].
*** 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.
** It then goes through various arrays again for updating state.
** {...}
** {...}
Line 478: Line 478:


== CreateBond ==
== CreateBond ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


== CancelBond ==
== CancelBond ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


== SetTsiMode ==
== SetTsiMode ==
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a [[#TsiMode]], no output.
Takes an input [[#BdAddress|BdAddress]] and a [[#TsiMode]], no output.


Sends a request which is handled as follows: uses [[Bluetooth_Driver_services#SetTsi|SetTsi]] directly with the specified params.
Sends a request which is handled as follows: uses [[Bluetooth_Driver_services#SetTsi|SetTsi]] directly with the specified params.
Line 492: Line 492:


== HidConnect ==
== HidConnect ==
Takes an input [[Bluetooth_Driver_services#Address|Address]], no output.
Takes an input [[#BdAddress|BdAddress]], no output.


== GeneralGet ==
== GeneralGet ==
Line 498: Line 498:


== GetGattClientDisconnectionReason ==
== GetGattClientDisconnectionReason ==
Takes an input [[Bluetooth_Driver_services#Address|Address]] and an u32, returns an output bool and u16.
Takes an input [[#BdAddress|BdAddress]] and an u32, returns an output bool and u16.


The bool indicates whether the cmd is successful.
The bool indicates whether the cmd is successful.
Line 735: Line 735:


=== BleConnect ===
=== BleConnect ===
Takes a PID, an [[Bluetooth_Driver_services#Address|Address]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
Takes a PID, an [[#BdAddress|BdAddress]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.


This is similar to the [[#BleConnect|btm]] cmd.
This is similar to the [[#BleConnect|btm]] cmd.
Line 765: Line 765:


=== BleUnPairDevice2 ===
=== BleUnPairDevice2 ===
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output.
Takes an input [[#BdAddress|BdAddress]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output.


This is similar to the [[#BleUnPairDevice|btm]] cmd.
This is similar to the [[#BleUnPairDevice|btm]] cmd.


=== BleGetPairedDevices ===
=== BleGetPairedDevices ===
Takes a type-0xA output buffer containing an array of [[Bluetooth_Driver_services#Address|Address]], a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], returns an output u8 total_out.
Takes a type-0xA output buffer containing an array of [[#BdAddress|BdAddress]], a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], returns an output u8 total_out.


This is the same as the [[#BleGetPairedAddresses|btm]] cmd.
This is the same as the [[#BleGetPairedAddresses|btm]] cmd.
Line 839: Line 839:


This is similar to the [[#UnregisterBleGattDataPath|btm]] cmd.
This is similar to the [[#UnregisterBleGattDataPath|btm]] cmd.
= BdAddress =
This is "nn::btm::BdAddress". This is a 0x6-byte struct with 1-byte alignment.
= BdName =
This is "nn::btm::BdName". This is a 0x20-byte struct with 1-byte alignment.
= ClassOfDevice =
This is "nn::btm::ClassOfDevice". This is a 0x3-byte struct with 1-byte alignment.
= LinkKey =
This is "nn::btm::LinkKey". This is a 0x10-byte struct with 1-byte alignment.


= BtmState =
= BtmState =
This is "nn::btm::BtmState". This is an u32 enum.
This is "nn::btm::BtmState".
 
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 0 || NotInitialized
|-
| 1 || RadioOff
|-
| 2 || MinorSlept
|-
| 3 || RadioOffMinorSlept
|-
| 4 || Slept
|-
| 5 || RadioOffSlept
|-
| 6 || Initialized
|-
| 7 || Working
|}


= BluetoothMode =
= BluetoothMode =
This is "nn::btm::BluetoothMode". This is an u32 enum.
This is "nn::btm::BluetoothMode".
 
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 0 || Dynamic2Slot
|-
| 1 || StaticJoy
|}


= WlanMode =
= WlanMode =
This is "nn::btm::WlanMode". This is an u32 enum.
This is "nn::btm::WlanMode".
 
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 0 || Local4
|-
| 1 || Local8
|-
| 2 || None
|}


= TsiMode =
= TsiMode =
This is "nn::btm::TsiMode". This is an u32 enum.
This is "nn::btm::TsiMode".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 879: Line 932:
|-
|-
| 255 || Active
| 255 || Active
|}
= SlotMode =
This is "nn::btm::SlotMode".
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 0 || 2
|-
| 1 || 4
|-
| 2 || 6
|-
| 3 || Active
|}
= Profile =
This is "nn::btm::Profile".
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 0 || None
|-
| 1 || Hid
|}
= HidDeviceInfo =
This is "nn::btm::HidDeviceInfo".
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x2 || Vid
|-
| 0x2 || 0x2 || Pid
|}
|}


Line 890: Line 985:
! Description
! Description
|-
|-
| 0x0 || 0x9 || Same as [[Bluetooth_Driver_services#AdapterProperty|AdapterProperty]]+0x0.
| 0x0 || 0x6 || [[#BdAddress|BdAddress]]
|-
|-
| 0x9 || 0x1F || Same as [[Bluetooth_Driver_services#AdapterProperty|AdapterProperty]]+0x9.
| 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]]
|-
|-
| 0x28 || 0x1 || Always zero.
| 0x9 || 0x20 || [[#BdName|BdName]]
|-
|-
| 0x29 || 0x1 || Same as [[Bluetooth_Driver_services#AdapterProperty|AdapterProperty]]+0x102.
| 0x29 || 0x1 || FeatureSet
|}
 
= DeviceSlotMode =
This is "nn::btm::DeviceSlotMode". This is a 0xC-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x6 || [[#BdAddress|BdAddress]]
|-
| 0x6 || 0x2 || Reserved
|-
| 0x8 || 0xC || [[#SlotMode|SlotMode]]
|}
|}


= DeviceSlotModeList =
= DeviceSlotModeList =
This is "nn::btm::DeviceSlotModeList". This is a 0x64-byte struct.
This is "nn::btm::DeviceSlotModeList". This is a 0x64-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x1 || DeviceCount
|-
| 0x1 || 0x3 || Reserved
|-
| 0x4 || 0xC * 8 || Array of [[#DeviceSlotMode|DeviceSlotMode]]
|}
= DeviceInfo =
This is "nn::btm::DeviceInfo". This is a 0x60-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x6 || [[#BdAddress|BdAddress]]
|-
| 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]]
|-
| 0x9 || 0x20 || [[#BdName|BdName]]
|-
| 0x29 || 0x10 || [[#LinkKey|LinkKey]]
|-
| 0x39 || 0x3 || Reserved
|-
| 0x3C || 0x4 || [[#Profile|Profile]]
|-
| 0x40 || 0x4 || Empty (Profile = None) or [[#HidDeviceInfo|HidDeviceInfo]] (Profile = Hid)
|-
| 0x44 || 0x1C || Reserved
|}


= DeviceInfoList =
= DeviceInfoList =
Line 911: Line 1,061:
! Description
! Description
|-
|-
| 0x0 || 0x1 || Total entries.
| 0x0 || 0x1 || DeviceCount
|-
|-
| 0x1 || 0x3 || Padding
| 0x1 || 0x3 || Reserved
|-
|-
| 0x4 || 0xA*60(0x3C0) || Array of [[#DeviceInfo]].
| 0x4 || 0xA * 60 || Array of [[#DeviceInfo|DeviceInfo]]
|}
|}


= DeviceInfo =
= DeviceProperty =
This is "nn::btm::DeviceInfo". This is a 0x60-byte struct.
This is "nn::btm::DeviceProperty". This is a 0x29-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x6 || [[#BdAddress|BdAddress]]
|-
| 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]]
|-
| 0x9 || 0x20 || [[#BdName|BdName]]
|}


= DevicePropertyList =
= DevicePropertyList =
This is "nn::btm::DevicePropertyList". This is a 0x268-byte struct.
This is "nn::btm::DevicePropertyList". This is a 0x268-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x1 || DeviceCount
|-
| 0x1 || 0x29 * 15 || Array of [[#DeviceProperty|DeviceProperty]]
|}


= ZeroRetransmissionList =
= ZeroRetransmissionList =
This is "nn::btm::ZeroRetransmissionList". This is a 0x11-byte struct.
This is "nn::btm::ZeroRetransmissionList". This is a 0x11-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x1 || EnabledReportIdCount
|-
| 0x1 || 0x1 * 16 || Array of EnabledReportId
|}


= GattService =
= GattService =