diff --git a/nx/include/switch/services/btdrv_types.h b/nx/include/switch/services/btdrv_types.h index 29164ee66..fa63fd49e 100644 --- a/nx/include/switch/services/btdrv_types.h +++ b/nx/include/switch/services/btdrv_types.h @@ -193,6 +193,37 @@ typedef enum { BtdrvGattAuthReqType_SignedMitm = 4, } BtdrvGattAuthReqType; +/// BtdrvBleAdBit +typedef enum { + BtdrvBleAdBit_DeviceName = BIT(0), + BtdrvBleAdBit_Flags = BIT(1), + BtdrvBleAdBit_Manufacturer = BIT(2), + BtdrvBleAdBit_TxPower = BIT(3), + BtdrvBleAdBit_Service32 = BIT(4), + BtdrvBleAdBit_IntRange = BIT(5), + BtdrvBleAdBit_Service = BIT(6), + BtdrvBleAdBit_ServiceSol = BIT(7), + BtdrvBleAdBit_ServiceData = BIT(8), + BtdrvBleAdBit_SignData = BIT(9), + BtdrvBleAdBit_Service128Sol = BIT(10), + BtdrvBleAdBit_Appearance = BIT(11), + BtdrvBleAdBit_PublicAddress = BIT(12), + BtdrvBleAdBit_RandomAddress = BIT(13), + BtdrvBleAdBit_Service32Sol = BIT(14), + BtdrvBleAdBit_Proprietary = BIT(15), + BtdrvBleAdBit_Service128 = BIT(16), +} BtdrvBleAdBit; + +/// BtdrvBleAdFlag +typedef enum { + BtdrvBleAdFlag_None = 0, + BtdrvBleAdFlag_LimitedDiscovery = BIT(0), + BtdrvBleAdFlag_GeneralDiscovery = BIT(1), + BtdrvBleAdFlag_BrEdrNotSupported = BIT(2), + BtdrvBleAdFlag_DualModeControllerSupport = BIT(3), + BtdrvBleAdFlag_DualModeHostSupport = BIT(4), +} BtdrvBleAdFlag; + /// AudioEventType typedef enum { BtdrvAudioEventType_None = 0, ///< None @@ -280,6 +311,29 @@ typedef struct { u8 unk_x0[0x88]; ///< Unknown } BtdrvChannelMapList; +/// GattAttributeUuid +typedef struct { + u32 size; ///< UUID size, must be 0x2, 0x4, or 0x10. + u8 uuid[0x10]; ///< UUID with the above size. +} BtdrvGattAttributeUuid; + +/// GattId +typedef struct { + u8 instance_id; ///< InstanceId + u8 pad[3]; ///< Padding + BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid +} BtdrvGattId; + +/// GattAttribute +typedef struct { + BtdrvGattId id; ///< \ref BtdrvGattId + u16 type; ///< \ref BtdrvGattAttributeType + u16 handle; + u16 group_end_handle; + u8 property; ///< Only used when type is characteristic. \ref BtdrvGattCharacteristicProperty + bool is_primary; ///< Only used when type is service +} BtdrvGattAttribute; + /// LeConnectionParams [5.0.0-8.1.1] typedef struct { BtdrvAddress addr; ///< \ref BtdrvAddress @@ -303,30 +357,24 @@ typedef struct { u16 supervision_tout; ///< Connection supervision timeout multiplier } BtdrvBleConnectionParameter; -/// BtdrvBleAdvertisePacketDataEntry +/// BtdrvBleAdvertisePacketData typedef struct { - u16 unk_x0; ///< Unknown - u8 unused[0x12]; ///< Unused -} BtdrvBleAdvertisePacketDataEntry; - -/// BleAdvertisePacketData -typedef struct { - u32 unk_x0; ///< Unknown - u8 unk_x4; ///< Unknown - u8 size0; ///< Size of the data at unk_x6. - u8 unk_x6[0x1F]; ///< Unknown, see size0. - u8 pad[3]; ///< Padding - u8 count; ///< Total array entries, see entries. - u8 pad2[7]; ///< Padding - BtdrvBleAdvertisePacketDataEntry entries[0x5]; ///< \ref BtdrvBleAdvertisePacketDataEntry - u8 pad3[0x10]; ///< Padding - u8 size2; ///< Size of the data at unk_xA8. - u8 unk_xA5; ///< Unknown - u8 pad4[2]; ///< Padding - u8 unk_xA8[0x1F]; ///< Unknown, see size2. - u8 unk_xC7; ///< Unknown - u8 unk_xC8; ///< Unknown - u8 pad5[3]; ///< Padding + u32 adv_data_mask; ///< Bitmask of following AD data to be included in advertising packets \ref BtdrvBleAdBit + u8 flag; ///< AD flag value to be advertised \ref BtdrvBleAdFlag. Included with BtdrvBleAdBit_Flags + u8 manu_data_len; ///< Size of manu_data below + u8 manu_data[0x1F]; ///< Manufacturer-specific data to be advertised. Included with BtdrvBleAdBit_Manufacturer + u8 pad[1]; ///< Padding + u16 appearance_data; ///< Device appearance data to be advertised \ref BtdrvAppearanceType. Included with BtdrvBleAdBit_Appearance + u8 num_service; ///< Number of services in uuid_val array below + u8 pad2[3]; ///< Padding + BtdrvGattAttributeUuid uuid_val[0x6]; ///< Array of 16-bit UUIDs to be advertised \ref BtdrvGattAttributeUuid. Included with BtdrvBleAdBit_Service + u8 service_data_len; ///< Size of service_data below + u8 pad3[1]; ///< Padding + u16 service_data_uuid; ///< 16-bit UUID of service_data below + u8 service_data[0x1F]; ///< Service data to be advertised. Included with BtdrvBleAdBit_ServiceData + bool is_scan_rsp; ///< Whether this is an inquiry scan response or advertising data + u8 tx_power; ///< Inquiry transmit power to be advertised. Included with BtdrvBleAdBit_TxPower + u8 pad4[3]; ///< Padding } BtdrvBleAdvertisePacketData; /// BleAdvertisement @@ -366,29 +414,6 @@ typedef struct { u8 pad[2]; ///< Padding } BtdrvBleConnectionInfo; -/// GattAttributeUuid -typedef struct { - u32 size; ///< UUID size, must be 0x2, 0x4, or 0x10. - u8 uuid[0x10]; ///< UUID with the above size. -} BtdrvGattAttributeUuid; - -/// GattId -typedef struct { - u8 instance_id; ///< InstanceId - u8 pad[3]; ///< Padding - BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid -} BtdrvGattId; - -/// GattAttribute -typedef struct { - BtdrvGattId id; ///< \ref BtdrvGattId - u16 type; ///< \ref BtdrvGattAttributeType - u16 handle; - u16 group_end_handle; - u8 property; ///< Only used when type is characteristic. \ref BtdrvGattCharacteristicProperty - bool is_primary; ///< Only used when type is service -} BtdrvGattAttribute; - /// LeEventInfo typedef struct { u32 unk_x0; ///< Unknown