mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-29 21:22:13 +02:00
Compare commits
2 Commits
c769852631
...
3c851a3443
Author | SHA1 | Date | |
---|---|---|---|
|
3c851a3443 | ||
|
df0508200b |
@ -2,7 +2,7 @@
|
|||||||
* @file bt.h
|
* @file bt.h
|
||||||
* @brief Bluetooth user (bt) service IPC wrapper.
|
* @brief Bluetooth user (bt) service IPC wrapper.
|
||||||
* @note See also btdev.
|
* @note See also btdev.
|
||||||
* @author yellows8
|
* @author yellows8, ndeadly
|
||||||
* @copyright libnx Authors
|
* @copyright libnx Authors
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -24,93 +24,93 @@ Service* btGetServiceSession(void);
|
|||||||
* @brief LeClientReadCharacteristic
|
* @brief LeClientReadCharacteristic
|
||||||
* @note This is essentially the same as \ref btdrvReadGattCharacteristic.
|
* @note This is essentially the same as \ref btdrvReadGattCharacteristic.
|
||||||
* @param[in] connection_handle ConnectionHandle
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] primary_service PrimaryService
|
* @param[in] is_primary Is a primary service or not
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
|
||||||
* @param[in] unk Unknown
|
* @param[in] auth_req \ref BtdrvGattAuthReqType
|
||||||
*/
|
*/
|
||||||
Result btLeClientReadCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk);
|
Result btLeClientReadCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u8 auth_req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientReadDescriptor
|
* @brief LeClientReadDescriptor
|
||||||
* @note This is essentially the same as \ref btdrvReadGattDescriptor.
|
* @note This is essentially the same as \ref btdrvReadGattDescriptor.
|
||||||
* @param[in] connection_handle ConnectionHandle
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] primary_service PrimaryService
|
* @param[in] is_primary Is a primary service or not
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id2 \ref BtdrvGattId
|
* @param[in] desc_id Descriptor GATT ID \ref BtdrvGattId
|
||||||
* @param[in] unk Unknown
|
* @param[in] auth_req \ref BtdrvGattAuthReqType
|
||||||
*/
|
*/
|
||||||
Result btLeClientReadDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk);
|
Result btLeClientReadDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, u8 auth_req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientWriteCharacteristic
|
* @brief LeClientWriteCharacteristic
|
||||||
* @note This is essentially the same as \ref btdrvWriteGattCharacteristic.
|
* @note This is essentially the same as \ref btdrvWriteGattCharacteristic.
|
||||||
* @param[in] connection_handle ConnectionHandle
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] primary_service PrimaryService
|
* @param[in] is_primary Is a primary service or not
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
|
||||||
* @param[in] buffer Input buffer.
|
* @param[in] buffer Input buffer.
|
||||||
* @param[in] size Input buffer size, must be <=0x258.
|
* @param[in] size Input buffer size, must be <=0x258.
|
||||||
* @param[in] unk Unknown
|
* @param[in] auth_req \ref BtdrvGattAuthReqType
|
||||||
* @param[in] flag Flag
|
* @param[in] with_response Whether to use Write-With-Response write type or not
|
||||||
*/
|
*/
|
||||||
Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag);
|
Result btLeClientWriteCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const void* buffer, size_t size, u8 auth_req, bool with_response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientWriteDescriptor
|
* @brief LeClientWriteDescriptor
|
||||||
* @note This is essentially the same as \ref btdrvWriteGattDescriptor.
|
* @note This is essentially the same as \ref btdrvWriteGattDescriptor.
|
||||||
* @param[in] connection_handle ConnectionHandle
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] primary_service PrimaryService
|
* @param[in] is_primary Is a primary service or not
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id2 \ref BtdrvGattId
|
* @param[in] desc_id Descriptor GATT ID \ref BtdrvGattId
|
||||||
* @param[in] buffer Input buffer.
|
* @param[in] buffer Input buffer.
|
||||||
* @param[in] size Input buffer size, must be <=0x258.
|
* @param[in] size Input buffer size, must be <=0x258.
|
||||||
* @param[in] unk Unknown
|
* @param[in] auth_req \ref BtdrvGattAuthReqType
|
||||||
*/
|
*/
|
||||||
Result btLeClientWriteDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk);
|
Result btLeClientWriteDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const void* buffer, size_t size, u8 auth_req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientRegisterNotification
|
* @brief LeClientRegisterNotification
|
||||||
* @note This is essentially the same as \ref btdrvRegisterGattNotification.
|
* @note This is essentially the same as \ref btdrvRegisterGattNotification.
|
||||||
* @param[in] connection_handle ConnectionHandle
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] primary_service PrimaryService
|
* @param[in] is_primary Is a primary service or not
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
|
||||||
*/
|
*/
|
||||||
Result btLeClientRegisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btLeClientRegisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientDeregisterNotification
|
* @brief LeClientDeregisterNotification
|
||||||
* @note This is essentially the same as \ref btdrvUnregisterGattNotification.
|
* @note This is essentially the same as \ref btdrvUnregisterGattNotification.
|
||||||
* @param[in] connection_handle ConnectionHandle
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] primary_service PrimaryService
|
* @param[in] is_primary Is a primary service or not
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
|
||||||
*/
|
*/
|
||||||
Result btLeClientDeregisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btLeClientDeregisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetLeResponse
|
* @brief SetLeResponse
|
||||||
* @param[in] unk Unknown
|
* @param[in] server_if Server interface ID
|
||||||
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
|
* @param[in] serv_uuid Service UUID \ref BtdrvGattAttributeUuid
|
||||||
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
|
* @param[in] char_uuid Characteristic UUID \ref BtdrvGattAttributeUuid
|
||||||
* @param[in] buffer Input buffer.
|
* @param[in] buffer Input buffer.
|
||||||
* @param[in] size Input buffer size, must be <=0x258.
|
* @param[in] size Input buffer size, must be <=0x258.
|
||||||
*/
|
*/
|
||||||
Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size);
|
Result btSetLeResponse(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeSendIndication
|
* @brief LeSendIndication
|
||||||
* @param[in] unk Unknown
|
* @param[in] server_if Server interface ID
|
||||||
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
|
* @param[in] serv_uuid Service UUID \ref BtdrvGattAttributeUuid
|
||||||
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
|
* @param[in] char_uuid Characteristic UUID \ref BtdrvGattAttributeUuid
|
||||||
* @param[in] buffer Input buffer.
|
* @param[in] buffer Input buffer.
|
||||||
* @param[in] size Input buffer size, clamped to max size 0x258.
|
* @param[in] size Input buffer size, clamped to max size 0x258.
|
||||||
* @param[in] flag Flag
|
* @param[in] noconfirm Whether no confirmation is required (notification) or not (indication)
|
||||||
*/
|
*/
|
||||||
Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size, bool flag);
|
Result btLeSendIndication(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size, bool noconfirm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetLeEventInfo
|
* @brief GetLeEventInfo
|
||||||
@ -118,9 +118,9 @@ Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const Btd
|
|||||||
* @note The state used by this is reset after writing the data to output.
|
* @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. See \ref BtdrvLeEventInfo.
|
* @param[in] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvLeEventInfo.
|
||||||
* @param[in] size Output buffer size.
|
* @param[in] size Output buffer size.
|
||||||
* @param[out] type Output BleEventType.
|
* @param[out] type Output BtdrvBleEventType.
|
||||||
*/
|
*/
|
||||||
Result btGetLeEventInfo(void* buffer, size_t size, u32 *type);
|
Result btGetLeEventInfo(void* buffer, size_t size, BtdrvBleEventType *type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RegisterBleEvent
|
* @brief RegisterBleEvent
|
||||||
|
@ -755,6 +755,297 @@ typedef struct HidKeyboardSharedMemoryFormat {
|
|||||||
|
|
||||||
// End HidKeyboard
|
// End HidKeyboard
|
||||||
|
|
||||||
|
// Begin HidBasicXpad
|
||||||
|
|
||||||
|
/// HidBasicXpadState
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
u32 attributes;
|
||||||
|
u32 buttons;
|
||||||
|
u64 analog_stick_left;
|
||||||
|
u64 analog_stick_right;
|
||||||
|
} HidBasicXpadState;
|
||||||
|
|
||||||
|
/// HidBasicXpadStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidBasicXpadState state;
|
||||||
|
} HidBasicXpadStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidBasicXpadLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidBasicXpadStateAtomicStorage storage[17];
|
||||||
|
} HidBasicXpadLifo;
|
||||||
|
|
||||||
|
/// HidBasicXpadSharedMemoryEntry
|
||||||
|
typedef struct {
|
||||||
|
HidBasicXpadLifo lifo;
|
||||||
|
u8 padding[0x138];
|
||||||
|
} HidBasicXpadSharedMemoryEntry;
|
||||||
|
|
||||||
|
/// HidBasicXpadSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidBasicXpadSharedMemoryEntry entries[4];
|
||||||
|
} HidBasicXpadSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidBasicXpad
|
||||||
|
|
||||||
|
// Begin HidDigitizer
|
||||||
|
|
||||||
|
/// HidDigitizerState
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
u32 unk_0x8;
|
||||||
|
u32 unk_0xC;
|
||||||
|
u32 attributes;
|
||||||
|
u32 buttons;
|
||||||
|
u32 unk_0x18;
|
||||||
|
u32 unk_0x1C;
|
||||||
|
u32 unk_0x20;
|
||||||
|
u32 unk_0x24;
|
||||||
|
u32 unk_0x28;
|
||||||
|
u32 unk_0x2C;
|
||||||
|
u32 unk_0x30;
|
||||||
|
u32 unk_0x34;
|
||||||
|
u32 unk_0x38;
|
||||||
|
u32 unk_0x3C;
|
||||||
|
u32 unk_0x40;
|
||||||
|
u32 unk_0x44;
|
||||||
|
u32 unk_0x48;
|
||||||
|
u32 unk_0x4C;
|
||||||
|
u32 unk_0x50;
|
||||||
|
u32 unk_0x54;
|
||||||
|
} HidDigitizerState;
|
||||||
|
|
||||||
|
/// HidDigitizerStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidDigitizerState state;
|
||||||
|
} HidDigitizerStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidDigitizerLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidDigitizerStateAtomicStorage storage[17];
|
||||||
|
} HidDigitizerLifo;
|
||||||
|
|
||||||
|
/// HidDigitizerSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidDigitizerLifo lifo;
|
||||||
|
u8 padding[0x980];
|
||||||
|
} HidDigitizerSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidDigitizer
|
||||||
|
|
||||||
|
// Begin HidHomeButton
|
||||||
|
|
||||||
|
/// HidHomeButtonState
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
u64 buttons;
|
||||||
|
} HidHomeButtonState;
|
||||||
|
|
||||||
|
/// HidHomeButtonStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidHomeButtonState state;
|
||||||
|
} HidHomeButtonStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidHomeButtonLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidHomeButtonStateAtomicStorage storage[17];
|
||||||
|
} HidHomeButtonLifo;
|
||||||
|
|
||||||
|
/// HidHomeButtonSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidHomeButtonLifo lifo;
|
||||||
|
u8 padding[0x48];
|
||||||
|
} HidHomeButtonSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidHomeButton
|
||||||
|
|
||||||
|
// Begin HidSleepButton
|
||||||
|
|
||||||
|
/// HidSleepButtonState
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
u64 buttons;
|
||||||
|
} HidSleepButtonState;
|
||||||
|
|
||||||
|
/// HidSleepButtonStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidSleepButtonState state;
|
||||||
|
} HidSleepButtonStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidSleepButtonLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidSleepButtonStateAtomicStorage storage[17];
|
||||||
|
} HidSleepButtonLifo;
|
||||||
|
|
||||||
|
/// HidSleepButtonSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidSleepButtonLifo lifo;
|
||||||
|
u8 padding[0x48];
|
||||||
|
} HidSleepButtonSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidSleepButton
|
||||||
|
|
||||||
|
// Begin HidCaptureButton
|
||||||
|
|
||||||
|
/// HidCaptureButtonState
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
u64 buttons;
|
||||||
|
} HidCaptureButtonState;
|
||||||
|
|
||||||
|
/// HidCaptureButtonStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidCaptureButtonState state;
|
||||||
|
} HidCaptureButtonStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidCaptureButtonLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidCaptureButtonStateAtomicStorage storage[17];
|
||||||
|
} HidCaptureButtonLifo;
|
||||||
|
|
||||||
|
/// HidCaptureButtonSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidCaptureButtonLifo lifo;
|
||||||
|
u8 padding[0x48];
|
||||||
|
} HidCaptureButtonSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidCaptureButton
|
||||||
|
|
||||||
|
// Begin HidInputDetector
|
||||||
|
|
||||||
|
/// HidInputDetectorState
|
||||||
|
typedef struct {
|
||||||
|
u64 input_source_state;
|
||||||
|
u64 sampling_number;
|
||||||
|
} HidInputDetectorState;
|
||||||
|
|
||||||
|
/// HidInputDetectorStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidInputDetectorState state;
|
||||||
|
} HidInputDetectorStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidInputDetectorLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidInputDetectorStateAtomicStorage storage[2];
|
||||||
|
} HidInputDetectorLifo;
|
||||||
|
|
||||||
|
/// HidInputDetectorSharedMemoryEntry
|
||||||
|
typedef struct {
|
||||||
|
HidInputDetectorLifo lifo;
|
||||||
|
u8 padding[0x30];
|
||||||
|
} HidInputDetectorSharedMemoryEntry;
|
||||||
|
|
||||||
|
/// HidInputDetectorSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidInputDetectorSharedMemoryEntry entries[16];
|
||||||
|
} HidInputDetectorSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidInputDetector
|
||||||
|
|
||||||
|
// Begin HidUniquePad
|
||||||
|
|
||||||
|
/// HidUniquePadConfigMutex
|
||||||
|
typedef struct {
|
||||||
|
u8 unk_0x0[0x20];
|
||||||
|
} HidUniquePadConfigMutex;
|
||||||
|
|
||||||
|
/// HidSixAxisSensorUserCalibrationState
|
||||||
|
typedef struct {
|
||||||
|
u32 flags;
|
||||||
|
u8 reserved[4];
|
||||||
|
u64 stage;
|
||||||
|
u64 sampling_number;
|
||||||
|
} HidSixAxisSensorUserCalibrationState;
|
||||||
|
|
||||||
|
/// HidSixAxisSensorUserCalibrationStateAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidSixAxisSensorUserCalibrationState calib_state;
|
||||||
|
} HidSixAxisSensorUserCalibrationStateAtomicStorage;
|
||||||
|
|
||||||
|
/// HidSixAxisSensorUserCalibrationStateLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidSixAxisSensorUserCalibrationStateAtomicStorage storage[2];
|
||||||
|
} HidSixAxisSensorUserCalibrationStateLifo;
|
||||||
|
|
||||||
|
/// HidAnalogStickCalibrationStateImpl
|
||||||
|
typedef struct {
|
||||||
|
u64 state;
|
||||||
|
u64 flags;
|
||||||
|
u64 stage;
|
||||||
|
u64 sampling_number;
|
||||||
|
} HidAnalogStickCalibrationStateImpl;
|
||||||
|
|
||||||
|
/// HidAnalogStickCalibrationStateImplAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidAnalogStickCalibrationStateImpl calib_state;
|
||||||
|
} HidAnalogStickCalibrationStateImplAtomicStorage;
|
||||||
|
|
||||||
|
/// HidAnalogStickCalibrationStateImplLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidAnalogStickCalibrationStateImplAtomicStorage storage[2];
|
||||||
|
} HidAnalogStickCalibrationStateImplLifo;
|
||||||
|
|
||||||
|
/// HidUniquePadConfig
|
||||||
|
typedef struct {
|
||||||
|
u32 type;
|
||||||
|
u32 interface;
|
||||||
|
u8 serial_number[0x10];
|
||||||
|
u32 controller_number;
|
||||||
|
bool is_active;
|
||||||
|
u8 reserved[3];
|
||||||
|
u64 sampling_number;
|
||||||
|
} HidUniquePadConfig;
|
||||||
|
|
||||||
|
/// HidUniquePadConfigAtomicStorage
|
||||||
|
typedef struct {
|
||||||
|
u64 sampling_number;
|
||||||
|
HidUniquePadConfig config;
|
||||||
|
} HidUniquePadConfigAtomicStorage;
|
||||||
|
|
||||||
|
/// HidUniquePadConfigLifo
|
||||||
|
typedef struct {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidUniquePadConfigAtomicStorage storage[2];
|
||||||
|
} HidUniquePadConfigLifo;
|
||||||
|
|
||||||
|
/// HidUniquePadLifo
|
||||||
|
typedef struct {
|
||||||
|
HidUniquePadConfigLifo config_lifo;
|
||||||
|
HidAnalogStickCalibrationStateImplLifo analog_stick_calib_lifo[2];
|
||||||
|
HidSixAxisSensorUserCalibrationStateLifo sixaxis_calib_lifo;
|
||||||
|
HidUniquePadConfigMutex mutex;
|
||||||
|
} HidUniquePadLifo;
|
||||||
|
|
||||||
|
/// HidUniquePadSharedMemoryEntry
|
||||||
|
typedef struct {
|
||||||
|
HidUniquePadLifo lifo;
|
||||||
|
u8 padding[0x220];
|
||||||
|
} HidUniquePadSharedMemoryEntry;
|
||||||
|
|
||||||
|
/// HidUniquePadSharedMemoryFormat
|
||||||
|
typedef struct {
|
||||||
|
HidUniquePadSharedMemoryEntry entries[16];
|
||||||
|
} HidUniquePadSharedMemoryFormat;
|
||||||
|
|
||||||
|
// End HidUniquePad
|
||||||
|
|
||||||
// Begin HidNpad
|
// Begin HidNpad
|
||||||
|
|
||||||
/// Npad colors.
|
/// Npad colors.
|
||||||
@ -1080,12 +1371,15 @@ typedef struct HidSharedMemory {
|
|||||||
HidTouchScreenSharedMemoryFormat touchscreen;
|
HidTouchScreenSharedMemoryFormat touchscreen;
|
||||||
HidMouseSharedMemoryFormat mouse;
|
HidMouseSharedMemoryFormat mouse;
|
||||||
HidKeyboardSharedMemoryFormat keyboard;
|
HidKeyboardSharedMemoryFormat keyboard;
|
||||||
u8 digitizer[0x1000]; ///< [10.0.0+] Digitizer [1.0.0-9.2.0] BasicXpad
|
union {
|
||||||
u8 home_button[0x200];
|
HidBasicXpadSharedMemoryFormat basic_xpad; ///< [1.0.0-9.2.0] BasicXpad
|
||||||
u8 sleep_button[0x200];
|
HidDigitizerSharedMemoryFormat digitizer; ///< [10.0.0+] Digitizer
|
||||||
u8 capture_button[0x200];
|
};
|
||||||
u8 input_detector[0x800];
|
HidHomeButtonSharedMemoryFormat home_button;
|
||||||
u8 unique_pad[0x4000]; ///< [1.0.0-4.1.0] UniquePad
|
HidSleepButtonSharedMemoryFormat sleep_button;
|
||||||
|
HidCaptureButtonSharedMemoryFormat capture_button;
|
||||||
|
HidInputDetectorSharedMemoryFormat input_detector;
|
||||||
|
HidUniquePadSharedMemoryFormat unique_pad; ///< [1.0.0-4.1.0] UniquePad
|
||||||
HidNpadSharedMemoryFormat npad;
|
HidNpadSharedMemoryFormat npad;
|
||||||
HidGestureSharedMemoryFormat gesture;
|
HidGestureSharedMemoryFormat gesture;
|
||||||
HidConsoleSixAxisSensor console_six_axis_sensor; ///< [5.0.0+] ConsoleSixAxisSensor
|
HidConsoleSixAxisSensor console_six_axis_sensor; ///< [5.0.0+] ConsoleSixAxisSensor
|
||||||
@ -1245,6 +1539,48 @@ NX_CONSTEXPR bool hidKeyboardStateGetKey(const HidKeyboardState *state, HidKeybo
|
|||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
///@name HomeButton
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets \ref HidHomeButtonState.
|
||||||
|
* @note Home button shmem must be activated with \ref hidsysActivateHomeButton
|
||||||
|
* @param[out] states Output array of \ref HidHomeButtonState.
|
||||||
|
* @param[in] count Size of the states array in entries.
|
||||||
|
* @return Total output entries.
|
||||||
|
*/
|
||||||
|
size_t hidGetHomeButtonStates(HidHomeButtonState *states, size_t count);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
///@name SleepButton
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets \ref HidSleepButtonState.
|
||||||
|
* @note Sleep button shmem must be activated with \ref hidsysActivateSleepButton
|
||||||
|
* @param[out] states Output array of \ref HidSleepButtonState.
|
||||||
|
* @param[in] count Size of the states array in entries.
|
||||||
|
* @return Total output entries.
|
||||||
|
*/
|
||||||
|
size_t hidGetSleepButtonStates(HidSleepButtonState *states, size_t count);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
///@name CaptureButton
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets \ref HidCaptureButtonState.
|
||||||
|
* @note Capture button shmem must be activated with \ref hidsysActivateCaptureButton
|
||||||
|
* @param[out] states Output array of \ref HidCaptureButtonState.
|
||||||
|
* @param[in] count Size of the states array in entries.
|
||||||
|
* @return Total output entries.
|
||||||
|
*/
|
||||||
|
size_t hidGetCaptureButtonStates(HidCaptureButtonState *states, size_t count);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
///@name Npad
|
///@name Npad
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
|
@ -24,50 +24,50 @@ Service* btGetServiceSession(void) {
|
|||||||
return &g_btSrv;
|
return &g_btSrv;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientReadCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk) {
|
Result btLeClientReadCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u8 auth_req) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 primary_service;
|
u8 is_primary;
|
||||||
u8 unk;
|
u8 auth_req;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 connection_handle;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId serv_id;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId char_id;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
|
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 0, in,
|
return serviceDispatchIn(&g_btSrv, 0, in,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientReadDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk) {
|
Result btLeClientReadDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, u8 auth_req) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 primary_service;
|
u8 is_primary;
|
||||||
u8 unk;
|
u8 auth_req;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 connection_handle;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId serv_id;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId char_id;
|
||||||
BtdrvGattId id2;
|
BtdrvGattId desc_id;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2, appletGetAppletResourceUserId() };
|
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, *desc_id, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 1, in,
|
return serviceDispatchIn(&g_btSrv, 1, in,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag) {
|
Result btLeClientWriteCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const void* buffer, size_t size, u8 auth_req, bool with_response) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 primary_service;
|
u8 is_primary;
|
||||||
u8 unk;
|
u8 auth_req;
|
||||||
u8 flag;
|
u8 with_response;
|
||||||
u8 pad;
|
u8 pad;
|
||||||
u32 connection_handle;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId serv_id;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId char_id;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { primary_service!=0, unk, flag!=0, 0, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
|
} in = { is_primary!=0, auth_req, with_response!=0, 0, connection_handle, *serv_id, *char_id, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 2, in,
|
return serviceDispatchIn(&g_btSrv, 2, in,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -76,17 +76,17 @@ Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientWriteDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk) {
|
Result btLeClientWriteDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const void* buffer, size_t size, u8 auth_req) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 primary_service;
|
u8 is_primary;
|
||||||
u8 unk;
|
u8 auth_req;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 connection_handle;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId serv_id;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId char_id;
|
||||||
BtdrvGattId id2;
|
BtdrvGattId desc_id;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2, appletGetAppletResourceUserId() };
|
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, *desc_id, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 3, in,
|
return serviceDispatchIn(&g_btSrv, 3, in,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -95,38 +95,38 @@ Result btLeClientWriteDescriptor(u32 connection_handle, bool primary_service, co
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btLeClientNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
|
static Result _btLeClientNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 primary_service;
|
u8 is_primary;
|
||||||
u8 pad[3];
|
u8 pad[3];
|
||||||
u32 connection_handle;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId serv_id;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId char_id;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { primary_service!=0, {0}, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
|
} in = { is_primary!=0, {0}, connection_handle, *serv_id, *char_id, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, cmd_id, in,
|
return serviceDispatchIn(&g_btSrv, cmd_id, in,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientRegisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btLeClientRegisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id) {
|
||||||
return _btLeClientNotification(connection_handle, primary_service, id0, id1, 4);
|
return _btLeClientNotification(connection_handle, is_primary, serv_id, char_id, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientDeregisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btLeClientDeregisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id) {
|
||||||
return _btLeClientNotification(connection_handle, primary_service, id0, id1, 5);
|
return _btLeClientNotification(connection_handle, is_primary, serv_id, char_id, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size) {
|
Result btSetLeResponse(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 unk;
|
u8 server_if;
|
||||||
u8 pad[3];
|
u8 pad[3];
|
||||||
BtdrvGattAttributeUuid uuid0;
|
BtdrvGattAttributeUuid serv_uuid;
|
||||||
BtdrvGattAttributeUuid uuid1;
|
BtdrvGattAttributeUuid char_uuid;
|
||||||
u8 pad2[4];
|
u8 pad2[4];
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { unk, {0}, *uuid0, *uuid1, {0}, appletGetAppletResourceUserId() };
|
} in = { server_if, {0}, *serv_uuid, *char_uuid, {0}, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 6, in,
|
return serviceDispatchIn(&g_btSrv, 6, in,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -135,16 +135,16 @@ Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvG
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size, bool flag) {
|
Result btLeSendIndication(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size, bool noconfirm) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 unk;
|
u8 server_if;
|
||||||
u8 flag;
|
u8 noconfirm;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
BtdrvGattAttributeUuid uuid0;
|
BtdrvGattAttributeUuid serv_uuid;
|
||||||
BtdrvGattAttributeUuid uuid1;
|
BtdrvGattAttributeUuid char_uuid;
|
||||||
u8 pad2[4];
|
u8 pad2[4];
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { unk, flag!=0, {0}, *uuid0, *uuid1, {0}, appletGetAppletResourceUserId() };
|
} in = { server_if, noconfirm!=0, {0}, *serv_uuid, *char_uuid, {0}, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 7, in,
|
return serviceDispatchIn(&g_btSrv, 7, in,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -153,7 +153,7 @@ Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const Btd
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btGetLeEventInfo(void* buffer, size_t size, u32 *type) {
|
Result btGetLeEventInfo(void* buffer, size_t size, BtdrvBleEventType *type) {
|
||||||
u64 AppletResourceUserId = appletGetAppletResourceUserId();
|
u64 AppletResourceUserId = appletGetAppletResourceUserId();
|
||||||
return serviceDispatchInOut(&g_btSrv, 8, AppletResourceUserId, *type,
|
return serviceDispatchInOut(&g_btSrv, 8, AppletResourceUserId, *type,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
|
||||||
|
@ -275,6 +275,33 @@ size_t hidGetKeyboardStates(HidKeyboardState *states, size_t count) {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t hidGetHomeButtonStates(HidHomeButtonState *states, size_t count) {
|
||||||
|
HidSharedMemory *sharedmem = (HidSharedMemory*)hidGetSharedmemAddr();
|
||||||
|
if (sharedmem == NULL)
|
||||||
|
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_NotInitialized));
|
||||||
|
|
||||||
|
size_t total = _hidGetStates(&sharedmem->home_button.lifo.header, sharedmem->home_button.lifo.storage, 17, offsetof(HidHomeButtonStateAtomicStorage,state), offsetof(HidHomeButtonState,sampling_number), states, sizeof(HidHomeButtonState), count);
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t hidGetSleepButtonStates(HidSleepButtonState *states, size_t count) {
|
||||||
|
HidSharedMemory *sharedmem = (HidSharedMemory*)hidGetSharedmemAddr();
|
||||||
|
if (sharedmem == NULL)
|
||||||
|
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_NotInitialized));
|
||||||
|
|
||||||
|
size_t total = _hidGetStates(&sharedmem->sleep_button.lifo.header, sharedmem->sleep_button.lifo.storage, 17, offsetof(HidSleepButtonStateAtomicStorage,state), offsetof(HidSleepButtonState,sampling_number), states, sizeof(HidSleepButtonState), count);
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t hidGetCaptureButtonStates(HidCaptureButtonState *states, size_t count) {
|
||||||
|
HidSharedMemory *sharedmem = (HidSharedMemory*)hidGetSharedmemAddr();
|
||||||
|
if (sharedmem == NULL)
|
||||||
|
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_NotInitialized));
|
||||||
|
|
||||||
|
size_t total = _hidGetStates(&sharedmem->capture_button.lifo.header, sharedmem->capture_button.lifo.storage, 17, offsetof(HidCaptureButtonStateAtomicStorage,state), offsetof(HidCaptureButtonState,sampling_number), states, sizeof(HidCaptureButtonState), count);
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
void hidInitializeNpad(void) {
|
void hidInitializeNpad(void) {
|
||||||
Result rc = _hidActivateNpad();
|
Result rc = _hidActivateNpad();
|
||||||
if (R_FAILED(rc)) diagAbortWithResult(rc);
|
if (R_FAILED(rc)) diagAbortWithResult(rc);
|
||||||
|
Loading…
Reference in New Issue
Block a user