libnx  v4.7.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;
64 
65 /// BdName
66 typedef struct {
67  char name[0x20]; ///< Name string.
68 } BtmBdName;
69 
70 /// ClassOfDevice
71 typedef struct {
72  u8 class_of_device[0x3]; ///< ClassOfDevice
74 
75 /// LinkKey
76 typedef struct {
77  u8 link_key[0x10]; ///< LinkKey
78 } BtmLinkKey;
79 
80 /// HidDeviceInfo
81 typedef struct {
82  u16 vid; ///< Vid
83  u16 pid; ///< Pid
85 
86 /// HostDeviceProperty
87 typedef struct {
88  union {
89  struct {
90  BtdrvAddress addr; ///< Same as BtdrvAdapterProperty::addr.
91  BtmClassOfDevice class_of_device; ///< Same as BtdrvAdapterProperty::class_of_device.
92  BtmBdName name; ///< Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
93  u8 feature_set; ///< Same as BtdrvAdapterProperty::feature_set.
94  } v1; ///< [1.0.0-12.1.0]
95 
96  struct {
97  BtdrvAddress addr; ///< Same as BtdrvAdapterProperty::addr.
98  BtmClassOfDevice class_of_device; ///< Same as BtdrvAdapterProperty::class_of_device.
99  char name[0xF9]; ///< Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
100  u8 feature_set; ///< Same as BtdrvAdapterProperty::feature_set.
101  } v13; ///< [13.0.0+]
102  };
104 
105 /// BtmConnectedDevice [1.0.0-12.1.0]
106 typedef struct {
107  BtdrvAddress address;
108  u8 pad[2];
109  u32 unk_x8;
110  char name[0x20];
111  u8 unk_x2C[0x1C];
112  u16 vid;
113  u16 pid;
114  u8 unk_x4C[0x20];
116 
117 /// BtmConnectedDevice [13.0.0+]
118 typedef struct {
119  BtdrvAddress address;
120  u8 pad[2];
121  u32 profile; ///< \ref BtmProfile
122  u8 unk_xC[0x40];
123  char name[0x20];
124  u8 unk_x6C[0xD9];
125  u8 pad2[3];
127 
128 /// DeviceCondition [1.0.0-5.0.2]
129 typedef struct {
130  u32 unk_x0;
131  u32 unk_x4;
132  u8 unk_x8;
133  u8 unk_x9;
134  u8 max_count;
135  u8 connected_count;
136  BtmConnectedDeviceV1 devices[8];
138 
139 /// DeviceCondition [5.1.0-7.0.1]
140 typedef struct {
141  u32 unk_x0;
142  u32 unk_x4;
143  u8 unk_x8;
144  u8 unk_x9[2];
145  u8 max_count;
146  u8 connected_count;
147  u8 pad[3];
148  BtmConnectedDeviceV1 devices[8];
150 
151 /// DeviceCondition [8.0.0-8.1.1]
152 typedef struct {
153  u32 unk_x0;
154  u32 unk_x4;
155  u8 unk_x8;
156  u8 unk_x9;
157  u8 max_count;
158  u8 connected_count;
159  BtmConnectedDeviceV1 devices[8];
161 
162 /// DeviceCondition [9.0.0-12.1.0]
163 typedef struct {
164  u32 unk_x0;
165  u8 unk_x4;
166  u8 unk_x5;
167  u8 max_count;
168  u8 connected_count;
169  BtmConnectedDeviceV1 devices[8];
171 
172 /// DeviceCondition [1.0.0-12.1.0]
173 typedef union {
179 
180 /// DeviceSlotMode
181 typedef struct {
182  BtdrvAddress addr; ///< \ref BtdrvAddress
183  u8 reserved[2]; ///< Reserved
184  u32 slot_mode; ///< \ref BtmSlotMode
186 
187 /// DeviceSlotModeList
188 typedef struct {
189  u8 device_count; ///< DeviceCount
190  u8 reserved[3]; ///< Reserved
191  BtmDeviceSlotMode devices[8]; ///< Array of \ref BtmDeviceSlotMode with the above count.
193 
194 /// DeviceInfo [1.0.0-12.1.0]
195 typedef struct {
196  BtdrvAddress addr; ///< \ref BtdrvAddress
197  BtmClassOfDevice class_of_device; ///< ClassOfDevice
198  BtmBdName name; ///< BdName
199  BtmLinkKey link_key; ///< LinkKey
200  u8 reserved[3]; ///< Reserved
201  u32 profile; ///< \ref BtmProfile
202  union {
203  u8 data[0x4]; ///< Empty (Profile = None)
204  BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid)
205  } profile_info;
206  u8 reserved2[0x1C]; ///< Reserved
208 
209 /// DeviceInfo [13.0.0+]
210 typedef struct {
211  BtdrvAddress addr; ///< \ref BtdrvAddress
212  BtmClassOfDevice class_of_device; ///< ClassOfDevice
213  BtmLinkKey link_key; ///< LinkKey
214  u8 reserved[3]; ///< Reserved
215  u32 profile; ///< \ref BtmProfile
216  union {
217  u8 data[0x4]; ///< Empty (Profile = None)
218  BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid)
219  } profile_info;
220  u8 reserved2[0x1C]; ///< Reserved
221  char name[0xF9]; ///< Name
222  u8 pad[3]; ///< Padding
224 
225 /// DeviceInfo [1.0.0-13.0.0]
226 typedef union {
227  BtmDeviceInfoV1 v1;
228  BtmDeviceInfoV13 v13;
229 } BtmDeviceInfo;
230 
231 /// DeviceInfoList
232 typedef struct {
233  u8 device_count; ///< DeviceCount
234  u8 reserved[3]; ///< Reserved
235  BtmDeviceInfoV1 devices[10]; ///< Array of \ref BtmDeviceInfoV1 with the above count.
237 
238 /// DeviceProperty
239 typedef struct {
240  BtdrvAddress addr; ///< \ref BtdrvAddress
241  BtmClassOfDevice class_of_device; ///< ClassOfDevice
242  BtmBdName name; ///< BdName
244 
245 /// DevicePropertyList
246 typedef struct {
247  u8 device_count; ///< DeviceCount
248  BtmDeviceProperty devices[15]; ///< Array of \ref BtmDeviceProperty.
250 
251 /// ZeroRetransmissionList
252 typedef struct {
253  u8 enabled_report_id_count; ///< EnabledReportIdCount
254  u8 enabled_report_id[0x10]; ///< Array of EnabledReportId.
256 
257 /// GattClientConditionList
258 typedef struct {
259  u8 unk_x0[0x74]; ///< Unknown
261 
262 /// GattService
263 typedef struct {
264  u8 unk_x0[0x4]; ///< Unknown
265  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
266  u16 handle; ///< Handle
267  u8 unk_x1A[0x2]; ///< Unknown
268  u16 instance_id; ///< InstanceId
269  u16 end_group_handle; ///< EndGroupHandle
270  u8 primary_service; ///< PrimaryService
271  u8 pad[3]; ///< Padding
273 
274 /// GattCharacteristic
275 typedef struct {
276  u8 unk_x0[0x4]; ///< Unknown
277  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
278  u16 handle; ///< Handle
279  u8 unk_x1A[0x2]; ///< Unknown
280  u16 instance_id; ///< InstanceId
281  u8 properties; ///< Properties
282  u8 unk_x1F[0x5]; ///< Unknown
284 
285 /// GattDescriptor
286 typedef struct {
287  u8 unk_x0[0x4]; ///< Unknown
288  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
289  u16 handle; ///< Handle
290  u8 unk_x1A[0x6]; ///< Unknown
292 
293 /// BleDataPath
294 typedef struct {
295  u8 unk_x0; ///< Unknown
296  u8 pad[3]; ///< Padding
297  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
299 
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_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:66
BleDataPath.
Definition: btm_types.h:294
u8 unk_x0
Unknown.
Definition: btm_types.h:295
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:297
ClassOfDevice.
Definition: btm_types.h:71
BtmConnectedDevice [13.0.0+].
Definition: btm_types.h:118
u32 profile
BtmProfile
Definition: btm_types.h:121
BtmConnectedDevice [1.0.0-12.1.0].
Definition: btm_types.h:106
DeviceCondition [1.0.0-5.0.2].
Definition: btm_types.h:129
DeviceCondition [5.1.0-7.0.1].
Definition: btm_types.h:140
DeviceCondition [8.0.0-8.1.1].
Definition: btm_types.h:152
DeviceCondition [9.0.0-12.1.0].
Definition: btm_types.h:163
DeviceInfoList.
Definition: btm_types.h:232
u8 device_count
DeviceCount.
Definition: btm_types.h:233
DeviceInfo [13.0.0+].
Definition: btm_types.h:210
BtmLinkKey link_key
LinkKey.
Definition: btm_types.h:213
u32 profile
BtmProfile
Definition: btm_types.h:215
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:211
BtmHidDeviceInfo hid_device_info
BtmHidDeviceInfo (Profile = Hid)
Definition: btm_types.h:218
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:212
DeviceInfo [1.0.0-12.1.0].
Definition: btm_types.h:195
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:197
BtmBdName name
BdName.
Definition: btm_types.h:198
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:196
u32 profile
BtmProfile
Definition: btm_types.h:201
BtmLinkKey link_key
LinkKey.
Definition: btm_types.h:199
BtmHidDeviceInfo hid_device_info
BtmHidDeviceInfo (Profile = Hid)
Definition: btm_types.h:204
DevicePropertyList.
Definition: btm_types.h:246
u8 device_count
DeviceCount.
Definition: btm_types.h:247
DeviceProperty.
Definition: btm_types.h:239
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:240
BtmBdName name
BdName.
Definition: btm_types.h:242
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:241
DeviceSlotModeList.
Definition: btm_types.h:188
u8 device_count
DeviceCount.
Definition: btm_types.h:189
DeviceSlotMode.
Definition: btm_types.h:181
u32 slot_mode
BtmSlotMode
Definition: btm_types.h:184
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:182
GattCharacteristic.
Definition: btm_types.h:275
u8 properties
Properties.
Definition: btm_types.h:281
u16 handle
Handle.
Definition: btm_types.h:278
u16 instance_id
InstanceId.
Definition: btm_types.h:280
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:277
GattClientConditionList.
Definition: btm_types.h:258
GattDescriptor.
Definition: btm_types.h:286
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:288
u16 handle
Handle.
Definition: btm_types.h:289
GattService.
Definition: btm_types.h:263
u16 handle
Handle.
Definition: btm_types.h:266
u16 instance_id
InstanceId.
Definition: btm_types.h:268
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:265
u16 end_group_handle
EndGroupHandle.
Definition: btm_types.h:269
u8 primary_service
PrimaryService.
Definition: btm_types.h:270
HidDeviceInfo.
Definition: btm_types.h:81
u16 vid
Vid.
Definition: btm_types.h:82
u16 pid
Pid.
Definition: btm_types.h:83
HostDeviceProperty.
Definition: btm_types.h:87
BtmClassOfDevice class_of_device
Same as BtdrvAdapterProperty::class_of_device.
Definition: btm_types.h:91
u8 feature_set
Same as BtdrvAdapterProperty::feature_set.
Definition: btm_types.h:93
BtdrvAddress addr
Same as BtdrvAdapterProperty::addr.
Definition: btm_types.h:90
BtmBdName name
Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
Definition: btm_types.h:92
LinkKey.
Definition: btm_types.h:76
ZeroRetransmissionList.
Definition: btm_types.h:252
u8 enabled_report_id_count
EnabledReportIdCount.
Definition: btm_types.h:253
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:173
DeviceInfo [1.0.0-13.0.0].
Definition: btm_types.h:226