Line 7: |
Line 7: |
| | | |
| These btm services with BLE only allow connecting to devices which have a [[#GattService]] with a certain custom UUID present. | | These btm services with BLE only allow connecting to devices which have a [[#GattService]] with a certain custom UUID present. |
| + | |
| + | 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. |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 24: |
Line 26: |
| | 5 || [[#SetSlotMode]] | | | 5 || [[#SetSlotMode]] |
| |- | | |- |
− | | 6 || [1.0.0-8.1.0] [[#SetBluetoothMode]] | + | | 6 || [1.0.0-8.1.1] [[#SetBluetoothMode]] |
| |- | | |- |
| | 7 || [[#SetWlanMode]] | | | 7 || [[#SetWlanMode]] |
Line 148: |
Line 150: |
| == GetHostDeviceProperty == | | == GetHostDeviceProperty == |
| No input, returns an output [[#HostDeviceProperty]]. | | No input, returns an output [[#HostDeviceProperty]]. |
| + | |
| + | This gets the previously initialized [[#HostDeviceProperty]]. |
| | | |
| == AcquireDeviceConditionEvent == | | == AcquireDeviceConditionEvent == |
| No input, returns an output Event handle with EventClearMode=1. | | No input, returns an output Event handle with EventClearMode=1. |
| | | |
− | [3.0.0+] Now returns an additional output u8. | + | [3.0.0+] Now returns an additional output bool. |
| | | |
| == GetDeviceCondition == | | == GetDeviceCondition == |
Line 158: |
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 == |
| Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], no output. | | Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], no output. |
| + | |
| + | Sends a request which is then handled as follows: |
| + | * Calls a func for getting the data from [[#DeviceSlotModeList]] etc for passing to another func, that func then does the following: |
| + | * Goes through multiple arrays of [[#BdAddress|BdAddress]]. |
| + | ** First array: |
| + | *** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found. |
| + | *** Calls the SetTsi wrapper func described below, with the above [[#BdAddress|BdAddress]] and tsi=0xFF (Exit). If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]]. |
| + | ** Second array: |
| + | *** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found. |
| + | *** Uses [[Bluetooth_Driver_services#SetBleConnectionParameter|SetBleConnectionParameter]] with bool=true. Then the required EventInfo is loaded, {...}. |
| + | ** Then it goes through the first array again, except here it does the following: |
| + | *** Calls the same func for validating the [[#BdAddress|BdAddress]] with state, skipping it if not found. It is also skipped if the u32 at Address+0x8 is value 0x3. |
| + | *** Determines what Tsi value to use, on failure [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used and the loop is continued. |
| + | *** Calls the SetTsi wrapper func described below, with the [[#BdAddress|BdAddress]] and the above Tsi value. If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]]. |
| + | ** It then goes through various arrays again for updating state. |
| + | ** {...} |
| + | |
| + | 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 == |
Line 172: |
Line 198: |
| No input, returns an output Event handle with EventClearMode=1. | | No input, returns an output Event handle with EventClearMode=1. |
| | | |
− | [3.0.0+] Now returns an additional output u8. | + | [3.0.0+] Now returns an additional output bool. |
| | | |
| == GetDeviceInfo == | | == GetDeviceInfo == |
Line 181: |
Line 207: |
| | | |
| == 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 198: |
Line 224: |
| | | |
| == 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 == |
| No input, returns an output Event handle with EventClearMode=1. | | No input, returns an output Event handle with EventClearMode=1. |
| | | |
− | [3.0.0+] Now returns an additional output u8. | + | [3.0.0+] Now returns an additional output bool. |
| | | |
| == AcquireLlrStateEvent == | | == AcquireLlrStateEvent == |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| == IsLlrStarted == | | == IsLlrStarted == |
Line 218: |
Line 244: |
| | | |
| == 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 == |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| == GetBleScanParameterGeneral == | | == GetBleScanParameterGeneral == |
− | Takes an input u16, returns a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]]. | + | 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. |
| | | |
| == GetBleScanParameterSmartDevice == | | == GetBleScanParameterSmartDevice == |
− | Takes an input u16, returns a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. | + | 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. |
Line 262: |
Line 288: |
| | | |
| == AcquireBleConnectionEvent == | | == AcquireBleConnectionEvent == |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| == 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 275: |
Line 301: |
| | | |
| == BleDisconnect == | | == BleDisconnect == |
− | Takes an input u32, no output. | + | Takes an input u32 ConnectionHandle, no output. |
| | | |
− | The u32 must match an Id in a [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] from [[#BleGetConnectionState]] (0xFFFFFFFF is invalid). | + | The u32 must match a ConnectionHandle in a [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] from [[#BleGetConnectionState]]. [5.1.0+] 0xFFFFFFFF is invalid. |
| | | |
| == BleGetConnectionState == | | == BleGetConnectionState == |
Line 288: |
Line 314: |
| | | |
| == AcquireBlePairingEvent == | | == AcquireBlePairingEvent == |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| == BlePairDevice == | | == BlePairDevice == |
Line 301: |
Line 327: |
| | | |
| == 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. |
| | | |
| == AcquireBleServiceDiscoveryEvent == | | == AcquireBleServiceDiscoveryEvent == |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| == GetGattServices == | | == GetGattServices == |
Line 317: |
Line 343: |
| | | |
| == GetGattService == | | == GetGattService == |
− | Takes a type-0x1A output buffer containing a [[#GattService]], an u32, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], returns an output u8 total_out. | + | Takes a type-0x1A output buffer containing a [[#GattService]], an u32, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], returns an output bool. |
| | | |
− | The u32 is the same as the param for [[#BleDisconnect]]. | + | 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 [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. | | Same as [[#GetGattServices]] except this only returns the [[#GattService]] which matches the input [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]]. |
| | | |
| == GetGattIncludedServices == | | == GetGattIncludedServices == |
− | Takes a type-0x6 output buffer containing an array of [[#GattService]], an u16, an u32, returns an output u8. | + | Takes a type-0x6 output buffer containing an array of [[#GattService]], an u16 ServiceHandle, an u32, 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 333: |
Line 359: |
| | | |
| == GetBelongingService == | | == GetBelongingService == |
− | Takes a type-0x1A output buffer containing a [[#GattService]], an u16, an u32, returns an output u8 total_out. | + | Takes a type-0x1A output buffer containing a [[#GattService]], an u16 AttributeHandle, an u32, returns an output bool. |
| | | |
− | The u32 is the same as the param for [[#BleDisconnect]]. | + | 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]]. | | This is similar to [[#GetGattIncludedServices]] except this only returns 1 [[#GattService]]. |
| | | |
| == GetGattCharacteristics == | | == GetGattCharacteristics == |
− | Takes a type-0x6 output buffer containing an array of [[#GattCharacteristic]], an u16, an u32, returns an output u8 total_out. | + | Takes a type-0x6 output buffer containing an array of [[#GattCharacteristic]], an u16 ServiceHandle, an u32, 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. |
| + | |
| + | The u16 controls which [[#GattCharacteristic]] entries to return. |
| | | |
| == GetGattDescriptors == | | == GetGattDescriptors == |
− | Takes a type-0x6 output buffer containing an array of [[#GattDescriptor]], an u16, an u32, returns an output u8 total_out. | + | Takes a type-0x6 output buffer containing an array of [[#GattDescriptor]], an u16 CharHandle, an u32, 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. |
| + | |
| + | The u16 controls which [[#GattDescriptor]] entries to return. |
| | | |
| == AcquireBleMtuConfigEvent == | | == AcquireBleMtuConfigEvent == |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| == ConfigureBleMtu == | | == ConfigureBleMtu == |
− | Takes an u16, an u32, no output. | + | Takes an u16 mtu, an u32, 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, returns an output u16. | + | Takes an u32, 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]]. |
Line 382: |
Line 412: |
| == Cmd61 == | | == Cmd61 == |
| Takes a 0x44-byte input struct, no output. | | Takes a 0x44-byte input struct, 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]]. |
| + | |
| + | The input struct has the following structure: |
| + | |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Offset |
| + | ! Size |
| + | ! Description |
| + | |- |
| + | | 0x0 || 0x10 * 4 || Array of the below struct. |
| + | |- |
| + | | 0x40 || 0x4 || s32 count, for the array at +0. |
| + | |} |
| + | |
| + | Struct for the above array: |
| + | |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Offset |
| + | ! Size |
| + | ! Description |
| + | |- |
| + | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] |
| + | |- |
| + | | 0x6 || 0x6 || Unused |
| + | |- |
| + | | 0xC || 0x1 || Used to determine data which is then used for [[Bluetooth_Driver_services#BleConnectionParameter|BleConnectionParameter]]. |
| + | |- |
| + | | 0xD || 0x3 || Padding |
| + | |} |
| | | |
| == Cmd62 == | | == Cmd62 == |
| Takes an input bool, no output. | | Takes an input bool, no output. |
| + | |
| + | Sends a request which is handled as follows: writes the flag into state if needed. |
| | | |
| == Cmd63 == | | == Cmd63 == |
| No input, returns an output bool. | | No input, returns an output bool. |
| + | |
| + | This gets the flag used by [[#Cmd62]]. |
| | | |
| == Cmd64 == | | == Cmd64 == |
| 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 396: |
Line 465: |
| | | |
| 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. |
| + | |
| + | [12.0.0+] Cmds input/output were changed / cmdids were moved around. |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 401: |
Line 472: |
| ! Cmd || Name | | ! Cmd || Name |
| |- | | |- |
− | | 0 || AcquireDiscoveryEvent | + | | 0 || [[#AcquireDiscoveryEvent]] |
| + | |- |
| + | | 1 || [[#StartDiscovery]] |
| |- | | |- |
− | | 1 || StartDiscovery | + | | 2 || [[#CancelDiscovery]] |
| |- | | |- |
− | | 2 || CancelDiscovery | + | | 3 || [[#GetDeviceProperty]] |
| |- | | |- |
− | | 3 || GetDeviceProperty | + | | 4 || [[#CreateBond]] |
| |- | | |- |
− | | 4 || CreateBond | + | | 5 || [[#CancelBond]] |
| |- | | |- |
− | | 5 || CancelBond | + | | 6 || [[#SetTsiMode]] |
| |- | | |- |
− | | 6 || SetTsiMode | + | | 7 || [[#GeneralTest]] |
| |- | | |- |
− | | 7 || GeneralTest | + | | 8 || [[#HidConnect]] |
| |- | | |- |
− | | 8 || HidConnect | + | | 9 || [5.0.0+] [[#GeneralGet]] |
| |- | | |- |
− | | 9 || [5.0.0+] GeneralGet | + | | 10 || [5.1.0+] [[#GetGattClientDisconnectionReason]] |
| |- | | |- |
− | | 10 || [5.1.0+] GetGattClientDisconnectionReason | + | | 11 || [5.1.0+] [[#GetBleConnectionParameter]] |
| |- | | |- |
− | | 11 || [5.1.0+] GetBleConnectionParameter | + | | 12 || [5.1.0+] [[#GetBleConnectionParameterRequest]] |
| |- | | |- |
− | | 12 || [5.1.0+] GetBleConnectionParameterRequest | + | | 13 || [12.0.0+] |
| |} | | |} |
| | | |
− | [3.0.0+] RegisterSystemEventForDiscovery now returns an output u8. | + | == 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]]. |
| + | |
| + | == CreateBond == |
| + | Takes an input [[#BdAddress|BdAddress]], no 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. |
| + | |
| + | == 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 495: |
Line 615: |
| | | |
| === AcquireRadioEvent === | | === AcquireRadioEvent === |
− | No input, returns an output bool and handle. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| === AcquireGamepadPairingEvent === | | === AcquireGamepadPairingEvent === |
− | No input, returns an output bool and handle. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
| === IsGamepadPairingStarted === | | === IsGamepadPairingStarted === |
Line 593: |
Line 713: |
| | | |
| === AcquireBleScanEvent === | | === AcquireBleScanEvent === |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
− | sdknso will Abort if the output u8 is value 0.
| + | This is similar to the [[#AcquireBleScanEvent|btm]] cmd. |
| | | |
| === GetBleScanFilterParameter === | | === GetBleScanFilterParameter === |
Line 648: |
Line 768: |
| | | |
| === AcquireBleConnectionEvent === | | === AcquireBleConnectionEvent === |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | 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. |
− |
| |
− | sdknso will Abort if the output u8 is value 0.
| |
| | | |
| === 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 670: |
Line 788: |
| | | |
| === AcquireBlePairingEvent === | | === AcquireBlePairingEvent === |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | 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. |
− |
| |
− | sdknso will Abort if the output u8 is value 0.
| |
| | | |
| === BlePairDevice === | | === BlePairDevice === |
Line 687: |
Line 803: |
| | | |
| === 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. |
| | | |
| === AcquireBleServiceDiscoveryEvent === | | === AcquireBleServiceDiscoveryEvent === |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | 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 822: |
| 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. | | 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. |
| | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]]. The max array entries is 100.
| + | 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]], returns an output u8 total_out. | + | 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. |
− | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]].
| |
| | | |
− | Same as [[#GetGattServices_2|GetGattServices]] except this only returns the [[#GattService]] which matches the input [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]].
| + | 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]], returns an output u8. | | 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. |
| | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]]. The max array entries is 100.
| + | This is similar to the [[#GetGattIncludedServices|btm]] cmd. |
− | | |
− | Same as [[#GetGattServices_2|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. However, a sdknso func which calls the nn::btm::* func for this expects this u8 to be set. | | 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 === | | === GetBelongingGattService === |
− | Takes a PID, a type-0x1A output buffer containing a [[#GattService]], an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u8 total_out. | + | 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. |
− | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]].
| |
| | | |
− | This is similar to [[#GetGattIncludedServices_2|GetGattIncludedServices]] except this only returns 1 [[#GattService]]. | + | 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]], returns an output u8 total_out. | | 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. |
| | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]]. The max array entries is 100.
| + | This is similar to the [[#GetGattCharacteristics|btm]] cmd. |
− | | |
− | The u16 controls which [[#GattCharacteristic]] entries to return.
| |
| | | |
| === 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]], returns an output u8 total_out. | | 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. |
| | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]]. The max array entries is 100.
| + | This is similar to the [[#GetGattDescriptors|btm]] cmd. |
− | | |
− | The u16 controls which [[#GattDescriptor]] entries to return.
| |
| | | |
| === AcquireBleMtuConfigEvent === | | === AcquireBleMtuConfigEvent === |
− | No input, returns an output u8 and an Event handle with EventClearMode=1. | + | No input, returns an output bool and an Event handle with EventClearMode=1. |
| | | |
− | sdknso will Abort if the output u8 is value 0.
| + | This is similar to the [[#AcquireBleMtuConfigEvent|btm]] cmd. |
| | | |
| === ConfigureBleMtu === | | === ConfigureBleMtu === |
| Takes a PID, an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. | | Takes a PID, an u16, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. |
| | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]].
| + | This is similar to the [[#ConfigureBleMtu|btm]] cmd. |
| | | |
− | sdknso will Abort if the user-specified u16 is <0x18 or >0x200. | + | sdknso will Abort if the user-specified u16 is <0x18 or >0x200 (this doesn't apply to the [[#ConfigureBleMtu|btm]] cmd). |
| | | |
| === GetBleMtu === | | === GetBleMtu === |
| Takes a PID, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u16. | | Takes a PID, an u32, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u16. |
| | | |
− | The u32 is handled the same as [[#BleDisconnect_2|BleDisconnect]].
| + | This is similar to the [[#GetBleMtu|btm]] cmd. |
| | | |
| === RegisterBleGattDataPath === | | === RegisterBleGattDataPath === |
| Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. | | Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. |
| + | |
| + | This is similar to the [[#RegisterBleGattDataPath|btm]] cmd. |
| | | |
| === UnregisterBleGattDataPath === | | === UnregisterBleGattDataPath === |
| Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. | | Takes a PID, a [[#BleDataPath]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. |
| + | |
| + | 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 = |
| + | 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 |
| + | |} |
| + | |
| + | = 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 |
| + | |} |
| | | |
| = HostDeviceProperty = | | = HostDeviceProperty = |
| This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct. | | This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct. |
| + | |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Offset |
| + | ! Size |
| + | ! Description |
| + | |- |
| + | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] |
| + | |- |
| + | | 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]] |
| + | |- |
| + | | 0x9 || 0x20 || [[#BdName|BdName]] |
| + | |- |
| + | | 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 || 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]] |
| + | |} |
| + | |
| + | = 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 = |
| This is "nn::btm::DeviceInfoList". This is a 0x3C4-byte struct. | | This is "nn::btm::DeviceInfoList". This is a 0x3C4-byte struct. |
| | | |
− | = DeviceInfo = | + | {| class="wikitable" border="1" |
− | This is "nn::btm::DeviceInfo". This is a 0x60-byte struct. | + | |- |
| + | ! Offset |
| + | ! Size |
| + | ! Description |
| + | |- |
| + | | 0x0 || 0x1 || DeviceCount |
| + | |- |
| + | | 0x1 || 0x3 || Reserved |
| + | |- |
| + | | 0x4 || 0xA * 0x60 || 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]] |
| + | |} |
| | | |
| = 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 805: |
Line 1,163: |
| | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | | | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] |
| |- | | |- |
− | | 0x18 || 0x2 || | + | | 0x18 || 0x2 || Handle |
| |- | | |- |
− | | 0x1A || 0x4 || | + | | 0x1A || 0x2 || |
| |- | | |- |
− | | 0x1E || 0x2 || | + | | 0x1C || 0x2 || InstanceId |
| |- | | |- |
− | | 0x20 || 0x1 || | + | | 0x1E || 0x2 || EndGroupHandle |
| + | |- |
| + | | 0x20 || 0x1 || PrimaryService flag |
| |- | | |- |
| | 0x21 || 0x3 || Padding | | | 0x21 || 0x3 || Padding |
Line 818: |
Line 1,178: |
| = 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 837: |
Line 1,233: |
| | 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]] |