libnx  v4.2.2
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 
BtmDeviceInfoV1::profile
u32 profile
BtmProfile
Definition: btm_types.h:201
BtmState_RadioOffSlept
@ BtmState_RadioOffSlept
RadioOffSlept.
Definition: btm_types.h:17
BtmHidDeviceInfo
HidDeviceInfo.
Definition: btm_types.h:81
BtmState_MinorSlept
@ BtmState_MinorSlept
MinorSlept.
Definition: btm_types.h:14
BtmDeviceProperty
DeviceProperty.
Definition: btm_types.h:239
BtmDeviceConditionV800
DeviceCondition [8.0.0-8.1.1].
Definition: btm_types.h:152
BtmState_RadioOffMinorSlept
@ BtmState_RadioOffMinorSlept
RadioOffMinorSlept.
Definition: btm_types.h:15
BtmDeviceConditionV900
DeviceCondition [9.0.0-12.1.0].
Definition: btm_types.h:163
BtmDeviceConditionV100
DeviceCondition [1.0.0-5.0.2].
Definition: btm_types.h:129
BtmDevicePropertyList
DevicePropertyList.
Definition: btm_types.h:246
BtmDeviceInfoV13::hid_device_info
BtmHidDeviceInfo hid_device_info
BtmHidDeviceInfo (Profile = Hid)
Definition: btm_types.h:218
BtmDeviceSlotMode::addr
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:182
BtmHidDeviceInfo::vid
u16 vid
Vid.
Definition: btm_types.h:82
BtmConnectedDeviceV13::profile
u32 profile
BtmProfile
Definition: btm_types.h:121
BtmDeviceSlotModeList::device_count
u8 device_count
DeviceCount.
Definition: btm_types.h:189
BtmHostDeviceProperty::feature_set
u8 feature_set
Same as BtdrvAdapterProperty::feature_set.
Definition: btm_types.h:93
BtmGattDescriptor
GattDescriptor.
Definition: btm_types.h:286
BtmTsiMode_0Fd3Td3Si10
@ BtmTsiMode_0Fd3Td3Si10
0Fd3Td3Si10
Definition: btm_types.h:37
BtmConnectedDeviceV1
BtmConnectedDevice [1.0.0-12.1.0].
Definition: btm_types.h:106
BtmState_Slept
@ BtmState_Slept
Slept.
Definition: btm_types.h:16
BtmTsiMode_2Fd1Td3Si10
@ BtmTsiMode_2Fd1Td3Si10
2Fd1Td3Si10
Definition: btm_types.h:39
BtmHostDeviceProperty::name
BtmBdName name
Same as BtdrvAdapterProperty::name (except the last byte which is always zero).
Definition: btm_types.h:92
u8
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
BtmBleDataPath
BleDataPath.
Definition: btm_types.h:294
BtmHostDeviceProperty::class_of_device
BtmClassOfDevice class_of_device
Same as BtdrvAdapterProperty::class_of_device.
Definition: btm_types.h:91
BtmDeviceInfoList::device_count
u8 device_count
DeviceCount.
Definition: btm_types.h:233
BtmGattService::handle
u16 handle
Handle.
Definition: btm_types.h:266
BtmSlotMode_Active
@ BtmSlotMode_Active
Active.
Definition: btm_types.h:56
BtmState_Initialized
@ BtmState_Initialized
Initialized.
Definition: btm_types.h:18
BtmZeroRetransmissionList
ZeroRetransmissionList.
Definition: btm_types.h:252
BtmDeviceInfoV13::addr
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:211
BtmDeviceInfoV1::class_of_device
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:197
BtmDeviceSlotMode::slot_mode
u32 slot_mode
BtmSlotMode
Definition: btm_types.h:184
BtmLinkKey
LinkKey.
Definition: btm_types.h:76
BtmBluetoothMode
BtmBluetoothMode
BluetoothMode.
Definition: btm_types.h:23
BtmWlanMode
BtmWlanMode
WlanMode.
Definition: btm_types.h:29
BtmBluetoothMode_Dynamic2Slot
@ BtmBluetoothMode_Dynamic2Slot
Dynamic2Slot.
Definition: btm_types.h:24
BtmGattCharacteristic::instance_id
u16 instance_id
InstanceId.
Definition: btm_types.h:280
BtmSlotMode_2
@ BtmSlotMode_2
2
Definition: btm_types.h:53
BtmTsiMode_5Fd3Td3Si15
@ BtmTsiMode_5Fd3Td3Si15
5Fd3Td3Si15
Definition: btm_types.h:42
BtmHostDeviceProperty
HostDeviceProperty.
Definition: btm_types.h:87
BtmDeviceInfoV13
DeviceInfo [13.0.0+].
Definition: btm_types.h:210
BtmProfile_None
@ BtmProfile_None
None.
Definition: btm_types.h:61
BtmTsiMode_10Fd1Td1Si15
@ BtmTsiMode_10Fd1Td1Si15
10Fd1Td1Si15
Definition: btm_types.h:47
BtmHostDeviceProperty::addr
BtdrvAddress addr
Same as BtdrvAdapterProperty::addr.
Definition: btm_types.h:90
BtmTsiMode_1Fd1Td1Si5
@ BtmTsiMode_1Fd1Td1Si5
1Fd1Td1Si5
Definition: btm_types.h:38
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
BtmDeviceSlotModeList
DeviceSlotModeList.
Definition: btm_types.h:188
BtmTsiMode_3Fd1Td5Si15
@ BtmTsiMode_3Fd1Td5Si15
3Fd1Td5Si15
Definition: btm_types.h:40
BtmDeviceInfoV13::profile
u32 profile
BtmProfile
Definition: btm_types.h:215
BtmWlanMode_None
@ BtmWlanMode_None
None.
Definition: btm_types.h:32
BtmGattCharacteristic::handle
u16 handle
Handle.
Definition: btm_types.h:278
BtmDeviceProperty::name
BtmBdName name
BdName.
Definition: btm_types.h:242
BtmDeviceInfoV13::class_of_device
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:212
BtmGattCharacteristic::properties
u8 properties
Properties.
Definition: btm_types.h:281
BtmGattService::instance_id
u16 instance_id
InstanceId.
Definition: btm_types.h:268
BtmDeviceInfo
DeviceInfo [1.0.0-13.0.0].
Definition: btm_types.h:226
BtmDevicePropertyList::device_count
u8 device_count
DeviceCount.
Definition: btm_types.h:247
BtmHidDeviceInfo::pid
u16 pid
Pid.
Definition: btm_types.h:83
BtmProfile
BtmProfile
Profile.
Definition: btm_types.h:60
BtmDeviceCondition
DeviceCondition [1.0.0-12.1.0].
Definition: btm_types.h:173
BtmState_NotInitialized
@ BtmState_NotInitialized
NotInitialized.
Definition: btm_types.h:12
BtmGattService::uuid
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:265
BtdrvGattAttributeUuid
GattAttributeUuid.
Definition: btdrv_types.h:299
BtmBleDataPath::uuid
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:297
BtmState
BtmState
BtmState.
Definition: btm_types.h:11
BtmSlotMode
BtmSlotMode
SlotMode.
Definition: btm_types.h:52
BtmBdName
BdName.
Definition: btm_types.h:66
BtmTsiMode_6Fd5Td1Si15
@ BtmTsiMode_6Fd5Td1Si15
6Fd5Td1Si15
Definition: btm_types.h:43
BtmTsiMode_Active
@ BtmTsiMode_Active
Active.
Definition: btm_types.h:48
BtmDeviceInfoV1
DeviceInfo [1.0.0-12.1.0].
Definition: btm_types.h:195
BtmGattCharacteristic
GattCharacteristic.
Definition: btm_types.h:275
BtmProfile_Hid
@ BtmProfile_Hid
Hid.
Definition: btm_types.h:62
BtmState_RadioOff
@ BtmState_RadioOff
RadioOff.
Definition: btm_types.h:13
BtmWlanMode_Local8
@ BtmWlanMode_Local8
Local8.
Definition: btm_types.h:31
BtmDeviceInfoV1::hid_device_info
BtmHidDeviceInfo hid_device_info
BtmHidDeviceInfo (Profile = Hid)
Definition: btm_types.h:204
BtmDeviceInfoList
DeviceInfoList.
Definition: btm_types.h:232
BtmGattService::primary_service
u8 primary_service
PrimaryService.
Definition: btm_types.h:270
BtmTsiMode_9Fd1Td1Si10
@ BtmTsiMode_9Fd1Td1Si10
9Fd1Td1Si10
Definition: btm_types.h:46
BtmGattService::end_group_handle
u16 end_group_handle
EndGroupHandle.
Definition: btm_types.h:269
BtmGattCharacteristic::uuid
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:277
BtmDeviceInfoV1::link_key
BtmLinkKey link_key
LinkKey.
Definition: btm_types.h:199
BtmDeviceInfoV13::link_key
BtmLinkKey link_key
LinkKey.
Definition: btm_types.h:213
BtmBluetoothMode_StaticJoy
@ BtmBluetoothMode_StaticJoy
StaticJoy.
Definition: btm_types.h:25
BtmTsiMode_8Fd3Td1Si15
@ BtmTsiMode_8Fd3Td1Si15
8Fd3Td1Si15
Definition: btm_types.h:45
BtdrvAddress
Address.
Definition: btdrv_types.h:161
BtmClassOfDevice
ClassOfDevice.
Definition: btm_types.h:71
BtmDeviceProperty::addr
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:240
BtmDeviceInfoV1::addr
BtdrvAddress addr
BtdrvAddress
Definition: btm_types.h:196
BtmBleDataPath::unk_x0
u8 unk_x0
Unknown.
Definition: btm_types.h:295
BtmTsiMode_7Fd1Td3Si15
@ BtmTsiMode_7Fd1Td3Si15
7Fd1Td3Si15
Definition: btm_types.h:44
BtmTsiMode_4Fd3Td1Si10
@ BtmTsiMode_4Fd3Td1Si10
4Fd3Td1Si10
Definition: btm_types.h:41
BtmGattService
GattService.
Definition: btm_types.h:263
BtmSlotMode_4
@ BtmSlotMode_4
4
Definition: btm_types.h:54
BtmGattDescriptor::uuid
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btm_types.h:288
BtmDeviceConditionV510
DeviceCondition [5.1.0-7.0.1].
Definition: btm_types.h:140
BtmWlanMode_Local4
@ BtmWlanMode_Local4
Local4.
Definition: btm_types.h:30
BtmZeroRetransmissionList::enabled_report_id_count
u8 enabled_report_id_count
EnabledReportIdCount.
Definition: btm_types.h:253
BtmGattDescriptor::handle
u16 handle
Handle.
Definition: btm_types.h:289
BtmDeviceProperty::class_of_device
BtmClassOfDevice class_of_device
ClassOfDevice.
Definition: btm_types.h:241
BtmConnectedDeviceV13
BtmConnectedDevice [13.0.0+].
Definition: btm_types.h:118
BtmDeviceSlotMode
DeviceSlotMode.
Definition: btm_types.h:181
BtmSlotMode_6
@ BtmSlotMode_6
6
Definition: btm_types.h:55
BtmGattClientConditionList
GattClientConditionList.
Definition: btm_types.h:258
BtmState_Working
@ BtmState_Working
Working.
Definition: btm_types.h:19
u16
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
BtmDeviceInfoV1::name
BtmBdName name
BdName.
Definition: btm_types.h:198
BtmTsiMode
BtmTsiMode
TsiMode.
Definition: btm_types.h:36