Difference between revisions of "BTM services"
(41 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
This has max_sessions 6. IPC is handled by 2 threads shared with all services. | This has max_sessions 6. IPC is handled by 2 threads shared with all services. | ||
− | + | With BLE connections, the remote device may receive ATT_READ_BY_GROUP_TYPE_REQ before the BLE connection-complete HCI event. One workaround for this is manually sending the response with HCI, after the connection is ready. | |
The output bool from all of these btm* service get-event cmds indicates whether the Event was successfully returned, user-processes will Abort when this is 0. | The output bool from all of these btm* service get-event cmds indicates whether the Event was successfully returned, user-processes will Abort when this is 0. | ||
Line 26: | Line 26: | ||
| 5 || [[#SetSlotMode]] | | 5 || [[#SetSlotMode]] | ||
|- | |- | ||
− | | 6 || [1.0.0-8.1. | + | | 6 || [1.0.0-8.1.1] [[#SetBluetoothMode]] |
|- | |- | ||
| 7 || [[#SetWlanMode]] | | 7 || [[#SetWlanMode]] | ||
Line 40: | Line 40: | ||
| 12 || [[#IncreaseDeviceInfoOrder]] | | 12 || [[#IncreaseDeviceInfoOrder]] | ||
|- | |- | ||
− | | 13 || [[#LlrNotify]] | + | | 13 || [9.0.0+] TriggerConnection ([1.0.0-8.1.1] [[#LlrNotify]]) |
|- | |- | ||
| 14 || [[#EnableRadio]] | | 14 || [[#EnableRadio]] | ||
Line 52: | Line 52: | ||
| 18 || [2.0.0+] [[#AcquireAwakeReqEvent]] | | 18 || [2.0.0+] [[#AcquireAwakeReqEvent]] | ||
|- | |- | ||
− | | 19 || [4.0.0 | + | | 19 || [9.0.0+] AcquireConnectionTriggerEvent ([4.0.0-8.1.1] [[#AcquireLlrStateEvent]]) |
|- | |- | ||
− | | 20 || [4.0.0 | + | | 20 || [9.0.0+] IsConnectionTriggered ([4.0.0-8.1.1] [[#IsLlrStarted]]) |
|- | |- | ||
| 21 || [4.0.0+] [[#EnableSlotSaving]] | | 21 || [4.0.0+] [[#EnableSlotSaving]] | ||
Line 134: | Line 134: | ||
| 59 ([5.0.0-5.0.2] 42) || [5.0.0+] [[#SetAppletResourceUserId]] | | 59 ([5.0.0-5.0.2] 42) || [5.0.0+] [[#SetAppletResourceUserId]] | ||
|- | |- | ||
− | | 60 || [8.0.0+] | + | | 60 || [8.0.0+] [[#AcquireBleConnectionParameterUpdateEvent]] |
|- | |- | ||
− | | 61 || [8.0.0+] | + | | 61 || [8.0.0+] [[#SetCeLength]] |
|- | |- | ||
− | | 62 || [9.0.0+] | + | | 62 || [9.0.0+] [[#EnsureSlotExpansion]] |
|- | |- | ||
− | | 63 || [9.0.0+] | + | | 63 || [9.0.0+] [[#IsSlotExpansionEnsured]] |
|- | |- | ||
− | | 64 || [10.0.0+] | + | | 64 || [10.0.0+] [[#CancelConnectionTrigger]] |
+ | |- | ||
+ | | 65 || [13.0.0+] GetConnectionCapacity | ||
+ | |- | ||
+ | | 66 || [13.0.0+] GetWlanMode | ||
+ | |- | ||
+ | | 67 || [13.0.0+] IsSlotSavingEnabled | ||
+ | |- | ||
+ | | 68 || [13.0.0+] IsSlotSavingForPairingEnabled | ||
+ | |- | ||
+ | | 69 || [13.0.0+] AcquireAudioDeviceConnectionEvent | ||
+ | |- | ||
+ | | 70 || [13.0.0+] GetConnectedAudioDevices | ||
+ | |- | ||
+ | | 71 || [13.0.0+] SetAudioSourceVolume | ||
+ | |- | ||
+ | | 72 || [13.0.0+] GetAudioSourceVolume | ||
+ | |- | ||
+ | | 73 || [13.0.0+] RequestAudioDeviceConnectionRejection | ||
+ | |- | ||
+ | | 74 || [13.0.0+] CancelAudioDeviceConnectionRejection | ||
+ | |- | ||
+ | | 75 || [13.0.0+] GetPairedAudioDevices | ||
+ | |- | ||
+ | | 76 || [13.1.0+] SetWlanModeWithOption | ||
+ | |- | ||
+ | | 100 || [13.0.0+] AcquireConnectionDisallowedEvent | ||
+ | |- | ||
+ | | 101 || [13.0.0+] GetUsecaseViolationFactor | ||
+ | |- | ||
+ | | 110 || [13.0.0+] GetShortenedDeviceInfo | ||
+ | |- | ||
+ | | 111 || [13.0.0+] AcquirePairingCountUpdateEvent | ||
+ | |- | ||
+ | | 112 || [14.0.0-14.1.2] | ||
+ | |- | ||
+ | | 113 || [14.0.0-14.1.2] | ||
+ | |- | ||
+ | | 114 || [14.0.0+] IsFirstAudioControlConnection | ||
+ | |- | ||
+ | | 115 || [14.0.0+] GetShortenedDeviceCondition | ||
+ | |- | ||
+ | | 116 || [15.0.0+] SetAudioSinkVolume | ||
+ | |- | ||
+ | | 117 || [15.0.0+] GetAudioSinkVolume | ||
|} | |} | ||
== GetState == | == GetState == | ||
− | No input | + | No input. Returns an output [[#BtmState]]. |
== GetHostDeviceProperty == | == GetHostDeviceProperty == | ||
− | No input | + | No input. Returns an output [[#HostDeviceProperty]]. |
+ | |||
+ | [13.0.0+] Takes a type-0x1A output buffer containing a [[#HostDeviceProperty]]. No output. | ||
+ | |||
+ | This gets the previously initialized [[#HostDeviceProperty]]. | ||
== AcquireDeviceConditionEvent == | == AcquireDeviceConditionEvent == | ||
− | No input | + | No input. Returns an output Event handle with EventClearMode=1. |
[3.0.0+] Now returns an additional output bool. | [3.0.0+] Now returns an additional output bool. | ||
== GetDeviceCondition == | == GetDeviceCondition == | ||
− | Takes a type-0x1A output buffer containing a | + | Takes a type-0x1A output buffer containing a [[#DeviceConditionList]]. No output. |
+ | |||
+ | [13.0.0+] Takes an input u32 [[#Profile]], a type-0xA output buffer containing an array of [[#DeviceCondition]], returns a s32 for total output entries. When [[#Profile]] is non-zero, entries are only returned with a matching [[#Profile]]. | ||
== SetBurstMode == | == SetBurstMode == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]] and a bool. No output. |
== SetSlotMode == | == SetSlotMode == | ||
− | Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], | + | 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. | ||
+ | ** {...} | ||
+ | |||
+ | Note that the above func is also called from various other funcs as well. An [[Bluetooth_Driver_services#HidEventType|event]] for opening a hid connection also triggers it in some cases. | ||
+ | |||
+ | 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 == | ||
− | Takes an input [[#BluetoothMode]] | + | Takes an input [[#BluetoothMode]]. No output. |
== SetWlanMode == | == SetWlanMode == | ||
− | Takes an input [[#WlanMode]] | + | Takes an input [[#WlanMode]]. No output. |
== AcquireDeviceInfoEvent == | == AcquireDeviceInfoEvent == | ||
− | No input | + | No input. Returns an output Event handle with EventClearMode=1. |
[3.0.0+] Now returns an additional output bool. | [3.0.0+] Now returns an additional output bool. | ||
== GetDeviceInfo == | == GetDeviceInfo == | ||
− | Takes a type-0x1A output buffer containing a [[#DeviceInfoList]]. | + | Takes a type-0x1A output buffer containing a [[#DeviceInfoList]]. No output. |
+ | |||
+ | [13.0.0+] Takes an input u32 [[#Profile]], a type-0xA output buffer containing an array of [[#DeviceInfo]], returns a s32 for total output entries. When [[#Profile]] is non-zero, entries are only returned with a matching [[#Profile]]. | ||
== AddDeviceInfo == | == AddDeviceInfo == | ||
− | Takes an input [[#DeviceInfo]], no output. | + | Takes an input [[#DeviceInfo]]. No output. |
+ | |||
+ | [13.0.0+] Takes a type-0x19 input buffer containing a [[#DeviceInfo]], no output. | ||
== RemoveDeviceInfo == | == RemoveDeviceInfo == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]]. No output. |
== IncreaseDeviceInfoOrder == | == IncreaseDeviceInfoOrder == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]]. No output. |
== LlrNotify == | == LlrNotify == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]]. No output. |
− | [9.0.0+] Takes an input [[ | + | [9.0.0+] Takes an input [[#BdAddress|BdAddress]] and a s32, no output. |
== EnableRadio == | == EnableRadio == | ||
Line 200: | Line 276: | ||
== HidDisconnect == | == HidDisconnect == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]]. No output. |
== HidSetRetransmissionMode == | == HidSetRetransmissionMode == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]] and a type-0x19 input buffer containing a [[#ZeroRetransmissionList]]. No output. |
== AcquireAwakeReqEvent == | == AcquireAwakeReqEvent == | ||
− | No input | + | No input. Returns an output Event handle with EventClearMode=1. |
[3.0.0+] Now returns an additional output bool. | [3.0.0+] Now returns an additional output bool. | ||
== AcquireLlrStateEvent == | == AcquireLlrStateEvent == | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
== IsLlrStarted == | == IsLlrStarted == | ||
− | No input | + | No input. Returns an output bool. |
== EnableSlotSaving == | == EnableSlotSaving == | ||
− | Takes an input bool | + | Takes an input bool. No output. |
== ProtectDeviceInfo == | == ProtectDeviceInfo == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]] and a bool. No output. |
== AcquireBleScanEvent == | == AcquireBleScanEvent == | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
== GetBleScanParameterGeneral == | == GetBleScanParameterGeneral == | ||
− | Takes an input u16 | + | Takes an input u16 ParameterId. Returns a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]]. |
The u16 must be value 0x1 or 0xFFFF. | The u16 must be value 0x1 or 0xFFFF. | ||
+ | |||
+ | [[HID_services|hid]] uses value 0x1 for Palma. | ||
+ | |||
+ | The output BleAdvertisePacketParameter starting at +0x2 contains (CompanyId is 0x0553 for Nintendo for both of these): | ||
+ | * ParameterId 0x1: <code>000100000100</code> | ||
+ | * ParameterId 0xFFFF: <code>ADDE00EFBE00</code> | ||
== GetBleScanParameterSmartDevice == | == GetBleScanParameterSmartDevice == | ||
− | Takes an input u16 | + | Takes an input u16 ParameterId. Returns a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. |
The u16 must be value 0x2. The first 4-bytes of output is always 0 since it's not set. | The u16 must be value 0x2. The first 4-bytes of output is always 0 since it's not set. | ||
== StartBleScanForGeneral == | == StartBleScanForGeneral == | ||
− | Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], | + | Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]]. No output. |
+ | |||
+ | This eventually uses [[Bluetooth_Driver_services#AddBleScanFilterCondition|AddBleScanFilterCondition]], where the the passed BleAdvertiseFilter is generated from the input BleAdvertisePacketParameter. | ||
+ | |||
+ | This also uses [[Bluetooth_Driver_services#SetBleScanParameter|SetBleScanParameter]]. | ||
== StopBleScanForGeneral == | == StopBleScanForGeneral == | ||
Line 242: | Line 328: | ||
== GetBleScanResultsForGeneral == | == GetBleScanResultsForGeneral == | ||
− | Takes a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]] | + | Takes a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]]. Returns an output u8 total_out. |
The max array entries is 10. | The max array entries is 10. | ||
== StartBleScanForPaired == | == StartBleScanForPaired == | ||
− | Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], | + | Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]]. No output. |
+ | |||
+ | This eventually uses [[Bluetooth_Driver_services#AddBleScanFilterCondition|AddBleScanFilterCondition]], where the the passed BleAdvertiseFilter is generated from the input BleAdvertisePacketParameter. | ||
+ | |||
+ | This also uses [[Bluetooth_Driver_services#SetBleScanParameter|SetBleScanParameter]]. | ||
== StopBleScanForPaired == | == StopBleScanForPaired == | ||
Line 253: | Line 343: | ||
== StartBleScanForSmartDevice == | == StartBleScanForSmartDevice == | ||
− | Takes a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], | + | Takes a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. No output. |
+ | |||
+ | This eventually uses [[Bluetooth_Driver_services#AddBleScanFilterCondition|AddBleScanFilterCondition]], where the the passed BleAdvertiseFilter is generated from the input GattAttributeUuid. | ||
+ | |||
+ | This also uses [[Bluetooth_Driver_services#SetBleScanParameter|SetBleScanParameter]]. | ||
+ | |||
+ | The [[Bluetooth_Driver_services#BleAdvertiseFilter|BleAdvertiseFilter]] is generated as follows: CondType = 7(ServiceUuid128), CondDataSize = 0x11. CondData: {128bit UUID copied from the [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] (size field ignored), then an u8 with value 0x0 (unused)}. MaskSize = 0x10, Mask = {all 0xFF}. | ||
== StopBleScanForSmartDevice == | == StopBleScanForSmartDevice == | ||
Line 259: | Line 355: | ||
== GetBleScanResultsForSmartDevice == | == GetBleScanResultsForSmartDevice == | ||
− | Takes a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]] | + | Takes a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]]. Returns an output u8 total_out. |
The max array entries is 10. | The max array entries is 10. | ||
== AcquireBleConnectionEvent == | == AcquireBleConnectionEvent == | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
== BleConnect == | == BleConnect == | ||
− | Takes an input [[ | + | Takes an input [[#BdAddress|BdAddress]]. No output. |
− | An error is thrown if the [[ | + | 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 == | ||
− | Takes an input u32 | + | Takes an input u32 ConnectionHandle. No output. |
The u32 is the same as the param for [[#BleDisconnect]]. | The u32 is the same as the param for [[#BleDisconnect]]. | ||
== BleDisconnect == | == BleDisconnect == | ||
− | Takes an input u32 | + | Takes an input u32 ConnectionHandle. No output. |
− | The u32 must match | + | The u32 must match a ConnectionHandle in a [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] from [[#BleGetConnectionState]]. [5.1.0+] 0xFFFFFFFF is invalid. |
== BleGetConnectionState == | == BleGetConnectionState == | ||
− | Takes a type-0xA output buffer containing an array of [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] | + | Takes a type-0xA output buffer containing an array of [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]]. Returns an output u8 total_out. |
Other cmds which use this internally use arraycount=4. | Other cmds which use this internally use arraycount=4. | ||
Line 290: | Line 386: | ||
== AcquireBlePairingEvent == | == AcquireBlePairingEvent == | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
== BlePairDevice == | == BlePairDevice == | ||
− | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32 | + | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an input u32 ConnectionHandle. No output. |
The u32 is the same as the param for [[#BleDisconnect]]. | The u32 is the same as the param for [[#BleDisconnect]]. | ||
== BleUnpairDeviceOnBoth == | == BleUnpairDeviceOnBoth == | ||
− | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] | + | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] an input u32 ConnectionHandle. No output. |
The u32 is the same as the param for [[#BleDisconnect]]. | The u32 is the same as the param for [[#BleDisconnect]]. | ||
== BleUnpairDevice == | == BleUnpairDevice == | ||
− | Takes an input [[ | + | 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 [[ | + | 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. | ||
== AcquireBleServiceDiscoveryEvent == | == AcquireBleServiceDiscoveryEvent == | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
== GetGattServices == | == GetGattServices == | ||
− | Takes a type-0x6 output buffer containing an array of [[#GattService]] | + | Takes a type-0x6 output buffer containing an array of [[#GattService]] and an input u32 ConnectionHandle. Returns an output u8 total_out. |
The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | ||
== GetGattService == | == GetGattService == | ||
− | Takes a type-0x1A output buffer containing a [[#GattService]], an u32 | + | Takes a type-0x1A output buffer containing a [[#GattService]], an input u32 ConnectionHandle and a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. Returns an output bool. |
The u32 is the same as the param for [[#BleDisconnect]]. The output bool indicates whether a [[#GattService]] was returned. | The u32 is the same as the param for [[#BleDisconnect]]. The output bool indicates whether a [[#GattService]] was returned. | ||
Line 326: | Line 422: | ||
== GetGattIncludedServices == | == GetGattIncludedServices == | ||
− | Takes a type-0x6 output buffer containing an array of [[#GattService]], an u16 | + | Takes a type-0x6 output buffer containing an array of [[#GattService]], an u16 ServiceHandle and an input u32 ConnectionHandle. Returns an output u8. |
The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | ||
Line 335: | Line 431: | ||
== GetBelongingService == | == GetBelongingService == | ||
− | Takes a type-0x1A output buffer containing a [[#GattService]], an u16 | + | Takes a type-0x1A output buffer containing a [[#GattService]], an u16 AttributeHandle and an input u32 ConnectionHandle. Returns an output bool. |
The u32 is the same as the param for [[#BleDisconnect]]. The output bool indicates whether a [[#GattService]] was returned. | The u32 is the same as the param for [[#BleDisconnect]]. The output bool indicates whether a [[#GattService]] was returned. | ||
Line 342: | Line 438: | ||
== GetGattCharacteristics == | == GetGattCharacteristics == | ||
− | Takes a type-0x6 output buffer containing an array of [[#GattCharacteristic]], an u16 | + | Takes a type-0x6 output buffer containing an array of [[#GattCharacteristic]], an u16 ServiceHandle and an input u32 ConnectionHandle. Returns an output u8 total_out. |
The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | ||
Line 349: | Line 445: | ||
== GetGattDescriptors == | == GetGattDescriptors == | ||
− | Takes a type-0x6 output buffer containing an array of [[#GattDescriptor]], an u16 | + | Takes a type-0x6 output buffer containing an array of [[#GattDescriptor]], an u16 CharHandle and an input u32 ConnectionHandle. Returns an output u8 total_out. |
The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | The u32 is the same as the param for [[#BleDisconnect]]. The max array entries is 100. | ||
Line 356: | Line 452: | ||
== AcquireBleMtuConfigEvent == | == AcquireBleMtuConfigEvent == | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
== ConfigureBleMtu == | == ConfigureBleMtu == | ||
− | Takes an u16 | + | Takes an u16 mtu and an input u32 ConnectionHandle. No output. |
The u32 is the same as the param for [[#BleDisconnect]]. | The u32 is the same as the param for [[#BleDisconnect]]. | ||
== GetBleMtu == | == GetBleMtu == | ||
− | Takes an u32 | + | Takes an input u32 ConnectionHandle. Returns an output u16 mtu. |
The u32 is the same as the param for [[#BleDisconnect]]. | The u32 is the same as the param for [[#BleDisconnect]]. | ||
== RegisterBleGattDataPath == | == RegisterBleGattDataPath == | ||
− | Takes a [[#BleDataPath]] | + | Takes a [[#BleDataPath]]. No output. |
== UnregisterBleGattDataPath == | == UnregisterBleGattDataPath == | ||
− | Takes a [[#BleDataPath]] | + | Takes a [[#BleDataPath]]. No output. |
== RegisterAppletResourceUserId == | == RegisterAppletResourceUserId == | ||
− | Takes an input u32 and an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes an input u32 and an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
== UnregisterAppletResourceUserId == | == UnregisterAppletResourceUserId == | ||
− | Takes an input [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes an input [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
== SetAppletResourceUserId == | == SetAppletResourceUserId == | ||
− | Takes an input [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes an input [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
− | == | + | == AcquireBleConnectionParameterUpdateEvent == |
− | No input | + | No input. Returns an output Event handle with EventClearMode=1. |
− | == | + | == SetCeLength == |
− | Takes | + | Takes an input [[#DeviceCeLengthList|DeviceCeLengthList]]. No output. |
− | + | 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]]. | |
− | == | + | == EnsureSlotExpansion == |
− | No | + | Takes an input bool. No output. |
− | == | + | Sends a request which is handled as follows: writes the flag into state if needed. |
+ | |||
+ | == IsSlotExpansionEnsured == | ||
+ | No input. Returns an output bool. | ||
+ | |||
+ | This gets the flag used by [[#EnsureSlotExpansion]]. | ||
+ | |||
+ | == CancelConnectionTrigger == | ||
No input/output. | No input/output. | ||
+ | |||
+ | Sends a request which is handled as follows: if a state field is set, another state field is set to value 1. | ||
= btm:dbg = | = btm:dbg = | ||
Line 407: | Line 512: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
− | | 0 || AcquireDiscoveryEvent | + | | 0 || [[#AcquireDiscoveryEvent]] |
+ | |- | ||
+ | | 1 || [[#StartDiscovery]] | ||
+ | |- | ||
+ | | 2 || [[#CancelDiscovery]] | ||
+ | |- | ||
+ | | 3 || [12.0.0+] IsDiscoveryEnabled ([1.0.0-11.0.1] [[#GetDeviceProperty]]) | ||
+ | |- | ||
+ | | 4 || [[#CreateBond]] | ||
+ | |- | ||
+ | | 5 || [[#CancelBond]] | ||
|- | |- | ||
− | | | + | | 6 || [[#SetTsiMode]] |
|- | |- | ||
− | | | + | | 7 || [[#GeneralTest]] |
|- | |- | ||
− | | | + | | 8 || [[#HidConnect]] |
|- | |- | ||
− | | | + | | 9 || [5.0.0+] [[#GeneralGet]] |
|- | |- | ||
− | | | + | | 10 || [5.1.0+] [[#GetGattClientDisconnectionReason]] |
|- | |- | ||
− | | | + | | 11 || [5.1.0+] [[#GetBleConnectionParameter]] |
|- | |- | ||
− | | | + | | 12 || [5.1.0+] [[#GetBleConnectionParameterRequest]] |
|- | |- | ||
− | | | + | | 13 || [12.0.0+] GetDiscoveredDevice |
|- | |- | ||
− | | | + | | 14 || [15.0.0+] SleepAwakeLoopTest |
|- | |- | ||
− | | | + | | 15 || [15.0.0+] SleepTest |
|- | |- | ||
− | | | + | | 16 || [15.0.0+] MinimumAwakeTest |
|- | |- | ||
− | | | + | | 17 || [15.0.0+] ForceEnableBtm |
|} | |} | ||
− | [3.0.0+] | + | == AcquireDiscoveryEvent == |
+ | No input. Returns output an Event handle with EventClearMode=1. | ||
+ | |||
+ | [3.0.0+] Now returns an additional output bool. | ||
+ | |||
+ | == StartDiscovery == | ||
+ | No input/output. | ||
+ | |||
+ | == CancelDiscovery == | ||
+ | No input/output. | ||
+ | |||
+ | == GetDeviceProperty == | ||
+ | Takes a type-0x1A output buffer containing a [[#DevicePropertyList]]. No output. | ||
+ | |||
+ | == CreateBond == | ||
+ | Takes an input [[#BdAddress|BdAddress]]. No output. | ||
+ | |||
+ | [13.0.0+] Now takes a type-0xA output buffer, returns a total of 4-bytes of output. | ||
+ | |||
+ | == CancelBond == | ||
+ | Takes an input [[#BdAddress|BdAddress]]. No output. | ||
+ | |||
+ | == SetTsiMode == | ||
+ | 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. | ||
+ | |||
+ | == GeneralTest == | ||
+ | Takes an input s32. No output. | ||
+ | |||
+ | == HidConnect == | ||
+ | Takes an input [[#BdAddress|BdAddress]]. No output. | ||
+ | |||
+ | == GeneralGet == | ||
+ | Takes an input u32 and a type-0x1A output buffer containing a 0x11-byte struct. No output. | ||
+ | |||
+ | == GetGattClientDisconnectionReason == | ||
+ | Takes an input [[#BdAddress|BdAddress]] and an u32. Returns an output bool and u16. | ||
+ | |||
+ | The bool indicates whether the cmd is successful. | ||
+ | |||
+ | == GetBleConnectionParameter == | ||
+ | Takes an input u32. Returns an output bool and 3 u16s. | ||
+ | |||
+ | The bool indicates whether the cmd is successful, the output u16s are only set when this bool is set. | ||
+ | |||
+ | == GetBleConnectionParameterRequest == | ||
+ | Takes an input u32. Returns an output bool and 4 u16s. | ||
+ | |||
+ | The bool indicates whether the cmd is successful, the output u16s are only set when this bool is set. | ||
= btm:sys = | = btm:sys = | ||
Line 449: | Line 613: | ||
== GetCore == | == GetCore == | ||
− | No input | + | No input. Returns an output [[#IBtmSystemCore]]. |
== IBtmSystemCore == | == IBtmSystemCore == | ||
Line 470: | Line 634: | ||
| 5 || [[#DisableRadio]] | | 5 || [[#DisableRadio]] | ||
|- | |- | ||
− | | 6 || [[# | + | | 6 || [[#IsRadioEnabled]] |
|- | |- | ||
| 7 || [3.0.0+] [[#AcquireRadioEvent]] | | 7 || [3.0.0+] [[#AcquireRadioEvent]] | ||
Line 477: | Line 641: | ||
|- | |- | ||
| 9 || [3.0.0+] [[#IsGamepadPairingStarted]] | | 9 || [3.0.0+] [[#IsGamepadPairingStarted]] | ||
+ | |- | ||
+ | | 10 || [13.0.0+] StartAudioDeviceDiscovery | ||
+ | |- | ||
+ | | 11 || [13.0.0+] StopAudioDeviceDiscovery | ||
+ | |- | ||
+ | | 12 || [13.0.0+] IsDiscoveryingAudioDevice | ||
+ | |- | ||
+ | | 13 || [13.0.0+] GetDiscoveredAudioDevice | ||
+ | |- | ||
+ | | 14 || [13.0.0+] AcquireAudioDeviceConnectionEvent | ||
+ | |- | ||
+ | | 15 || [13.0.0+] ConnectAudioDevice | ||
+ | |- | ||
+ | | 16 || [13.0.0+] IsConnectingAudioDevice | ||
+ | |- | ||
+ | | 17 || [13.0.0+] GetConnectedAudioDevices | ||
+ | |- | ||
+ | | 18 || [13.0.0+] DisconnectAudioDevice | ||
+ | |- | ||
+ | | 19 || [13.0.0+] AcquirePairedAudioDeviceInfoChangedEvent | ||
+ | |- | ||
+ | | 20 || [13.0.0+] GetPairedAudioDevices | ||
+ | |- | ||
+ | | 21 || [13.0.0+] RemoveAudioDevicePairing | ||
+ | |- | ||
+ | | 22 || [13.0.0+] RequestAudioDeviceConnectionRejection | ||
+ | |- | ||
+ | | 23 || [13.0.0+] CancelAudioDeviceConnectionRejection | ||
|} | |} | ||
Line 489: | Line 681: | ||
=== GetPairedGamepadCount === | === GetPairedGamepadCount === | ||
− | No input | + | No input. Returns an output u8. |
=== EnableRadio === | === EnableRadio === | ||
Line 497: | Line 689: | ||
No input/output. | No input/output. | ||
− | === | + | === IsRadioEnabled === |
− | No input | + | No input. Returns an output bool. |
=== AcquireRadioEvent === | === AcquireRadioEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
=== AcquireGamepadPairingEvent === | === AcquireGamepadPairingEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
=== IsGamepadPairingStarted === | === IsGamepadPairingStarted === | ||
− | No input | + | No input. Returns an output bool. |
= btm:u = | = btm:u = | ||
Line 524: | Line 716: | ||
== GetCore == | == GetCore == | ||
− | No input | + | No input. Returns an output [[#IBtmUserCore]]. |
== IBtmUserCore == | == IBtmUserCore == | ||
Line 535: | Line 727: | ||
| 0 || [[#AcquireBleScanEvent_2|AcquireBleScanEvent]] | | 0 || [[#AcquireBleScanEvent_2|AcquireBleScanEvent]] | ||
|- | |- | ||
− | | 1 || [[#GetBleScanFilterParameter]] | + | | 1 || [[#GetBleScanFilterParameter|GetBleScanFilterParameter]] |
|- | |- | ||
− | | 2 || [[#GetBleScanFilterParameter2]] | + | | 2 || [[#GetBleScanFilterParameter2|GetBleScanFilterParameter2]] |
|- | |- | ||
| 3 || [[#StartBleScanForGeneral_2|StartBleScanForGeneral]] | | 3 || [[#StartBleScanForGeneral_2|StartBleScanForGeneral]] | ||
Line 569: | Line 761: | ||
| 23 || [[#BleUnPairDevice_2|BleUnPairDevice]] | | 23 || [[#BleUnPairDevice_2|BleUnPairDevice]] | ||
|- | |- | ||
− | | 24 || [[#BleUnPairDevice2]] | + | | 24 || [[#BleUnPairDevice2|BleUnPairDevice2]] |
|- | |- | ||
− | | 25 || [[#BleGetPairedDevices]] | + | | 25 || [[#BleGetPairedDevices|BleGetPairedDevices]] |
|- | |- | ||
| 26 || [[#AcquireBleServiceDiscoveryEvent_2|AcquireBleServiceDiscoveryEvent]] | | 26 || [[#AcquireBleServiceDiscoveryEvent_2|AcquireBleServiceDiscoveryEvent]] | ||
Line 581: | Line 773: | ||
| 29 || [[#GetGattIncludedServices_2|GetGattIncludedServices]] | | 29 || [[#GetGattIncludedServices_2|GetGattIncludedServices]] | ||
|- | |- | ||
− | | 30 || [[#GetBelongingGattService]] | + | | 30 || [[#GetBelongingGattService|GetBelongingGattService]] |
|- | |- | ||
| 31 || [[#GetGattCharacteristics_2|GetGattCharacteristics]] | | 31 || [[#GetGattCharacteristics_2|GetGattCharacteristics]] | ||
Line 599: | Line 791: | ||
=== AcquireBleScanEvent === | === AcquireBleScanEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
This is similar to the [[#AcquireBleScanEvent|btm]] cmd. | This is similar to the [[#AcquireBleScanEvent|btm]] cmd. | ||
=== GetBleScanFilterParameter === | === GetBleScanFilterParameter === | ||
− | Takes an input u16 | + | Takes an input u16. Returns a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]]. |
This is the same as [[#GetBleScanParameterGeneral]]. | This is the same as [[#GetBleScanParameterGeneral]]. | ||
=== GetBleScanFilterParameter2 === | === GetBleScanFilterParameter2 === | ||
− | Takes an input u16 | + | Takes an input u16. Returns a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. |
This is the same as [[#GetBleScanParameterSmartDevice]]. | This is the same as [[#GetBleScanParameterSmartDevice]]. | ||
=== StartBleScanForGeneral === | === StartBleScanForGeneral === | ||
− | Takes a PID, a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
This is similar to the [[#StartBleScanForGeneral|btm]] cmd. | This is similar to the [[#StartBleScanForGeneral|btm]] cmd. | ||
Line 624: | Line 816: | ||
=== GetBleScanResultsForGeneral === | === GetBleScanResultsForGeneral === | ||
− | Takes a PID, a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8 total_out. |
This is similar to the [[#GetBleScanResultsForGeneral|btm]] cmd. | This is similar to the [[#GetBleScanResultsForGeneral|btm]] cmd. | ||
=== StartBleScanForPaired === | === StartBleScanForPaired === | ||
− | Takes a PID, a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
This is similar to the [[#StartBleScanForPaired|btm]] cmd. | This is similar to the [[#StartBleScanForPaired|btm]] cmd. | ||
Line 639: | Line 831: | ||
=== StartBleScanForSmartDevice === | === StartBleScanForSmartDevice === | ||
− | Takes a PID, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
This is similar to the [[#StartBleScanForSmartDevice|btm]] cmd. | This is similar to the [[#StartBleScanForSmartDevice|btm]] cmd. | ||
Line 649: | Line 841: | ||
=== GetBleScanResultsForSmartDevice === | === GetBleScanResultsForSmartDevice === | ||
− | Takes a PID, a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x6 output buffer containing an array of [[Bluetooth_Driver_services#BleScanResult|BleScanResult]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8 total_out. |
This is similar to the [[#GetBleScanResultsForSmartDevice|btm]] cmd. | This is similar to the [[#GetBleScanResultsForSmartDevice|btm]] cmd. | ||
=== AcquireBleConnectionEvent === | === AcquireBleConnectionEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
This is similar to the [[#AcquireBleConnectionEvent|btm]] cmd. | This is similar to the [[#AcquireBleConnectionEvent|btm]] cmd. | ||
=== BleConnect === | === BleConnect === | ||
− | Takes a PID, an [[ | + | 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. | ||
=== BleDisconnect === | === BleDisconnect === | ||
− | Takes an input u32 | + | Takes an input u32. No output. |
This is similar to the [[#BleDisconnect|btm]] cmd. | This is similar to the [[#BleDisconnect|btm]] cmd. | ||
=== BleGetConnectionState === | === BleGetConnectionState === | ||
− | Takes a PID, a type-0xA output buffer containing an array of [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0xA output buffer containing an array of [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8 total_out. |
This is similar to the [[#BleGetConnectionState|btm]] cmd. | This is similar to the [[#BleGetConnectionState|btm]] cmd. | ||
=== AcquireBlePairingEvent === | === AcquireBlePairingEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
This is similar to the [[#AcquireBlePairingEvent|btm]] cmd. | This is similar to the [[#AcquireBlePairingEvent|btm]] cmd. | ||
=== BlePairDevice === | === BlePairDevice === | ||
− | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32 | + | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32. No output. |
This is similar to the [[#BlePairDevice|btm]] cmd. | This is similar to the [[#BlePairDevice|btm]] cmd. | ||
=== BleUnPairDevice === | === BleUnPairDevice === | ||
− | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32 | + | Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32. No output. |
This is similar to the [[#BleUnpairDeviceOnBoth|btm]] cmd. | This is similar to the [[#BleUnpairDeviceOnBoth|btm]] cmd. | ||
=== BleUnPairDevice2 === | === BleUnPairDevice2 === | ||
− | Takes an input [[ | + | 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 [[ | + | 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. | ||
=== AcquireBleServiceDiscoveryEvent === | === AcquireBleServiceDiscoveryEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
This is similar to the [[#AcquireBleServiceDiscoveryEvent|btm]] cmd. | This is similar to the [[#AcquireBleServiceDiscoveryEvent|btm]] cmd. | ||
Line 706: | Line 898: | ||
=== GetGattServices === | === GetGattServices === | ||
− | Takes a PID, a type-0x6 output buffer containing an array of [[#GattService]], an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x6 output buffer containing an array of [[#GattService]], an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8 total_out. |
This is similar to the [[#GetGattServices|btm]] cmd. | This is similar to the [[#GetGattServices|btm]] cmd. | ||
=== GetGattService === | === GetGattService === | ||
− | Takes a PID, a type-0x1A output buffer containing a [[#GattService]], an u32, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x1A output buffer containing a [[#GattService]], an u32, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output bool. |
This is similar to the [[#GetGattService|btm]] cmd. | This is similar to the [[#GetGattService|btm]] cmd. | ||
=== GetGattIncludedServices === | === GetGattIncludedServices === | ||
− | Takes a PID, a type-0x6 output buffer containing an array of [[#GattService]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x6 output buffer containing an array of [[#GattService]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8. |
This is similar to the [[#GetGattIncludedServices|btm]] cmd. | This is similar to the [[#GetGattIncludedServices|btm]] cmd. | ||
Line 723: | Line 915: | ||
=== GetBelongingGattService === | === GetBelongingGattService === | ||
− | Takes a PID, a type-0x1A output buffer containing a [[#GattService]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x1A output buffer containing a [[#GattService]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output bool. |
This is similar to the [[#GetBelongingService|btm]] cmd. | This is similar to the [[#GetBelongingService|btm]] cmd. | ||
=== GetGattCharacteristics === | === GetGattCharacteristics === | ||
− | Takes a PID, a type-0x6 output buffer containing an array of [[#GattCharacteristic]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x6 output buffer containing an array of [[#GattCharacteristic]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8 total_out. |
This is similar to the [[#GetGattCharacteristics|btm]] cmd. | This is similar to the [[#GetGattCharacteristics|btm]] cmd. | ||
=== GetGattDescriptors === | === GetGattDescriptors === | ||
− | Takes a PID, a type-0x6 output buffer containing an array of [[#GattDescriptor]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a type-0x6 output buffer containing an array of [[#GattDescriptor]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u8 total_out. |
This is similar to the [[#GetGattDescriptors|btm]] cmd. | This is similar to the [[#GetGattDescriptors|btm]] cmd. | ||
=== AcquireBleMtuConfigEvent === | === AcquireBleMtuConfigEvent === | ||
− | No input | + | No input. Returns an output bool and an Event handle with EventClearMode=1. |
This is similar to the [[#AcquireBleMtuConfigEvent|btm]] cmd. | This is similar to the [[#AcquireBleMtuConfigEvent|btm]] cmd. | ||
=== ConfigureBleMtu === | === ConfigureBleMtu === | ||
− | Takes a PID, an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
This is similar to the [[#ConfigureBleMtu|btm]] cmd. | This is similar to the [[#ConfigureBleMtu|btm]] cmd. | ||
Line 750: | Line 942: | ||
=== GetBleMtu === | === GetBleMtu === | ||
− | Takes a PID, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u16. |
This is similar to the [[#GetBleMtu|btm]] cmd. | This is similar to the [[#GetBleMtu|btm]] cmd. | ||
=== RegisterBleGattDataPath === | === RegisterBleGattDataPath === | ||
− | Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
This is similar to the [[#RegisterBleGattDataPath|btm]] cmd. | This is similar to the [[#RegisterBleGattDataPath|btm]] cmd. | ||
=== UnregisterBleGattDataPath === | === UnregisterBleGattDataPath === | ||
− | Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] | + | Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. No output. |
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 "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 "nn::btm::BluetoothMode". |
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value || Description | ||
+ | |- | ||
+ | | 0 || Dynamic2Slot | ||
+ | |- | ||
+ | | 1 || StaticJoy | ||
+ | |} | ||
= WlanMode = | = WlanMode = | ||
− | This is "nn::btm::WlanMode". This is | + | This is "nn::btm::WlanMode". |
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value || Description | ||
+ | |- | ||
+ | | 0 || Local4 | ||
+ | |- | ||
+ | | 1 || Local8 | ||
+ | |- | ||
+ | | 2 || None | ||
+ | |} | ||
+ | |||
+ | = TsiMode = | ||
+ | This is "nn::btm::TsiMode". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value || Description | ||
+ | |- | ||
+ | | 0 || 0Fd3Td3Si10 | ||
+ | |- | ||
+ | | 1 || 1Fd1Td1Si5 | ||
+ | |- | ||
+ | | 2 || 2Fd1Td3Si10 | ||
+ | |- | ||
+ | | 3 || 3Fd1Td5Si15 | ||
+ | |- | ||
+ | | 4 || 4Fd3Td1Si10 | ||
+ | |- | ||
+ | | 5 || 5Fd3Td3Si15 | ||
+ | |- | ||
+ | | 6 || 6Fd5Td1Si15 | ||
+ | |- | ||
+ | | 7 || 7Fd1Td3Si15 | ||
+ | |- | ||
+ | | 8 || 8Fd3Td1Si15 | ||
+ | |- | ||
+ | | 9 || 9Fd1Td1Si10 | ||
+ | |- | ||
+ | | 10 || 10Fd1Td1Si15 | ||
+ | |- | ||
+ | | 255 || Active | ||
+ | |} | ||
+ | |||
+ | = SlotMode = | ||
+ | This is "nn::btm::SlotMode". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value || Description | ||
+ | |- | ||
+ | | 0 || 2 | ||
+ | |- | ||
+ | | 1 || 4 | ||
+ | |- | ||
+ | | 2 || 6 | ||
+ | |- | ||
+ | | 3 || Active | ||
+ | |} | ||
+ | |||
+ | = SniffMode = | ||
+ | This is "nn::btm::SniffMode". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value || Description | ||
+ | |- | ||
+ | | 0 || 5ms | ||
+ | |- | ||
+ | | 1 || 10ms | ||
+ | |- | ||
+ | | 2 || 15ms | ||
+ | |- | ||
+ | | 3 || Active | ||
+ | |} | ||
+ | |||
+ | = Profile = | ||
+ | This is "nn::btm::Profile". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value || Description | ||
+ | |- | ||
+ | | 0 || None | ||
+ | |- | ||
+ | | 1 || Hid | ||
+ | |- | ||
+ | | 2 || [13.0.0+] Audio | ||
+ | |} | ||
+ | |||
+ | = HidDeviceInfo = | ||
+ | This is "nn::btm::HidDeviceInfo". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x2 || Vid | ||
+ | |- | ||
+ | | 0x2 || 0x2 || Pid | ||
+ | |} | ||
+ | |||
+ | = HidDeviceCondition = | ||
+ | This is "nn::btm::HidDeviceCondition". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x4 || [[#SniffMode|SniffMode]] | ||
+ | |- | ||
+ | | 0x4 || 0x4 || [[#SlotMode|SlotMode]] | ||
+ | |- | ||
+ | | 0x8 || 0x1 || IsBurstMode | ||
+ | |- | ||
+ | | 0x9 || 0x11 || [[#ZeroRetransmissionList|ZeroRetransmissionList]] | ||
+ | |- | ||
+ | | 0x1A || 0x2 || Vid | ||
+ | |- | ||
+ | | 0x1C || 0x2 || Pid | ||
+ | |} | ||
= HostDeviceProperty = | = HostDeviceProperty = | ||
This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct. | This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct. | ||
+ | |||
+ | [13.0.0+] This is a 0x103-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] | ||
+ | |- | ||
+ | | 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]] | ||
+ | |- | ||
+ | | 0x9 || 0x20 || [[#BdName|BdName]] | ||
+ | |- | ||
+ | | 0x29 || 0x1 || FeatureSet | ||
+ | |- | ||
+ | | 0x2A || 0xD9 || [13.0.0+] | ||
+ | |} | ||
+ | |||
+ | = DeviceSlotMode = | ||
+ | This is "nn::btm::DeviceSlotMode". | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] | ||
+ | |- | ||
+ | | 0x6 || 0x2 || Reserved | ||
+ | |- | ||
+ | | 0x8 || 0x4 || [[#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]] | ||
+ | |} | ||
+ | |||
+ | = DeviceCondition = | ||
+ | This is "nn::btm::DeviceCondition". This is a 0x6C-byte struct. | ||
+ | |||
+ | [13.0.0+] This is a 0x148-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] | ||
+ | |- | ||
+ | | 0x6 || 0x2 || Reserved | ||
+ | |- | ||
+ | | 0x8 || 0x4 || [[#Profile|Profile]] | ||
+ | |- | ||
+ | | 0xC || 0x20 || [[#BdName|BdName]] | ||
+ | |- | ||
+ | | 0x2C || 0x20 || Empty (Profile = None) or [[#HidDeviceCondition|HidDeviceCondition]] (Profile = Hid) | ||
+ | |- | ||
+ | | 0x4C || 0x20 || Reserved | ||
+ | |- | ||
+ | | 0x6C || 0xDC || [13.0.0+] | ||
+ | |} | ||
+ | |||
+ | = DeviceConditionList = | ||
+ | This is "nn::btm::DeviceConditionList". This is a 0x36C-byte struct. | ||
+ | |||
+ | [13.0.0+] This is a 0xA4C-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x4 || [[#BluetoothMode|BluetoothMode]] | ||
+ | |- | ||
+ | | 0x4 || 0x4 || [[#WlanMode|WlanMode]] | ||
+ | |- | ||
+ | | 0x8 || 0x1 || IsSlotSavingForPairing | ||
+ | |- | ||
+ | | 0x9 || 0x1 || DeviceCount | ||
+ | |- | ||
+ | | 0xA || 0x2 || Reserved | ||
+ | |- | ||
+ | | 0xC || 0x148 * 8 ([1.0.0-12.1.0] 0x6C * 8) || Array of [[#DeviceCondition|DeviceCondition]] | ||
+ | |} | ||
+ | |||
+ | = DeviceInfo = | ||
+ | This is "nn::btm::DeviceInfo". This is a 0x60-byte struct. | ||
+ | |||
+ | [13.0.0+] This is a 0x13C-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 | ||
+ | |- | ||
+ | | 0x60 || 0xDC || [13.0.0+] | ||
+ | |} | ||
= DeviceInfoList = | = DeviceInfoList = | ||
This is "nn::btm::DeviceInfoList". This is a 0x3C4-byte struct. | This is "nn::btm::DeviceInfoList". This is a 0x3C4-byte struct. | ||
− | = DeviceInfo = | + | [13.0.0+] This is a 0xC5C-byte struct. |
− | This is "nn::btm:: | + | |
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x1 || DeviceCount | ||
+ | |- | ||
+ | | 0x1 || 0x3 || Reserved | ||
+ | |- | ||
+ | | 0x4 || 0x13C * 10 ([1.0.0-12.1.0] 0x60 * 10) || Array of [[#DeviceInfo|DeviceInfo]] | ||
+ | |} | ||
+ | |||
+ | = DeviceProperty = | ||
+ | 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 = | ||
+ | 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]] | ||
+ | |} | ||
+ | |||
+ | = DeviceCeLength = | ||
+ | This is "nn::btm::DeviceCeLength". This is a 0x10-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] | ||
+ | |- | ||
+ | | 0x6 || 0x6 || Reserved | ||
+ | |- | ||
+ | | 0xC || 0x1 || CeLength (used for [[Bluetooth_Driver_services#BleConnectionParameter|BleConnectionParameter]]) | ||
+ | |- | ||
+ | | 0xD || 0x3 || Reserved | ||
+ | |} | ||
+ | |||
+ | = DeviceCeLengthList = | ||
+ | This is "nn::btm::DeviceCeLengthList". This is a 0x44-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x10 * 4 || Array of [[#DeviceCeLength|DeviceCeLength]] | ||
+ | |- | ||
+ | | 0x40 || 0x4 || DeviceCount | ||
+ | |} | ||
= 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 = | ||
Line 801: | Line 1,373: | ||
| 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | ||
|- | |- | ||
− | | 0x18 || 0x2 || | + | | 0x18 || 0x2 || Handle |
|- | |- | ||
− | | 0x1A || | + | | 0x1A || 0x2 || |
|- | |- | ||
− | | | + | | 0x1C || 0x2 || InstanceId |
|- | |- | ||
− | | 0x20 || 0x1 || | + | | 0x1E || 0x2 || EndGroupHandle |
+ | |- | ||
+ | | 0x20 || 0x1 || PrimaryService flag | ||
|- | |- | ||
| 0x21 || 0x3 || Padding | | 0x21 || 0x3 || Padding | ||
Line 814: | Line 1,388: | ||
= GattCharacteristic = | = GattCharacteristic = | ||
This is "nn::btm::user::GattCharacteristic". This is a 0x24-byte struct. | This is "nn::btm::user::GattCharacteristic". This is a 0x24-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x4 || | ||
+ | |- | ||
+ | | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | ||
+ | |- | ||
+ | | 0x18 || 0x2 || Handle | ||
+ | |- | ||
+ | | 0x1A || 0x2 || | ||
+ | |- | ||
+ | | 0x1C || 0x2 || InstanceId | ||
+ | |- | ||
+ | | 0x1E || 0x1 || Properties | ||
+ | |- | ||
+ | | 0x1F || 0x5 || | ||
+ | |} | ||
= GattDescriptor = | = GattDescriptor = | ||
This is "nn::btm::user::GattDescriptor". This is a 0x20-byte struct. | This is "nn::btm::user::GattDescriptor". This is a 0x20-byte struct. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 || 0x4 || | ||
+ | |- | ||
+ | | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | ||
+ | |- | ||
+ | | 0x18 || 0x2 || Handle | ||
+ | |- | ||
+ | | 0x1A || 0x6 || | ||
+ | |} | ||
= BleDataPath = | = BleDataPath = | ||
Line 833: | Line 1,443: | ||
| 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | ||
|} | |} | ||
+ | |||
+ | = Logging = | ||
+ | A func which uses [[PSC_services|srepo]] is called in certain conditions (access to srepo:u was added to btm with [7.0.0+]). This is implemented as follows (as of 11.0.0): | ||
+ | |||
+ | * Loads the data for the below fields. | ||
+ | * Creates the report with EventId "bluetooth_crash". The ApplicationId is set to {btm ProgramId}. | ||
+ | * The following fields are added to the report: | ||
+ | ** "reason": Set to an input param for this func. | ||
+ | ** "radio" | ||
+ | ** "gamepad_pairing" | ||
+ | ** "llr_notify" | ||
+ | ** "ble_scan" | ||
+ | ** "bluetooth_mode": Set to hard-coded value 0. | ||
+ | ** "wlan_mode" | ||
+ | ** "classic_device_count" | ||
+ | ** "slot_mode_active_count" | ||
+ | ** "slot_mode_4_count" | ||
+ | ** "slot_mode_6_count" | ||
+ | ** "sniff_mode" | ||
+ | ** "ble_device_count" | ||
+ | ** "ce_length_2_count" | ||
+ | ** "ce_length_4_count" | ||
+ | ** "ce_length_8_count" | ||
+ | * Saves the report and returns. | ||
[[Category:Services]] | [[Category:Services]] |
Latest revision as of 23:43, 13 September 2024
btm
This is "nn::btm::IBtm".
Support for "nn::btm::*" was added to sdknso with 6.x.
This has max_sessions 6. IPC is handled by 2 threads shared with all services.
With BLE connections, the remote device may receive ATT_READ_BY_GROUP_TYPE_REQ before the BLE connection-complete HCI event. One workaround for this is manually sending the response with HCI, after the connection is ready.
The output bool from all of these btm* service get-event cmds indicates whether the Event was successfully returned, user-processes will Abort when this is 0.
Cmd | Name |
---|---|
0 | #GetState |
1 | #GetHostDeviceProperty |
2 | #AcquireDeviceConditionEvent |
3 | #GetDeviceCondition |
4 | #SetBurstMode |
5 | #SetSlotMode |
6 | [1.0.0-8.1.1] #SetBluetoothMode |
7 | #SetWlanMode |
8 | #AcquireDeviceInfoEvent |
9 | #GetDeviceInfo |
10 | #AddDeviceInfo |
11 | #RemoveDeviceInfo |
12 | #IncreaseDeviceInfoOrder |
13 | [9.0.0+] TriggerConnection ([1.0.0-8.1.1] #LlrNotify) |
14 | #EnableRadio |
15 | #DisableRadio |
16 | #HidDisconnect |
17 | #HidSetRetransmissionMode |
18 | [2.0.0+] #AcquireAwakeReqEvent |
19 | [9.0.0+] AcquireConnectionTriggerEvent ([4.0.0-8.1.1] #AcquireLlrStateEvent) |
20 | [9.0.0+] IsConnectionTriggered ([4.0.0-8.1.1] #IsLlrStarted) |
21 | [4.0.0+] #EnableSlotSaving |
22 | [5.0.0+] #ProtectDeviceInfo |
23 | [5.0.0+] #AcquireBleScanEvent |
24 | [5.1.0+] #GetBleScanParameterGeneral |
25 | [5.1.0+] #GetBleScanParameterSmartDevice |
26 | [5.1.0+] #StartBleScanForGeneral |
27 | [5.1.0+] #StopBleScanForGeneral |
28 | [5.1.0+] #GetBleScanResultsForGeneral |
29 | [5.1.0+] #StartBleScanForPairedDevice |
30 | [5.1.0+] #StopBleScanForPairedDevice |
31 | [5.1.0+] #StartBleScanForSmartDevice |
32 | [5.1.0+] #StopBleScanForSmartDevice |
33 | [5.1.0+] #GetBleScanResultsForSmartDevice |
34 | [5.1.0+] #AcquireBleConnectionEvent |
35 ([5.0.0-5.0.2] 24) | [5.0.0+] #BleConnect |
36 | [5.1.0+] #BleOverrideConnection |
37 ([5.0.0-5.0.2] 25) | [5.0.0+] #BleDisconnect |
38 ([5.0.0-5.0.2] 26) | [5.0.0+] #BleGetConnectionState |
39 ([5.0.0-5.0.2] 27) | [5.0.0+] #BleGetGattClientConditionList |
40 ([5.0.0-5.0.2] 28) | [5.0.0+] #AcquireBlePairingEvent |
41 | [5.1.0+] #BlePairDevice |
42 | [5.1.0+] #BleUnpairDeviceOnBoth |
43 | [5.1.0+] #BleUnpairDevice |
44 | [5.1.0+] #BleGetPairedAddresses |
45 | [5.1.0+] #AcquireBleServiceDiscoveryEvent |
46 ([5.0.0-5.0.2] 29) | [5.0.0+] #GetGattServices |
47 ([5.0.0-5.0.2] 30) | [5.0.0+] #GetGattService |
48 ([5.0.0-5.0.2] 31) | [5.0.0+] #GetGattIncludedServices |
49 ([5.0.0-5.0.2] 32) | [5.0.0+] #GetBelongingService |
50 ([5.0.0-5.0.2] 33) | [5.0.0+] #GetGattCharacteristics |
51 ([5.0.0-5.0.2] 34) | [5.0.0+] #GetGattDescriptors |
52 ([5.0.0-5.0.2] 35) | [5.0.0+] #AcquireBleMtuConfigEvent |
53 ([5.0.0-5.0.2] 36) | [5.0.0+] #ConfigureBleMtu |
54 ([5.0.0-5.0.2] 37) | [5.0.0+] #GetBleMtu |
55 ([5.0.0-5.0.2] 38) | [5.0.0+] #RegisterBleGattDataPath |
56 ([5.0.0-5.0.2] 39) | [5.0.0+] #UnregisterBleGattDataPath |
57 ([5.0.0-5.0.2] 40) | [5.0.0+] #RegisterAppletResourceUserId |
58 ([5.0.0-5.0.2] 41) | [5.0.0+] #UnregisterAppletResourceUserId |
59 ([5.0.0-5.0.2] 42) | [5.0.0+] #SetAppletResourceUserId |
60 | [8.0.0+] #AcquireBleConnectionParameterUpdateEvent |
61 | [8.0.0+] #SetCeLength |
62 | [9.0.0+] #EnsureSlotExpansion |
63 | [9.0.0+] #IsSlotExpansionEnsured |
64 | [10.0.0+] #CancelConnectionTrigger |
65 | [13.0.0+] GetConnectionCapacity |
66 | [13.0.0+] GetWlanMode |
67 | [13.0.0+] IsSlotSavingEnabled |
68 | [13.0.0+] IsSlotSavingForPairingEnabled |
69 | [13.0.0+] AcquireAudioDeviceConnectionEvent |
70 | [13.0.0+] GetConnectedAudioDevices |
71 | [13.0.0+] SetAudioSourceVolume |
72 | [13.0.0+] GetAudioSourceVolume |
73 | [13.0.0+] RequestAudioDeviceConnectionRejection |
74 | [13.0.0+] CancelAudioDeviceConnectionRejection |
75 | [13.0.0+] GetPairedAudioDevices |
76 | [13.1.0+] SetWlanModeWithOption |
100 | [13.0.0+] AcquireConnectionDisallowedEvent |
101 | [13.0.0+] GetUsecaseViolationFactor |
110 | [13.0.0+] GetShortenedDeviceInfo |
111 | [13.0.0+] AcquirePairingCountUpdateEvent |
112 | [14.0.0-14.1.2] |
113 | [14.0.0-14.1.2] |
114 | [14.0.0+] IsFirstAudioControlConnection |
115 | [14.0.0+] GetShortenedDeviceCondition |
116 | [15.0.0+] SetAudioSinkVolume |
117 | [15.0.0+] GetAudioSinkVolume |
GetState
No input. Returns an output #BtmState.
GetHostDeviceProperty
No input. Returns an output #HostDeviceProperty.
[13.0.0+] Takes a type-0x1A output buffer containing a #HostDeviceProperty. No output.
This gets the previously initialized #HostDeviceProperty.
AcquireDeviceConditionEvent
No input. Returns an output Event handle with EventClearMode=1.
[3.0.0+] Now returns an additional output bool.
GetDeviceCondition
Takes a type-0x1A output buffer containing a #DeviceConditionList. No output.
[13.0.0+] Takes an input u32 #Profile, a type-0xA output buffer containing an array of #DeviceCondition, returns a s32 for total output entries. When #Profile is non-zero, entries are only returned with a matching #Profile.
SetBurstMode
Takes an input BdAddress and a bool. No output.
SetSlotMode
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.
- First array:
- Validates the BdAddress with state, skipping it if not found.
- Calls the SetTsi wrapper func described below, with the above BdAddress and tsi=0xFF (Exit). If this returns false, CloseHidConnection is used with the BdAddress.
- Second array:
- Validates the BdAddress with state, skipping it if not found.
- Uses 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 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 CloseHidConnection is used and the loop is continued.
- Calls the SetTsi wrapper func described below, with the BdAddress and the above Tsi value. If this returns false, CloseHidConnection is used with the BdAddress.
- It then goes through various arrays again for updating state.
- {...}
- First array:
Note that the above func is also called from various other funcs as well. An event for opening a hid connection also triggers it in some cases.
The SetTsi wrapper func is implemented as follows:
- Uses 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
Takes an input #BluetoothMode. No output.
SetWlanMode
Takes an input #WlanMode. No output.
AcquireDeviceInfoEvent
No input. Returns an output Event handle with EventClearMode=1.
[3.0.0+] Now returns an additional output bool.
GetDeviceInfo
Takes a type-0x1A output buffer containing a #DeviceInfoList. No output.
[13.0.0+] Takes an input u32 #Profile, a type-0xA output buffer containing an array of #DeviceInfo, returns a s32 for total output entries. When #Profile is non-zero, entries are only returned with a matching #Profile.
AddDeviceInfo
Takes an input #DeviceInfo. No output.
[13.0.0+] Takes a type-0x19 input buffer containing a #DeviceInfo, no output.
RemoveDeviceInfo
Takes an input BdAddress. No output.
IncreaseDeviceInfoOrder
Takes an input BdAddress. No output.
LlrNotify
Takes an input BdAddress. No output.
[9.0.0+] Takes an input BdAddress and a s32, no output.
EnableRadio
No input/output.
DisableRadio
No input/output.
HidDisconnect
Takes an input BdAddress. No output.
HidSetRetransmissionMode
Takes an input BdAddress and a type-0x19 input buffer containing a #ZeroRetransmissionList. No output.
AcquireAwakeReqEvent
No input. Returns an output Event handle with EventClearMode=1.
[3.0.0+] Now returns an additional output bool.
AcquireLlrStateEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
IsLlrStarted
No input. Returns an output bool.
EnableSlotSaving
Takes an input bool. No output.
ProtectDeviceInfo
Takes an input BdAddress and a bool. No output.
AcquireBleScanEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
GetBleScanParameterGeneral
Takes an input u16 ParameterId. Returns a BleAdvertisePacketParameter.
The u16 must be value 0x1 or 0xFFFF.
hid uses value 0x1 for Palma.
The output BleAdvertisePacketParameter starting at +0x2 contains (CompanyId is 0x0553 for Nintendo for both of these):
- ParameterId 0x1:
000100000100
- ParameterId 0xFFFF:
ADDE00EFBE00
GetBleScanParameterSmartDevice
Takes an input u16 ParameterId. Returns a GattAttributeUuid.
The u16 must be value 0x2. The first 4-bytes of output is always 0 since it's not set.
StartBleScanForGeneral
Takes a BleAdvertisePacketParameter. No output.
This eventually uses AddBleScanFilterCondition, where the the passed BleAdvertiseFilter is generated from the input BleAdvertisePacketParameter.
This also uses SetBleScanParameter.
StopBleScanForGeneral
No input/output.
GetBleScanResultsForGeneral
Takes a type-0x6 output buffer containing an array of BleScanResult. Returns an output u8 total_out.
The max array entries is 10.
StartBleScanForPaired
Takes a BleAdvertisePacketParameter. No output.
This eventually uses AddBleScanFilterCondition, where the the passed BleAdvertiseFilter is generated from the input BleAdvertisePacketParameter.
This also uses SetBleScanParameter.
StopBleScanForPaired
No input/output.
StartBleScanForSmartDevice
Takes a GattAttributeUuid. No output.
This eventually uses AddBleScanFilterCondition, where the the passed BleAdvertiseFilter is generated from the input GattAttributeUuid.
This also uses SetBleScanParameter.
The BleAdvertiseFilter is generated as follows: CondType = 7(ServiceUuid128), CondDataSize = 0x11. CondData: {128bit UUID copied from the GattAttributeUuid (size field ignored), then an u8 with value 0x0 (unused)}. MaskSize = 0x10, Mask = {all 0xFF}.
StopBleScanForSmartDevice
No input/output.
GetBleScanResultsForSmartDevice
Takes a type-0x6 output buffer containing an array of BleScanResult. Returns an output u8 total_out.
The max array entries is 10.
AcquireBleConnectionEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
BleConnect
Takes an input BdAddress. No output.
An error is thrown if the BdAddress is already connected (listed in the BleConnectionInfo from #BleGetConnectionState). An error is thrown if 4 devices are already connected.
BleOverrideConnection
Takes an input u32 ConnectionHandle. No output.
The u32 is the same as the param for #BleDisconnect.
BleDisconnect
Takes an input u32 ConnectionHandle. No output.
The u32 must match a ConnectionHandle in a BleConnectionInfo from #BleGetConnectionState. [5.1.0+] 0xFFFFFFFF is invalid.
BleGetConnectionState
Takes a type-0xA output buffer containing an array of BleConnectionInfo. Returns an output u8 total_out.
Other cmds which use this internally use arraycount=4.
BleGetGattClientConditionList
Takes a type-0x1A output buffer containing a 0x74-byte struct.
AcquireBlePairingEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
BlePairDevice
Takes an input BleAdvertisePacketParameter and an input u32 ConnectionHandle. No output.
The u32 is the same as the param for #BleDisconnect.
BleUnpairDeviceOnBoth
Takes an input BleAdvertisePacketParameter an input u32 ConnectionHandle. No output.
The u32 is the same as the param for #BleDisconnect.
BleUnpairDevice
Takes an input BdAddress and a BleAdvertisePacketParameter. No output.
BleGetPairedAddresses
Takes a type-0xA output buffer containing an array of BdAddress, a BleAdvertisePacketParameter. Returns an output u8 total_out.
The max array entries is 10.
AcquireBleServiceDiscoveryEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
GetGattServices
Takes a type-0x6 output buffer containing an array of #GattService and an input u32 ConnectionHandle. Returns an output u8 total_out.
The u32 is the same as the param for #BleDisconnect. The max array entries is 100.
GetGattService
Takes a type-0x1A output buffer containing a #GattService, an input u32 ConnectionHandle and a GattAttributeUuid. Returns an output bool.
The u32 is the same as the param for #BleDisconnect. The output bool indicates whether a #GattService was returned.
Same as #GetGattServices except this only returns the #GattService which matches the input GattAttributeUuid.
GetGattIncludedServices
Takes a type-0x6 output buffer containing an array of #GattService, an u16 ServiceHandle and an input u32 ConnectionHandle. Returns an output u8.
The u32 is the same as the param for #BleDisconnect. The max array entries is 100.
Same as #GetGattServices except this only returns #GattService entries where various checks pass with u16 fields.
The param for the output u8 is unused by the sysmodule, hence the output is always 0.
GetBelongingService
Takes a type-0x1A output buffer containing a #GattService, an u16 AttributeHandle and an input u32 ConnectionHandle. Returns an output bool.
The u32 is the same as the param for #BleDisconnect. The output bool indicates whether a #GattService was returned.
This is similar to #GetGattIncludedServices except this only returns 1 #GattService.
GetGattCharacteristics
Takes a type-0x6 output buffer containing an array of #GattCharacteristic, an u16 ServiceHandle and an input u32 ConnectionHandle. Returns an output u8 total_out.
The u32 is the same as the param for #BleDisconnect. The max array entries is 100.
The u16 controls which #GattCharacteristic entries to return.
GetGattDescriptors
Takes a type-0x6 output buffer containing an array of #GattDescriptor, an u16 CharHandle and an input u32 ConnectionHandle. Returns an output u8 total_out.
The u32 is the same as the param for #BleDisconnect. The max array entries is 100.
The u16 controls which #GattDescriptor entries to return.
AcquireBleMtuConfigEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
ConfigureBleMtu
Takes an u16 mtu and an input u32 ConnectionHandle. No output.
The u32 is the same as the param for #BleDisconnect.
GetBleMtu
Takes an input u32 ConnectionHandle. Returns an output u16 mtu.
The u32 is the same as the param for #BleDisconnect.
RegisterBleGattDataPath
Takes a #BleDataPath. No output.
UnregisterBleGattDataPath
Takes a #BleDataPath. No output.
RegisterAppletResourceUserId
Takes an input u32 and an AppletResourceUserId. No output.
UnregisterAppletResourceUserId
Takes an input AppletResourceUserId. No output.
SetAppletResourceUserId
Takes an input AppletResourceUserId. No output.
AcquireBleConnectionParameterUpdateEvent
No input. Returns an output Event handle with EventClearMode=1.
SetCeLength
Takes an input DeviceCeLengthList. No output.
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.
EnsureSlotExpansion
Takes an input bool. No output.
Sends a request which is handled as follows: writes the flag into state if needed.
IsSlotExpansionEnsured
No input. Returns an output bool.
This gets the flag used by #EnsureSlotExpansion.
CancelConnectionTrigger
No input/output.
Sends a request which is handled as follows: if a state field is set, another state field is set to value 1.
btm:dbg
This is "nn::btm::IBtmDebug".
This has max_sessions 6. IPC is handled by 2 threads shared with all services.
Cmd | Name |
---|---|
0 | #AcquireDiscoveryEvent |
1 | #StartDiscovery |
2 | #CancelDiscovery |
3 | [12.0.0+] IsDiscoveryEnabled ([1.0.0-11.0.1] #GetDeviceProperty) |
4 | #CreateBond |
5 | #CancelBond |
6 | #SetTsiMode |
7 | #GeneralTest |
8 | #HidConnect |
9 | [5.0.0+] #GeneralGet |
10 | [5.1.0+] #GetGattClientDisconnectionReason |
11 | [5.1.0+] #GetBleConnectionParameter |
12 | [5.1.0+] #GetBleConnectionParameterRequest |
13 | [12.0.0+] GetDiscoveredDevice |
14 | [15.0.0+] SleepAwakeLoopTest |
15 | [15.0.0+] SleepTest |
16 | [15.0.0+] MinimumAwakeTest |
17 | [15.0.0+] ForceEnableBtm |
AcquireDiscoveryEvent
No input. Returns output an Event handle with EventClearMode=1.
[3.0.0+] Now returns an additional output bool.
StartDiscovery
No input/output.
CancelDiscovery
No input/output.
GetDeviceProperty
Takes a type-0x1A output buffer containing a #DevicePropertyList. No output.
CreateBond
Takes an input BdAddress. No output.
[13.0.0+] Now takes a type-0xA output buffer, returns a total of 4-bytes of output.
CancelBond
Takes an input BdAddress. No output.
SetTsiMode
Takes an input BdAddress and a #TsiMode. No output.
Sends a request which is handled as follows: uses SetTsi directly with the specified params.
GeneralTest
Takes an input s32. No output.
HidConnect
Takes an input BdAddress. No output.
GeneralGet
Takes an input u32 and a type-0x1A output buffer containing a 0x11-byte struct. No output.
GetGattClientDisconnectionReason
Takes an input BdAddress and an u32. Returns an output bool and u16.
The bool indicates whether the cmd is successful.
GetBleConnectionParameter
Takes an input u32. Returns an output bool and 3 u16s.
The bool indicates whether the cmd is successful, the output u16s are only set when this bool is set.
GetBleConnectionParameterRequest
Takes an input u32. Returns an output bool and 4 u16s.
The bool indicates whether the cmd is successful, the output u16s are only set when this bool is set.
btm:sys
This is "nn::btm::IBtmSystem".
This has max_sessions 6. IPC is handled by 2 threads shared with all services.
Cmd | Name |
---|---|
0 | #GetCore |
GetCore
No input. Returns an output #IBtmSystemCore.
IBtmSystemCore
This is "nn::btm::IBtmSystemCore".
Cmd | Name |
---|---|
0 | #StartGamepadPairing |
1 | #CancelGamepadPairing |
2 | #ClearGamepadPairingDatabase |
3 | #GetPairedGamepadCount |
4 | #EnableRadio |
5 | #DisableRadio |
6 | #IsRadioEnabled |
7 | [3.0.0+] #AcquireRadioEvent |
8 | [3.0.0+] #AcquireGamepadPairingEvent |
9 | [3.0.0+] #IsGamepadPairingStarted |
10 | [13.0.0+] StartAudioDeviceDiscovery |
11 | [13.0.0+] StopAudioDeviceDiscovery |
12 | [13.0.0+] IsDiscoveryingAudioDevice |
13 | [13.0.0+] GetDiscoveredAudioDevice |
14 | [13.0.0+] AcquireAudioDeviceConnectionEvent |
15 | [13.0.0+] ConnectAudioDevice |
16 | [13.0.0+] IsConnectingAudioDevice |
17 | [13.0.0+] GetConnectedAudioDevices |
18 | [13.0.0+] DisconnectAudioDevice |
19 | [13.0.0+] AcquirePairedAudioDeviceInfoChangedEvent |
20 | [13.0.0+] GetPairedAudioDevices |
21 | [13.0.0+] RemoveAudioDevicePairing |
22 | [13.0.0+] RequestAudioDeviceConnectionRejection |
23 | [13.0.0+] CancelAudioDeviceConnectionRejection |
StartGamepadPairing
No input/output.
CancelGamepadPairing
No input/output.
ClearGamepadPairingDatabase
No input/output.
GetPairedGamepadCount
No input. Returns an output u8.
EnableRadio
No input/output.
DisableRadio
No input/output.
IsRadioEnabled
No input. Returns an output bool.
AcquireRadioEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
AcquireGamepadPairingEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
IsGamepadPairingStarted
No input. Returns an output bool.
btm:u
This is "nn::btm::IBtmUser".
This was added with [5.0.0+].
This has max_sessions 6. IPC is handled by 2 threads shared with all services.
Cmd | Name |
---|---|
0 | GetCore |
GetCore
No input. Returns an output #IBtmUserCore.
IBtmUserCore
This is "nn::btm::IBtmUserCore".
AcquireBleScanEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
This is similar to the btm cmd.
GetBleScanFilterParameter
Takes an input u16. Returns a BleAdvertisePacketParameter.
This is the same as #GetBleScanParameterGeneral.
GetBleScanFilterParameter2
Takes an input u16. Returns a GattAttributeUuid.
This is the same as #GetBleScanParameterSmartDevice.
StartBleScanForGeneral
Takes a PID, a BleAdvertisePacketParameter, an AppletResourceUserId. No output.
This is similar to the btm cmd.
StopBleScanForGeneral
No input/output.
This is similar to the btm cmd.
GetBleScanResultsForGeneral
Takes a PID, a type-0x6 output buffer containing an array of BleScanResult, an AppletResourceUserId. Returns an output u8 total_out.
This is similar to the btm cmd.
StartBleScanForPaired
Takes a PID, a BleAdvertisePacketParameter, an AppletResourceUserId. No output.
This is similar to the btm cmd.
StopBleScanForPaired
No input/output.
This is similar to the btm cmd.
StartBleScanForSmartDevice
Takes a PID, a GattAttributeUuid, an AppletResourceUserId. No output.
This is similar to the btm cmd.
StopBleScanForSmartDevice
No input/output.
This is similar to the btm cmd.
GetBleScanResultsForSmartDevice
Takes a PID, a type-0x6 output buffer containing an array of BleScanResult, an AppletResourceUserId. Returns an output u8 total_out.
This is similar to the btm cmd.
AcquireBleConnectionEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
This is similar to the btm cmd.
BleConnect
Takes a PID, an BdAddress, an AppletResourceUserId. No output.
This is similar to the btm cmd.
BleDisconnect
Takes an input u32. No output.
This is similar to the btm cmd.
BleGetConnectionState
Takes a PID, a type-0xA output buffer containing an array of BleConnectionInfo, an AppletResourceUserId. Returns an output u8 total_out.
This is similar to the btm cmd.
AcquireBlePairingEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
This is similar to the btm cmd.
BlePairDevice
Takes an input BleAdvertisePacketParameter and an u32. No output.
This is similar to the btm cmd.
BleUnPairDevice
Takes an input BleAdvertisePacketParameter and an u32. No output.
This is similar to the btm cmd.
BleUnPairDevice2
Takes an input BdAddress and a BleAdvertisePacketParameter. No output.
This is similar to the btm cmd.
BleGetPairedDevices
Takes a type-0xA output buffer containing an array of BdAddress, a BleAdvertisePacketParameter. Returns an output u8 total_out.
This is the same as the btm cmd.
AcquireBleServiceDiscoveryEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
This is similar to the btm cmd.
sdknso will Abort if the output u8 is value 0.
GetGattServices
Takes a PID, a type-0x6 output buffer containing an array of #GattService, an u32, an AppletResourceUserId. Returns an output u8 total_out.
This is similar to the btm cmd.
GetGattService
Takes a PID, a type-0x1A output buffer containing a #GattService, an u32, a GattAttributeUuid, an AppletResourceUserId. Returns an output bool.
This is similar to the btm cmd.
GetGattIncludedServices
Takes a PID, a type-0x6 output buffer containing an array of #GattService, an u16, an u32, an AppletResourceUserId. Returns an output u8.
This is similar to the btm cmd.
The param for the output u8 is unused by the sysmodule, hence the output is always 0. However, a sdknso func which calls the nn::btm::* func for this expects this u8 to be set.
GetBelongingGattService
Takes a PID, a type-0x1A output buffer containing a #GattService, an u16, an u32, an AppletResourceUserId. Returns an output bool.
This is similar to the btm cmd.
GetGattCharacteristics
Takes a PID, a type-0x6 output buffer containing an array of #GattCharacteristic, an u16, an u32, an AppletResourceUserId. Returns an output u8 total_out.
This is similar to the btm cmd.
GetGattDescriptors
Takes a PID, a type-0x6 output buffer containing an array of #GattDescriptor, an u16, an u32, an AppletResourceUserId. Returns an output u8 total_out.
This is similar to the btm cmd.
AcquireBleMtuConfigEvent
No input. Returns an output bool and an Event handle with EventClearMode=1.
This is similar to the btm cmd.
ConfigureBleMtu
Takes a PID, an u16, an u32, an AppletResourceUserId. No output.
This is similar to the btm cmd.
sdknso will Abort if the user-specified u16 is <0x18 or >0x200 (this doesn't apply to the btm cmd).
GetBleMtu
Takes a PID, an u32, an AppletResourceUserId. Returns an output u16.
This is similar to the btm cmd.
RegisterBleGattDataPath
Takes a PID, a #BleDataPath, an AppletResourceUserId. No output.
This is similar to the btm cmd.
UnregisterBleGattDataPath
Takes a PID, a #BleDataPath, an AppletResourceUserId. No output.
This is similar to the 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
This is "nn::btm::BtmState".
Value | Description |
---|---|
0 | NotInitialized |
1 | RadioOff |
2 | MinorSlept |
3 | RadioOffMinorSlept |
4 | Slept |
5 | RadioOffSlept |
6 | Initialized |
7 | Working |
BluetoothMode
This is "nn::btm::BluetoothMode".
Value | Description |
---|---|
0 | Dynamic2Slot |
1 | StaticJoy |
WlanMode
This is "nn::btm::WlanMode".
Value | Description |
---|---|
0 | Local4 |
1 | Local8 |
2 | None |
TsiMode
This is "nn::btm::TsiMode".
Value | Description |
---|---|
0 | 0Fd3Td3Si10 |
1 | 1Fd1Td1Si5 |
2 | 2Fd1Td3Si10 |
3 | 3Fd1Td5Si15 |
4 | 4Fd3Td1Si10 |
5 | 5Fd3Td3Si15 |
6 | 6Fd5Td1Si15 |
7 | 7Fd1Td3Si15 |
8 | 8Fd3Td1Si15 |
9 | 9Fd1Td1Si10 |
10 | 10Fd1Td1Si15 |
255 | Active |
SlotMode
This is "nn::btm::SlotMode".
Value | Description |
---|---|
0 | 2 |
1 | 4 |
2 | 6 |
3 | Active |
SniffMode
This is "nn::btm::SniffMode".
Value | Description |
---|---|
0 | 5ms |
1 | 10ms |
2 | 15ms |
3 | Active |
Profile
This is "nn::btm::Profile".
Value | Description |
---|---|
0 | None |
1 | Hid |
2 | [13.0.0+] Audio |
HidDeviceInfo
This is "nn::btm::HidDeviceInfo".
Offset | Size | Description |
---|---|---|
0x0 | 0x2 | Vid |
0x2 | 0x2 | Pid |
HidDeviceCondition
This is "nn::btm::HidDeviceCondition".
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | SniffMode |
0x4 | 0x4 | SlotMode |
0x8 | 0x1 | IsBurstMode |
0x9 | 0x11 | ZeroRetransmissionList |
0x1A | 0x2 | Vid |
0x1C | 0x2 | Pid |
HostDeviceProperty
This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct.
[13.0.0+] This is a 0x103-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x6 | BdAddress |
0x6 | 0x3 | ClassOfDevice |
0x9 | 0x20 | BdName |
0x29 | 0x1 | FeatureSet |
0x2A | 0xD9 | [13.0.0+] |
DeviceSlotMode
This is "nn::btm::DeviceSlotMode".
Offset | Size | Description |
---|---|---|
0x0 | 0x6 | BdAddress |
0x6 | 0x2 | Reserved |
0x8 | 0x4 | SlotMode |
DeviceSlotModeList
This is "nn::btm::DeviceSlotModeList". This is a 0x64-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | DeviceCount |
0x1 | 0x3 | Reserved |
0x4 | 0xC * 8 | Array of DeviceSlotMode |
DeviceCondition
This is "nn::btm::DeviceCondition". This is a 0x6C-byte struct.
[13.0.0+] This is a 0x148-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x6 | BdAddress |
0x6 | 0x2 | Reserved |
0x8 | 0x4 | Profile |
0xC | 0x20 | BdName |
0x2C | 0x20 | Empty (Profile = None) or HidDeviceCondition (Profile = Hid) |
0x4C | 0x20 | Reserved |
0x6C | 0xDC | [13.0.0+] |
DeviceConditionList
This is "nn::btm::DeviceConditionList". This is a 0x36C-byte struct.
[13.0.0+] This is a 0xA4C-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | BluetoothMode |
0x4 | 0x4 | WlanMode |
0x8 | 0x1 | IsSlotSavingForPairing |
0x9 | 0x1 | DeviceCount |
0xA | 0x2 | Reserved |
0xC | 0x148 * 8 ([1.0.0-12.1.0] 0x6C * 8) | Array of DeviceCondition |
DeviceInfo
This is "nn::btm::DeviceInfo". This is a 0x60-byte struct.
[13.0.0+] This is a 0x13C-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x6 | BdAddress |
0x6 | 0x3 | ClassOfDevice |
0x9 | 0x20 | BdName |
0x29 | 0x10 | LinkKey |
0x39 | 0x3 | Reserved |
0x3C | 0x4 | Profile |
0x40 | 0x4 | Empty (Profile = None) or HidDeviceInfo (Profile = Hid) |
0x44 | 0x1C | Reserved |
0x60 | 0xDC | [13.0.0+] |
DeviceInfoList
This is "nn::btm::DeviceInfoList". This is a 0x3C4-byte struct.
[13.0.0+] This is a 0xC5C-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | DeviceCount |
0x1 | 0x3 | Reserved |
0x4 | 0x13C * 10 ([1.0.0-12.1.0] 0x60 * 10) | Array of DeviceInfo |
DeviceProperty
This is "nn::btm::DeviceProperty". This is a 0x29-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x6 | BdAddress |
0x6 | 0x3 | ClassOfDevice |
0x9 | 0x20 | BdName |
DevicePropertyList
This is "nn::btm::DevicePropertyList". This is a 0x268-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | DeviceCount |
0x1 | 0x29 * 15 | Array of DeviceProperty |
DeviceCeLength
This is "nn::btm::DeviceCeLength". This is a 0x10-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x6 | BdAddress |
0x6 | 0x6 | Reserved |
0xC | 0x1 | CeLength (used for BleConnectionParameter) |
0xD | 0x3 | Reserved |
DeviceCeLengthList
This is "nn::btm::DeviceCeLengthList". This is a 0x44-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x10 * 4 | Array of DeviceCeLength |
0x40 | 0x4 | DeviceCount |
ZeroRetransmissionList
This is "nn::btm::ZeroRetransmissionList". This is a 0x11-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | EnabledReportIdCount |
0x1 | 0x1 * 16 | Array of EnabledReportId |
GattService
This is "nn::btm::user::GattService". This is a 0x24-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | |
0x4 | 0x14 | GattAttributeUuid |
0x18 | 0x2 | Handle |
0x1A | 0x2 | |
0x1C | 0x2 | InstanceId |
0x1E | 0x2 | EndGroupHandle |
0x20 | 0x1 | PrimaryService flag |
0x21 | 0x3 | Padding |
GattCharacteristic
This is "nn::btm::user::GattCharacteristic". This is a 0x24-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | |
0x4 | 0x14 | GattAttributeUuid |
0x18 | 0x2 | Handle |
0x1A | 0x2 | |
0x1C | 0x2 | InstanceId |
0x1E | 0x1 | Properties |
0x1F | 0x5 |
GattDescriptor
This is "nn::btm::user::GattDescriptor". This is a 0x20-byte struct.
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | |
0x4 | 0x14 | GattAttributeUuid |
0x18 | 0x2 | Handle |
0x1A | 0x6 |
BleDataPath
This is "nn::btm::user::BleDataPath". This is a 0x18-byte struct with 4-byte alignment.
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | |
0x1 | 0x3 | Padding |
0x4 | 0x14 | GattAttributeUuid |
Logging
A func which uses srepo is called in certain conditions (access to srepo:u was added to btm with [7.0.0+]). This is implemented as follows (as of 11.0.0):
- Loads the data for the below fields.
- Creates the report with EventId "bluetooth_crash". The ApplicationId is set to {btm ProgramId}.
- The following fields are added to the report:
- "reason": Set to an input param for this func.
- "radio"
- "gamepad_pairing"
- "llr_notify"
- "ble_scan"
- "bluetooth_mode": Set to hard-coded value 0.
- "wlan_mode"
- "classic_device_count"
- "slot_mode_active_count"
- "slot_mode_4_count"
- "slot_mode_6_count"
- "sniff_mode"
- "ble_device_count"
- "ce_length_2_count"
- "ce_length_4_count"
- "ce_length_8_count"
- Saves the report and returns.