Difference between revisions of "BTM services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 310: Line 310:
  
 
=== GetBleScanFilterParameter ===
 
=== GetBleScanFilterParameter ===
Takes an input u16, returns a [[#BleAdvertisePacketParameter]].
+
Takes an input u16, returns a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]].
  
 
=== GetBleScanFilterParameter2 ===
 
=== GetBleScanFilterParameter2 ===
Takes an input u16, returns a [[#GattAttributeUuid]].
+
Takes an input u16, returns a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]].
  
 
=== StartBleScanForGeneral ===
 
=== StartBleScanForGeneral ===
Takes a PID, a [[#BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
+
Takes a PID, a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
  
 
=== StopBleScanForGeneral ===
 
=== StopBleScanForGeneral ===
Line 322: Line 322:
  
 
=== GetBleScanResultsForGeneral ===
 
=== GetBleScanResultsForGeneral ===
Takes a PID, a type-0x6 output buffer containing an array of [[#BleScanResult]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u8.
+
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.
  
 
=== StartBleScanForPaired ===
 
=== StartBleScanForPaired ===
Takes a PID, a [[#BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
+
Takes a PID, a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
  
 
=== StopBleScanForPaired ===
 
=== StopBleScanForPaired ===
Line 331: Line 331:
  
 
=== StartBleScanForSmartDevice ===
 
=== StartBleScanForSmartDevice ===
Takes a PID, a [[#GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
+
Takes a PID, a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
  
 
=== StopBleScanForSmartDevice ===
 
=== StopBleScanForSmartDevice ===
Line 337: Line 337:
  
 
=== GetBleScanResultsForSmartDevice ===
 
=== GetBleScanResultsForSmartDevice ===
Takes a PID, a type-0x6 output buffer containing an array of [[#BleScanResult]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u8.
+
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.
  
 
=== AcquireBleConnectionEvent ===
 
=== AcquireBleConnectionEvent ===
Line 345: Line 345:
  
 
=== BleConnect ===
 
=== BleConnect ===
Takes a PID, an [[#Bluetooth_Driver_services#Address|Address]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
+
Takes a PID, an [[Bluetooth_Driver_services#Address|Address]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output.
  
 
=== BleDisconnect ===
 
=== BleDisconnect ===
Line 351: Line 351:
  
 
=== BleGetConnectionState ===
 
=== BleGetConnectionState ===
Takes a PID, a type-0xA output buffer containing an array of [[#BleConnectionInfo]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u8.
+
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.
  
 
=== AcquireBlePairingEvent ===
 
=== AcquireBlePairingEvent ===
Line 359: Line 359:
  
 
=== BlePairDevice ===
 
=== BlePairDevice ===
Takes an input [[#BleAdvertisePacketParameter]] and an u32, no output.
+
Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32, no output.
  
 
=== BleUnPairDevice ===
 
=== BleUnPairDevice ===
Takes an input [[#BleAdvertisePacketParameter]] and an u32, no output.
+
Takes an input [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]] and an u32, no output.
  
 
=== BleUnPairDevice2 ===
 
=== BleUnPairDevice2 ===
Takes an input [[#Bluetooth_Driver_services#Address|Address]] and a [[#BleAdvertisePacketParameter]], no output.
+
Takes an input [[Bluetooth_Driver_services#Address|Address]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output.
  
 
=== BleGetPairedDevices ===
 
=== BleGetPairedDevices ===
Takes a type-0xA output buffer containing an array of [[#Bluetooth_Driver_services#Address|Address]], a [[#BleAdvertisePacketParameter]], returns an output u8.
+
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.
  
 
=== AcquireBleServiceDiscoveryEvent ===
 
=== AcquireBleServiceDiscoveryEvent ===
Line 379: Line 379:
  
 
=== GetGattService ===
 
=== GetGattService ===
Takes a PID, a type-0x1A output buffer containing a [[#GattService]], an u32, a [[#GattAttributeUuid]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], returns an output u8.
+
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.
  
 
=== GetGattIncludedServices ===
 
=== GetGattIncludedServices ===
Line 411: Line 411:
 
=== 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.
 
= BleAdvertisePacketParameter =
 
This is "nn::bluetooth::BleAdvertisePacketParameter". This is a 8-byte struct with 1-byte alignment.
 
 
= GattAttributeUuid =
 
This is "nn::bluetooth::GattAttributeUuid". This is a 0x14-byte struct with 4-byte alignment.
 
 
= BleScanResult =
 
This is "nn::bluetooth::BleScanResult". This is a 0x148-byte struct.
 
 
= BleConnectionInfo =
 
This is "nn::bluetooth::BleConnectionInfo". This is a 0xC-byte struct.
 
  
 
= GattService =
 
= GattService =

Revision as of 16:51, 30 July 2020

btm

This is "nn::btm::IBtm".

Support for "nn::btm::*" was added to sdknso with 6.x.

Cmd Name
0 GetState
1 GetHostDeviceProperty
2 AcquireDeviceConditionEvent
3 GetDeviceCondition
4 SetBurstMode
5 SetSlotMode
6 [1.0.0-8.1.0] SetBluetoothMode
7 SetWlanMode
8 AcquireDeviceInfoEvent
9 GetDeviceInfo
10 AddDeviceInfo
11 RemoveDeviceInfo
12 IncreaseDeviceInfoOrder
13 LlrNotify
14 EnableRadio
15 DisableRadio
16 HidDisconnect
17 HidSetRetransmissionMode
18 [2.0.0+] AcquireAwakeReqEvent
19 [4.0.0+] AcquireLlrStateEvent
20 [4.0.0+] IsLlrStarted
21 [4.0.0+] EnableSlotSaving
22 [5.0.0+] ProtectDeviceInfo
23 [5.0.0+] AcquireBleScanEvent
24 [5.0.0+] GetBleScanParameterGeneral
25 [5.0.0+] GetBleScanParameterSmartDevice
26 [5.0.0+] StartBleScanForGeneral
27 [5.0.0+] StopBleScanForGeneral
28 [5.0.0+] GetBleScanResultsForGeneral
29 [5.0.0+] StartBleScanForPairedDevice
30 [5.0.0+] StopBleScanForPairedDevice
31 [5.0.0+] StartBleScanForSmartDevice
32 [5.0.0+] StopBleScanForSmartDevice
33 [5.0.0+] GetBleScanResultsForSmartDevice
34 [5.0.0+] AcquireBleConnectionEvent
35 [5.0.0+] BleConnect
36 [5.0.0+] BleOverrideConnection
37 [5.0.0+] BleDisconnect
38 [5.0.0+] BleGetConnectionState
39 [5.0.0+] BleGetGattClientConditionList
40 [5.0.0+] AcquireBlePairingEvent
41 [5.0.0+] BlePairDevice
42 [5.0.0+] BleUnpairDeviceOnBoth
43 [5.1.0+] BleUnpairDevice
44 [5.1.0+] BleGetPairedAddresses
45 [5.1.0+] AcquireBleServiceDiscoveryEvent
46 [5.1.0+] GetGattServices
47 [5.1.0+] GetGattService
48 [5.1.0+] GetGattIncludedServices
49 [5.1.0+] GetBelongingService
50 [5.1.0+] GetGattCharacteristics
51 [5.1.0+] GetGattDescriptors
52 [5.1.0+] AcquireBleMtuConfigEvent
53 [5.1.0+] ConfigureBleMtu
54 [5.1.0+] GetBleMtu
55 [5.1.0+] RegisterBleGattDataPath
56 [5.1.0+] UnregisterBleGattDataPath
57 [5.1.0+] RegisterAppletResourceUserId
58 [5.1.0+] UnregisterAppletResourceUserId
59 [5.1.0+] SetAppletResourceUserId
60 [8.0.0+]
61 [8.0.0+]
62 [9.0.0+]
63 [9.0.0+]
64 [10.0.0+]

[3.0.0+] RegisterSystemEventForConnectedDeviceCondition, RegisterSystemEventForRegisteredDeviceInfo, and cmd18 now returns an output u8.

With [5.1.0+] cmds 24-42 were moved/replaced/etc (input/output changed).

[9.0.0+] Cmd13 now takes 0xC-bytes of input and no output, instead of 0x6-bytes of input.

btm:dbg

This is "nn::btm::IBtmDebug".

Cmd Name
0 AcquireDiscoveryEvent
1 StartDiscovery
2 CancelDiscovery
3 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

[3.0.0+] RegisterSystemEventForDiscovery now returns an output u8.

btm:sys

This is "nn::btm::IBtmSystem".

Cmd Name
0 GetCore

IBtmSystemCore

This is "nn::btm::IBtmSystemCore".

Cmd Name
0 StartGamepadPairing
1 CancelGamepadPairing
2 ClearGamepadPairingDatabase
3 GetPairedGamepadCount
4 EnableRadio
5 DisableRadio
6 GetRadioOnOff
7 [3.0.0+] AcquireRadioEvent
8 [3.0.0+] AcquireGamepadPairingEvent
9 [3.0.0+] IsGamepadPairingStarted

btm:u

This is "nn::btm::IBtmUser".

This was added with [5.0.0+].

Cmd Name
0 #GetCore

GetCore

No input, returns an output #IBtmUserCore.

IBtmUserCore

This is "nn::btm::IBtmUserCore".

Cmd Name
0 #AcquireBleScanEvent
1 #GetBleScanFilterParameter
2 #GetBleScanFilterParameter2
3 #StartBleScanForGeneral
4 #StopBleScanForGeneral
5 #GetBleScanResultsForGeneral
6 #StartBleScanForPaired
7 #StopBleScanForPaired
8 #StartBleScanForSmartDevice
9 #StopBleScanForSmartDevice
10 #GetBleScanResultsForSmartDevice
17 #AcquireBleConnectionEvent
18 #BleConnect
19 #BleDisconnect
20 #BleGetConnectionState
21 #AcquireBlePairingEvent
22 #BlePairDevice
23 #BleUnPairDevice
24 #BleUnPairDevice2
25 #BleGetPairedDevices
26 #AcquireBleServiceDiscoveryEvent
27 #GetGattServices
28 #GetGattService
29 #GetGattIncludedServices
30 #GetBelongingGattService
31 #GetGattCharacteristics
32 #GetGattDescriptors
33 #AcquireBleMtuConfigEvent
34 #ConfigureBleMtu
35 #GetBleMtu
36 #RegisterBleGattDataPath
37 #UnregisterBleGattDataPath

AcquireBleScanEvent

No input, returns an output Event handle with EventClearMode=1.

GetBleScanFilterParameter

Takes an input u16, returns a BleAdvertisePacketParameter.

GetBleScanFilterParameter2

Takes an input u16, returns a GattAttributeUuid.

StartBleScanForGeneral

Takes a PID, a BleAdvertisePacketParameter, an AppletResourceUserId, no output.

StopBleScanForGeneral

No input/output.

GetBleScanResultsForGeneral

Takes a PID, a type-0x6 output buffer containing an array of BleScanResult, an AppletResourceUserId, returns an output u8.

StartBleScanForPaired

Takes a PID, a BleAdvertisePacketParameter, an AppletResourceUserId, no output.

StopBleScanForPaired

No input/output.

StartBleScanForSmartDevice

Takes a PID, a GattAttributeUuid, an AppletResourceUserId, no output.

StopBleScanForSmartDevice

No input/output.

GetBleScanResultsForSmartDevice

Takes a PID, a type-0x6 output buffer containing an array of BleScanResult, an AppletResourceUserId, returns an output u8.

AcquireBleConnectionEvent

No input, returns an output u8 and an Event handle with EventClearMode=1.

sdknso will Abort if the output u8 is value 0.

BleConnect

Takes a PID, an Address, an AppletResourceUserId, no output.

BleDisconnect

Takes an input u32, no output.

BleGetConnectionState

Takes a PID, a type-0xA output buffer containing an array of BleConnectionInfo, an AppletResourceUserId, returns an output u8.

AcquireBlePairingEvent

No input, returns an output u8 and an Event handle with EventClearMode=1.

sdknso will Abort if the output u8 is value 0.

BlePairDevice

Takes an input BleAdvertisePacketParameter and an u32, no output.

BleUnPairDevice

Takes an input BleAdvertisePacketParameter and an u32, no output.

BleUnPairDevice2

Takes an input Address and a BleAdvertisePacketParameter, no output.

BleGetPairedDevices

Takes a type-0xA output buffer containing an array of Address, a BleAdvertisePacketParameter, returns an output u8.

AcquireBleServiceDiscoveryEvent

No input, returns an output u8 and an Event handle with EventClearMode=1.

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.

GetGattService

Takes a PID, a type-0x1A output buffer containing a #GattService, an u32, a GattAttributeUuid, an AppletResourceUserId, returns an output u8.

GetGattIncludedServices

Takes a PID, a type-0x6 output buffer containing an array of #GattService, an u16, an u32, an AppletResourceUserId, returns an output u8.

GetBelongingGattService

Takes a PID, a type-0x1A output buffer containing a #GattService, an u16, an u32, an AppletResourceUserId, returns an output u8.

GetGattCharacteristics

Takes a PID, a type-0x6 output buffer containing an array of #GattCharacteristic, an u16, an u32, an AppletResourceUserId, returns an output u8.

GetGattDescriptors

Takes a PID, a type-0x6 output buffer containing an array of #GattDescriptor, an u16, an u32, an AppletResourceUserId, returns an output u8.

AcquireBleMtuConfigEvent

No input, returns an output u8 and an Event handle with EventClearMode=1.

sdknso will Abort if the output u8 is value 0.

ConfigureBleMtu

Takes a PID, an u16, an u32, an AppletResourceUserId, no output.

sdknso will Abort if the user-specified u16 is <0x18 or >0x200.

GetBleMtu

Takes a PID, an u32, an AppletResourceUserId, returns an output u16.

RegisterBleGattDataPath

Takes a PID, a #BleDataPath, an AppletResourceUserId, no output.

UnregisterBleGattDataPath

Takes a PID, a #BleDataPath, an AppletResourceUserId, no output.

GattService

This is "nn::btm::user::GattService". This is a 0x24-byte struct.

GattCharacteristic

This is "nn::btm::user::GattCharacteristic". This is a 0x24-byte struct.

GattDescriptor

This is "nn::btm::user::GattDescriptor". This is a 0x20-byte struct.

BleDataPath

This is "nn::btm::user::BleDataPath". This is a 0x18-byte struct with 4-byte alignment.