From a02f554ebab8d449407ee4b72cd8a02732bc1175 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sun, 16 Aug 2020 18:34:24 -0400 Subject: [PATCH] btdrv/btm: Updated/added various structs. --- nx/include/switch/services/bt.h | 2 +- nx/include/switch/services/btdrv.h | 2 +- nx/include/switch/services/btdrv_types.h | 34 ++++++++++++++++++++++-- nx/include/switch/services/btm.h | 22 ++++++++++----- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/nx/include/switch/services/bt.h b/nx/include/switch/services/bt.h index 15529a46..a7d06882 100644 --- a/nx/include/switch/services/bt.h +++ b/nx/include/switch/services/bt.h @@ -115,7 +115,7 @@ Result btLeSendIndication(u8 unk, bool flag, const BtdrvGattAttributeUuid *uuid0 * @brief GetLeEventInfo * @note This is identical to \ref btdrvGetLeHidEventInfo except different state is used. * @note The state used by this is reset after writing the data to output. - * @param[in] buffer Output buffer. 0x400-bytes from state is written here. + * @param[in] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvLeEventInfo. * @param[in] size Output buffer size. * @oaram[out] type Output BleEventType. */ diff --git a/nx/include/switch/services/btdrv.h b/nx/include/switch/services/btdrv.h index 58fb8f98..656bb40a 100644 --- a/nx/include/switch/services/btdrv.h +++ b/nx/include/switch/services/btdrv.h @@ -932,7 +932,7 @@ Result btdrvUnregisterGattNotification(bool flag, u32 unk, const BtdrvGattId *id * @brief GetLeHidEventInfo * @note Only available on [5.0.0+]. * @note The state used by this is reset after writing the data to output. - * @param[out] buffer Output buffer. 0x400-bytes from state is written here. + * @param[out] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvLeEventInfo. * @param[in] size Output buffer size. * @oaram[out] type Output BleEventType. */ diff --git a/nx/include/switch/services/btdrv_types.h b/nx/include/switch/services/btdrv_types.h index 82b09a64..de1d8ee5 100644 --- a/nx/include/switch/services/btdrv_types.h +++ b/nx/include/switch/services/btdrv_types.h @@ -135,7 +135,8 @@ typedef struct { /// BleScanResult typedef struct { - u8 unk_x0[0x148]; ///< Unknown + u8 unk_x0[0x144]; ///< Unknown + s32 unk_x144; ///< Unknown } BtdrvBleScanResult; /// BleConnectionInfo @@ -153,6 +154,35 @@ typedef struct { /// GattId typedef struct { - u8 unk_x0[0x18]; ///< Unknown + u8 instance_id; ///< InstanceId + u8 pad[3]; ///< Padding + BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid } BtdrvGattId; +/// LeEventInfo +typedef struct { + u32 unk_x0; ///< Unknown + u32 unk_x4; ///< Unknown + u8 unk_x8; ///< Unknown + u8 pad[3]; ///< Padding + BtdrvGattAttributeUuid uuid0; ///< \ref BtdrvGattAttributeUuid + BtdrvGattAttributeUuid uuid1; ///< \ref BtdrvGattAttributeUuid + BtdrvGattAttributeUuid uuid2; ///< \ref BtdrvGattAttributeUuid + u16 size; ///< Size of the below data. + u8 data[0x3B6]; ///< Data. +} BtdrvLeEventInfo; + +/// BleClientGattOperationInfo +typedef struct { + u8 unk_x0; ///< Converted from BtdrvLeEventInfo::unk_x0. + u8 pad[3]; ///< Padding + u32 unk_x4; ///< BtdrvLeEventInfo::unk_x4 + u8 unk_x8; ///< BtdrvLeEventInfo::unk_x8 + u8 pad2[3]; ///< Padding + BtdrvGattAttributeUuid uuid0; ///< BtdrvLeEventInfo::uuid0 + BtdrvGattAttributeUuid uuid1; ///< BtdrvLeEventInfo::uuid1 + BtdrvGattAttributeUuid uuid2; ///< BtdrvLeEventInfo::uuid2 + u64 size; ///< BtdrvLeEventInfo::size + u8 data[0x200]; ///< BtdrvLeEventInfo::data +} BtdrvBleClientGattOperationInfo; + diff --git a/nx/include/switch/services/btm.h b/nx/include/switch/services/btm.h index 848c779d..1d693ece 100644 --- a/nx/include/switch/services/btm.h +++ b/nx/include/switch/services/btm.h @@ -53,21 +53,31 @@ typedef struct { typedef struct { u8 unk_x0[0x4]; ///< Unknown BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid - u16 unk_x18; ///< Unknown - u8 unk_x1A[0x4]; ///< Unknown - u16 unk_x1E; ///< Unknown - u8 unk_x20; ///< Unknown + u16 handle; ///< Handle + u8 unk_x1A[0x2]; ///< Unknown + u16 instance_id; ///< InstanceId + u16 end_group_handle; ///< EndGroupHandle + u8 primary_service; ///< PrimaryService u8 pad[3]; ///< Padding } BtmGattService; /// GattCharacteristic typedef struct { - u8 unk_x0[0x24]; ///< Unknown + u8 unk_x0[0x4]; ///< Unknown + BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid + u16 handle; ///< Handle + u8 unk_x1A[0x2]; ///< Unknown + u16 instance_id; ///< InstanceId + u8 properties; ///< Properties + u8 unk_x1F[0x5]; ///< Unknown } BtmGattCharacteristic; /// GattDescriptor typedef struct { - u8 unk_x0[0x20]; ///< Unknown + u8 unk_x0[0x4]; ///< Unknown + BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid + u16 handle; ///< Handle + u8 unk_x1A[0x6]; ///< Unknown } BtmGattDescriptor; /// BleDataPath