libnx  v4.8.0
btm_types.h
Go to the documentation of this file.
1 /**
2  * @file btm_types.h
3  * @brief btm service types.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 
10 /// BtmState
11 typedef enum {
12  BtmState_NotInitialized = 0, ///< NotInitialized
13  BtmState_RadioOff = 1, ///< RadioOff
14  BtmState_MinorSlept = 2, ///< MinorSlept
15  BtmState_RadioOffMinorSlept = 3, ///< RadioOffMinorSlept
16  BtmState_Slept = 4, ///< Slept
17  BtmState_RadioOffSlept = 5, ///< RadioOffSlept
18  BtmState_Initialized = 6, ///< Initialized
19  BtmState_Working = 7, ///< Working
20 } BtmState;
21 
22 /// BluetoothMode
23 typedef enum {
24  BtmBluetoothMode_Dynamic2Slot = 0, ///< Dynamic2Slot
25  BtmBluetoothMode_StaticJoy = 1, ///< StaticJoy
27 
28 /// WlanMode
29 typedef enum {
30  BtmWlanMode_Local4 = 0, ///< Local4
31  BtmWlanMode_Local8 = 1, ///< Local8
32  BtmWlanMode_None = 2, ///< None
33 } BtmWlanMode;
34 
35 /// TsiMode
36 typedef enum {
37  BtmTsiMode_0Fd3Td3Si10 = 0, ///< 0Fd3Td3Si10
38  BtmTsiMode_1Fd1Td1Si5 = 1, ///< 1Fd1Td1Si5
39  BtmTsiMode_2Fd1Td3Si10 = 2, ///< 2Fd1Td3Si10
40  BtmTsiMode_3Fd1Td5Si15 = 3, ///< 3Fd1Td5Si15
41  BtmTsiMode_4Fd3Td1Si10 = 4, ///< 4Fd3Td1Si10
42  BtmTsiMode_5Fd3Td3Si15 = 5, ///< 5Fd3Td3Si15
43  BtmTsiMode_6Fd5Td1Si15 = 6, ///< 6Fd5Td1Si15
44  BtmTsiMode_7Fd1Td3Si15 = 7, ///< 7Fd1Td3Si15
45  BtmTsiMode_8Fd3Td1Si15 = 8, ///< 8Fd3Td1Si15
46  BtmTsiMode_9Fd1Td1Si10 = 9, ///< 9Fd1Td1Si10
47  BtmTsiMode_10Fd1Td1Si15 = 10, ///< 10Fd1Td1Si15
48  BtmTsiMode_Active = 255, ///< Active
49 } BtmTsiMode;
50 
51 /// SlotMode
52 typedef enum {
53  BtmSlotMode_2 = 0, ///< 2
54  BtmSlotMode_4 = 1, ///< 4
55  BtmSlotMode_6 = 2, ///< 6
56  BtmSlotMode_Active = 3, ///< Active
57 } BtmSlotMode;
58 
59 /// Profile
60 typedef enum {
61  BtmProfile_None = 0, ///< None
62  BtmProfile_Hid = 1, ///< Hid
63  BtmProfile_Audio = 2, ///< [13.0.0+] Audio
64 } BtmProfile;
65 
66 /// BdName
67 typedef struct {
68  char name[0x20]; ///< Name string.
69 } BtmBdName;
70 
71 /// ClassOfDevice
72 typedef struct {
73  u8 class_of_device[0x3]; ///< ClassOfDevice
75 
76 /// LinkKey
77 typedef struct {
78  u8 link_key[0x10]; ///< LinkKey
79 } BtmLinkKey;
80 
81 /// HidDeviceInfo
82 typedef struct {
83  u16 vid; ///< Vid
84  u16 pid; ///< Pid
86 
87 /// HostDeviceProperty
88 typedef struct {
89  union {
90  struct {
91  BtdrvAddress addr; ///< Same as BtdrvAdapterProperty::addr.
92  BtmClassOfDevice class_of_device; ///< Same as BtdrvAdapterProperty::class_of_device.
93  BtmBdName name; ///< Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
94  u8 feature_set; ///< Same as BtdrvAdapterProperty::feature_set.
95  } v1; ///< [1.0.0-12.1.0]
96 
97  struct {
98  BtdrvAddress addr; ///< Same as BtdrvAdapterProperty::addr.
99  BtmClassOfDevice class_of_device; ///< Same as BtdrvAdapterProperty::class_of_device.
100  char name[0xF9]; ///< Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
101  u8 feature_set; ///< Same as BtdrvAdapterProperty::feature_set.
102  } v13; ///< [13.0.0+]
103  };
105 
106 /// BtmConnectedDevice [1.0.0-12.1.0]
107 typedef struct {
108  BtdrvAddress address;
109  u8 pad[2];
110  u32 unk_x8;
111  char name[0x20];
112  u8 unk_x2C[0x1C];
113  u16 vid;
114  u16 pid;
115  u8 unk_x4C[0x20];
117 
118 /// BtmConnectedDevice [13.0.0+]
119 typedef struct {
120  BtdrvAddress address;
121  u8 pad[2];
122  u32 profile; ///< \ref BtmProfile
123  u8 unk_xC[0x40];
124  char name[0x20];
125  u8 unk_x6C[0xD9];
126  u8 pad2[3];
128 
129 /// DeviceCondition [1.0.0-5.0.2]
130 typedef struct {
131  u32 unk_x0;
132  u32 unk_x4;
133  u8 unk_x8;
134  u8 unk_x9;
135  u8 max_count;
136  u8 connected_count;
137  BtmConnectedDeviceV1 devices[8];
139 
140 /// DeviceCondition [5.1.0-7.0.1]
141 typedef struct {
142  u32 unk_x0;
143  u32 unk_x4;
144  u8 unk_x8;
145  u8 unk_x9[2];
146  u8 max_count;
147  u8 connected_count;
148  u8 pad[3];
149  BtmConnectedDeviceV1 devices[8];
151 
152 /// DeviceCondition [8.0.0-8.1.1]
153 typedef struct {
154  u32 unk_x0;
155  u32 unk_x4;
156  u8 unk_x8;
157  u8 unk_x9;
158  u8 max_count;
159  u8 connected_count;
160  BtmConnectedDeviceV1 devices[8];
162 
163 /// DeviceCondition [9.0.0-12.1.0]
164 typedef struct {
165  u32 unk_x0;
166  u8 unk_x4;
167  u8 unk_x5;
168  u8 max_count;
169  u8 connected_count;
170  BtmConnectedDeviceV1 devices[8];
172 
173 /// DeviceCondition [1.0.0-12.1.0]
174 typedef union {
180 
181 /// DeviceSlotMode
182 typedef struct {
183  BtdrvAddress addr; ///< \ref BtdrvAddress
184  u8 reserved[2]; ///< Reserved
185  u32 slot_mode; ///< \ref BtmSlotMode
187 
188 /// DeviceSlotModeList
189 typedef struct {
190  u8 device_count; ///< DeviceCount
191  u8 reserved[3]; ///< Reserved
192  BtmDeviceSlotMode devices[8]; ///< Array of \ref BtmDeviceSlotMode with the above count.
194 
195 /// DeviceInfo [1.0.0-12.1.0]
196 typedef struct {
197  BtdrvAddress addr; ///< \ref BtdrvAddress
198  BtmClassOfDevice class_of_device; ///< ClassOfDevice
199  BtmBdName name; ///< BdName
200  BtmLinkKey link_key; ///< LinkKey
201  u8 reserved[3]; ///< Reserved
202  u32 profile; ///< \ref BtmProfile
203  union {
204  u8 data[0x4]; ///< Empty (Profile = None)
205  BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid)
206  } profile_info;
207  u8 reserved2[0x1C]; ///< Reserved
209 
210 /// DeviceInfo [13.0.0+]
211 typedef struct {
212  BtdrvAddress addr; ///< \ref BtdrvAddress
213  BtmClassOfDevice class_of_device; ///< ClassOfDevice
214  BtmLinkKey link_key; ///< LinkKey
215  u8 reserved[3]; ///< Reserved
216  u32 profile; ///< \ref BtmProfile
217  union {
218  u8 data[0x4]; ///< Empty (Profile = None)
219  BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid)
220  } profile_info;
221  u8 reserved2[0x1C]; ///< Reserved
222  char name[0xF9]; ///< Name
223  u8 pad[3]; ///< Padding
225 
226 /// DeviceInfo [1.0.0-13.0.0]
227 typedef union {
228  BtmDeviceInfoV1 v1;
229  BtmDeviceInfoV13 v13;
230 } BtmDeviceInfo;
231 
232 /// DeviceInfoList
233 typedef struct {
234  u8 device_count; ///< DeviceCount
235  u8 reserved[3]; ///< Reserved
236  BtmDeviceInfoV1 devices[10]; ///< Array of \ref BtmDeviceInfoV1 with the above count.
238 
239 /// DeviceProperty
240 typedef struct {
241  BtdrvAddress addr; ///< \ref BtdrvAddress
242  BtmClassOfDevice class_of_device; ///< ClassOfDevice
243  BtmBdName name; ///< BdName
245 
246 /// DevicePropertyList
247 typedef struct {
248  u8 device_count; ///< DeviceCount
249  BtmDeviceProperty devices[15]; ///< Array of \ref BtmDeviceProperty.
251 
252 /// ZeroRetransmissionList
253 typedef struct {
254  u8 enabled_report_id_count; ///< EnabledReportIdCount
255  u8 enabled_report_id[0x10]; ///< Array of EnabledReportId.
257 
258 /// GattClientConditionList
259 typedef struct {
260  u8 unk_x0[0x74]; ///< Unknown
262 
263 /// GattService
264 typedef struct {
265  u8 unk_x0[0x4]; ///< Unknown
266  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
267  u16 handle; ///< Handle
268  u8 unk_x1A[0x2]; ///< Unknown
269  u16 instance_id; ///< InstanceId
270  u16 end_group_handle; ///< EndGroupHandle
271  u8 primary_service; ///< PrimaryService
272  u8 pad[3]; ///< Padding
274 
275 /// GattCharacteristic
276 typedef struct {
277  u8 unk_x0[0x4]; ///< Unknown
278  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
279  u16 handle; ///< Handle
280  u8 unk_x1A[0x2]; ///< Unknown
281  u16 instance_id; ///< InstanceId
282  u8 properties; ///< Properties
283  u8 unk_x1F[0x5]; ///< Unknown
285 
286 /// GattDescriptor
287 typedef struct {
288  u8 unk_x0[0x4]; ///< Unknown
289  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
290  u16 handle; ///< Handle
291  u8 unk_x1A[0x6]; ///< Unknown
293 
294 /// BleDataPath
295 typedef struct {
296  u8 unk_x0; ///< Unknown
297  u8 pad[3]; ///< Padding
298  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
300 
BtmBluetoothMode
BluetoothMode.
Definition: btm_types.h:23
@ BtmBluetoothMode_Dynamic2Slot
Dynamic2Slot.
Definition: btm_types.h:24
@ BtmBluetoothMode_StaticJoy
StaticJoy.
Definition: btm_types.h:25
BtmProfile
Profile.
Definition: btm_types.h:60
@ BtmProfile_Hid
Hid.
Definition: btm_types.h:62
@ BtmProfile_Audio
[13.0.0+] Audio
Definition: btm_types.h:63
@ BtmProfile_None
None.
Definition: btm_types.h:61
BtmSlotMode
SlotMode.
Definition: btm_types.h:52
@ BtmSlotMode_6
6
Definition: btm_types.h:55
@ BtmSlotMode_Active
Active.
Definition: btm_types.h:56
@ BtmSlotMode_2
2
Definition: btm_types.h:53
@ BtmSlotMode_4
4
Definition: btm_types.h:54
BtmTsiMode
TsiMode.
Definition: btm_types.h:36
@ BtmTsiMode_8Fd3Td1Si15
8Fd3Td1Si15
Definition: btm_types.h:45
@ BtmTsiMode_2Fd1Td3Si10
2Fd1Td3Si10
Definition: btm_types.h:39
@ BtmTsiMode_9Fd1Td1Si10
9Fd1Td1Si10
Definition: btm_types.h:46
@ BtmTsiMode_6Fd5Td1Si15
6Fd5Td1Si15
Definition: btm_types.h:43
@ BtmTsiMode_7Fd1Td3Si15
7Fd1Td3Si15
Definition: btm_types.h:44
@ BtmTsiMode_5Fd3Td3Si15
5Fd3Td3Si15
Definition: btm_types.h:42
@ BtmTsiMode_1Fd1Td1Si5
1Fd1Td1Si5
Definition: btm_types.h:38
@ BtmTsiMode_10Fd1Td1Si15
10Fd1Td1Si15
Definition: btm_types.h:47
@ BtmTsiMode_4Fd3Td1Si10
4Fd3Td1Si10
Definition: btm_types.h:41
@ BtmTsiMode_0Fd3Td3Si10
0Fd3Td3Si10
Definition: btm_types.h:37
@ BtmTsiMode_Active
Active.
Definition: btm_types.h:48
@ BtmTsiMode_3Fd1Td5Si15
3Fd1Td5Si15
Definition: btm_types.h:40
BtmState
BtmState.
Definition: btm_types.h:11
@ BtmState_Slept
Slept.
Definition: btm_types.h:16
@ BtmState_Working
Working.
Definition: btm_types.h:19
@ BtmState_MinorSlept
MinorSlept.
Definition: btm_types.h:14
@ BtmState_NotInitialized
NotInitialized.
Definition: btm_types.h:12
@ BtmState_RadioOffMinorSlept
RadioOffMinorSlept.
Definition: btm_types.h:15
@ BtmState_Initialized
Initialized.
Definition: btm_types.h:18
@ BtmState_RadioOff
RadioOff.
Definition: btm_types.h:13
@ BtmState_RadioOffSlept
RadioOffSlept.
Definition: btm_types.h:17
BtmWlanMode
WlanMode.
Definition: btm_types.h:29
@ BtmWlanMode_None
None.
Definition: btm_types.h:32
@ BtmWlanMode_Local4
Local4.
Definition: btm_types.h:30
@ BtmWlanMode_Local8
Local8.
Definition: btm_types.h:31
Address.
Definition: btdrv_types.h:214
GattAttributeUuid.
Definition: btdrv_types.h:370
BdName.
Definition: btm_types.h:67
BleDataPath.
Definition: btm_types.h:295
u8 unk_x0
Unknown.
Definition: btm_types.h:296
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:298
ClassOfDevice.
Definition: btm_types.h:72
BtmConnectedDevice [13.0.0+].
Definition: btm_types.h:119
u32 profile
BtmProfile
Definition: btm_types.h:122
BtmConnectedDevice [1.0.0-12.1.0].
Definition: btm_types.h:107
DeviceCondition [1.0.0-5.0.2].
Definition: btm_types.h:130
DeviceCondition [5.1.0-7.0.1].
Definition: btm_types.h:141
DeviceCondition [8.0.0-8.1.1].
Definition: btm_types.h:153
DeviceCondition [9.0.0-12.1.0].
Definition: btm_types.h:164
DeviceInfoList.
Definition: btm_types.h:233
u8 device_count
DeviceCount.
Definition: btm_types.h:234
DeviceInfo [13.0.0+].
Definition: btm_types.h:211
BtmLinkKey link_key
LinkKey.
Definition: btm_types.h:214
u32 profile
BtmProfile
Definition: btm_types.h:216
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:212
BtmHidDeviceInfo hid_device_info
BtmHidDeviceInfo (Profile = Hid)
Definition: btm_types.h:219
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:213
DeviceInfo [1.0.0-12.1.0].
Definition: btm_types.h:196
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:198
BtmBdName name
BdName.
Definition: btm_types.h:199
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:197
u32 profile
BtmProfile
Definition: btm_types.h:202
BtmLinkKey link_key
LinkKey.
Definition: btm_types.h:200
BtmHidDeviceInfo hid_device_info
BtmHidDeviceInfo (Profile = Hid)
Definition: btm_types.h:205
DevicePropertyList.
Definition: btm_types.h:247
u8 device_count
DeviceCount.
Definition: btm_types.h:248
DeviceProperty.
Definition: btm_types.h:240
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:241
BtmBdName name
BdName.
Definition: btm_types.h:243
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:242
DeviceSlotModeList.
Definition: btm_types.h:189
u8 device_count
DeviceCount.
Definition: btm_types.h:190
DeviceSlotMode.
Definition: btm_types.h:182
u32 slot_mode
BtmSlotMode
Definition: btm_types.h:185
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:183
GattCharacteristic.
Definition: btm_types.h:276
u8 properties
Properties.
Definition: btm_types.h:282
u16 handle
Handle.
Definition: btm_types.h:279
u16 instance_id
InstanceId.
Definition: btm_types.h:281
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:278
GattClientConditionList.
Definition: btm_types.h:259
GattDescriptor.
Definition: btm_types.h:287
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:289
u16 handle
Handle.
Definition: btm_types.h:290
GattService.
Definition: btm_types.h:264
u16 handle
Handle.
Definition: btm_types.h:267
u16 instance_id
InstanceId.
Definition: btm_types.h:269
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:266
u16 end_group_handle
EndGroupHandle.
Definition: btm_types.h:270
u8 primary_service
PrimaryService.
Definition: btm_types.h:271
HidDeviceInfo.
Definition: btm_types.h:82
u16 vid
Vid.
Definition: btm_types.h:83
u16 pid
Pid.
Definition: btm_types.h:84
HostDeviceProperty.
Definition: btm_types.h:88
BtmClassOfDevice class_of_device
Same as BtdrvAdapterProperty::class_of_device.
Definition: btm_types.h:92
u8 feature_set
Same as BtdrvAdapterProperty::feature_set.
Definition: btm_types.h:94
BtdrvAddress addr
Same as BtdrvAdapterProperty::addr.
Definition: btm_types.h:91
BtmBdName name
Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
Definition: btm_types.h:93
LinkKey.
Definition: btm_types.h:77
ZeroRetransmissionList.
Definition: btm_types.h:253
u8 enabled_report_id_count
EnabledReportIdCount.
Definition: btm_types.h:254
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
DeviceCondition [1.0.0-12.1.0].
Definition: btm_types.h:174
DeviceInfo [1.0.0-13.0.0].
Definition: btm_types.h:227