mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 04:22:50 +02:00
btdrv: update GetAdapterProperties, GetAdapterProperty and SetAdapterProperty service wrappers for 12.0.0
This commit is contained in:
parent
2129806eb3
commit
c9e9ea9c21
@ -493,7 +493,7 @@ Result btdrvSetAdapterProperty(BtdrvAdapterPropertyType type, const BtdrvAdapter
|
||||
Result btdrvLegacyStartInquiry(void);
|
||||
|
||||
/**
|
||||
* @brief [12.0.0+] This starts Inquiry, the output data will be available via \ref btdrvGetEventInfo.
|
||||
* @brief StartInquiry [12.0.0+] This starts Inquiry, the output data will be available via \ref btdrvGetEventInfo.
|
||||
* @param[in] services Bitmask of allowed services. When -1 the original defaults from pre-12.0.0 are used.
|
||||
* @param[in] duration Inquiry duration in nanoseconds.
|
||||
* @note This is used by btm-sysmodule.
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
#include "../types.h"
|
||||
|
||||
/// BluetoothPropertyType
|
||||
/// BluetoothPropertyType [1.0.0-11.0.1]
|
||||
typedef enum {
|
||||
BtdrvBluetoothPropertyType_Name = 1, ///< Name. String, max length 0xF8 excluding NUL-terminator.
|
||||
BtdrvBluetoothPropertyType_Address = 2, ///< \ref BtdrvAddress
|
||||
@ -16,6 +16,14 @@ typedef enum {
|
||||
BtdrvBluetoothPropertyType_FeatureSet = 6, ///< 1-byte, FeatureSet. The default is value 0x68.
|
||||
} BtdrvBluetoothPropertyType;
|
||||
|
||||
/// AdapterPropertyType [12.0.0+]
|
||||
typedef enum {
|
||||
BtdrvAdapterPropertyType_Address = 0, ///< \ref BtdrvAddress
|
||||
BtdrvAdapterPropertyType_Name = 1, ///< Name. String, max length 0xF8 excluding NUL-terminator.
|
||||
BtdrvAdapterPropertyType_ClassOfDevice = 2, ///< 3-bytes, Class of Device.
|
||||
BtdrvAdapterPropertyType_Unknown3 = 3, ///< Only available with \ref btdrvSetAdapterProperty. Unknown, \ref BtdrvAddress.
|
||||
} BtdrvAdapterPropertyType;
|
||||
|
||||
/// EventType
|
||||
typedef enum {
|
||||
///< BtdrvEventType_* should be used on [12.0.0+]
|
||||
@ -140,14 +148,28 @@ typedef struct {
|
||||
u8 class_of_device[0x3]; ///< ClassOfDevice
|
||||
} BtdrvClassOfDevice;
|
||||
|
||||
/// AdapterProperty
|
||||
/// AdapterProperty [1.0.0-11.0.1]
|
||||
typedef struct {
|
||||
BtdrvAddress addr; ///< Same as the data for ::BtdrvBluetoothPropertyType_Address.
|
||||
BtdrvClassOfDevice class_of_device; ///< Same as the data for ::BtdrvBluetoothPropertyType_ClassOfDevice.
|
||||
char name[0xF9]; ///< Same as the data for ::BtdrvBluetoothPropertyType_Name (last byte is not initialized).
|
||||
u8 feature_set; ///< Set to hard-coded value 0x68 (same as the data for ::BtdrvBluetoothPropertyType_FeatureSet).
|
||||
} BtdrvAdapterPropertyOld;
|
||||
|
||||
/// AdapterProperty [12.0.0+]
|
||||
typedef struct {
|
||||
u8 type; ///< \ref BtdrvAdapterPropertyType
|
||||
u8 size; ///< Data size.
|
||||
u8 data[0x100]; ///< Data (Above size), as specified by the type.
|
||||
} BtdrvAdapterProperty;
|
||||
|
||||
/// AdapterPropertySet [12.0.0+]
|
||||
typedef struct {
|
||||
BtdrvAddress addr; ///< Same as the data for ::BtdrvBluetoothPropertyType_Address.
|
||||
BtdrvClassOfDevice class_of_device; ///< Same as the data for ::BtdrvBluetoothPropertyType_ClassOfDevice.
|
||||
char name[0xF9]; ///< Same as the data for ::BtdrvBluetoothPropertyType_Name (last byte is not initialized).
|
||||
} BtdrvAdapterPropertySet;
|
||||
|
||||
/// BluetoothPinCode [1.0.0-11.0.1]
|
||||
typedef struct {
|
||||
char code[0x10]; ///< PinCode
|
||||
|
@ -173,14 +173,21 @@ Result btdrvFinalizeBluetooth(void) {
|
||||
return _btdrvCmdNoIO(4);
|
||||
}
|
||||
|
||||
Result btdrvGetAdapterProperties(BtdrvAdapterProperty *property) {
|
||||
Result btdrvLegacyGetAdapterProperties(BtdrvAdapterPropertyOld *properties) {
|
||||
return serviceDispatch(&g_btdrvSrv, 5,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out | SfBufferAttr_FixedSize },
|
||||
.buffers = { { property, sizeof(*property) } },
|
||||
.buffers = { { properties, sizeof(*properties) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result btdrvGetAdapterProperty(BtdrvBluetoothPropertyType type, void* buffer, size_t size) {
|
||||
Result btdrvGetAdapterProperties(BtdrvAdapterPropertySet *properties) {
|
||||
return serviceDispatch(&g_btdrvSrv, 5,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out | SfBufferAttr_FixedSize },
|
||||
.buffers = { { properties, sizeof(*properties) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result btdrvLegacyGetAdapterProperty(BtdrvBluetoothPropertyType type, void* buffer, size_t size) {
|
||||
u32 tmp=type;
|
||||
return serviceDispatchIn(&g_btdrvSrv, 6, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
|
||||
@ -188,7 +195,15 @@ Result btdrvGetAdapterProperty(BtdrvBluetoothPropertyType type, void* buffer, si
|
||||
);
|
||||
}
|
||||
|
||||
Result btdrvSetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buffer, size_t size) {
|
||||
Result btdrvGetAdapterProperty(BtdrvAdapterPropertyType type, BtdrvAdapterProperty *property) {
|
||||
u32 tmp=type;
|
||||
return serviceDispatchIn(&g_btdrvSrv, 6, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out | SfBufferAttr_FixedSize },
|
||||
.buffers = { { property, sizeof(*property) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result btdrvLegacySetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buffer, size_t size) {
|
||||
u32 tmp=type;
|
||||
return serviceDispatchIn(&g_btdrvSrv, 7, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||
@ -196,6 +211,14 @@ Result btdrvSetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buff
|
||||
);
|
||||
}
|
||||
|
||||
Result btdrvSetAdapterProperty(BtdrvAdapterPropertyType type, const BtdrvAdapterProperty *property) {
|
||||
u32 tmp=type;
|
||||
return serviceDispatchIn(&g_btdrvSrv, 7, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In | SfBufferAttr_FixedSize },
|
||||
.buffers = { { property, sizeof(*property) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result btdrvLegacyStartInquiry(void) {
|
||||
return _btdrvCmdNoIO(8);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user