mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 02:22:15 +02:00
bluetooth: Updated params, improved docs, etc.
This commit is contained in:
parent
6ab0dc38e6
commit
162552b58c
@ -1,6 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* @file btdev.h
|
* @file btdev.h
|
||||||
* @brief Wrapper around the bt/btmu services for using bluetooth BLE.
|
* @brief Wrapper around the bt/btmu services for using bluetooth BLE.
|
||||||
|
* @note Only available on [5.0.0+].
|
||||||
|
* @note See also: https://switchbrew.org/wiki/BTM_services
|
||||||
* @author yellows8
|
* @author yellows8
|
||||||
* @copyright libnx Authors
|
* @copyright libnx Authors
|
||||||
*/
|
*/
|
||||||
@ -65,7 +67,12 @@ Result btdevStartBleScanGeneral(BtdrvBleAdvertisePacketParameter param);
|
|||||||
/// Wrapper for \ref btmuStopBleScanForGeneral.
|
/// Wrapper for \ref btmuStopBleScanForGeneral.
|
||||||
Result btdevStopBleScanGeneral(void);
|
Result btdevStopBleScanGeneral(void);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetBleScanResultsForGeneral and \ref btmuGetBleScanResultsForSmartDevice.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetBleScanResultsForGeneral and \ref btmuGetBleScanResultsForSmartDevice.
|
||||||
|
* @param[out] results Output array of \ref BtdrvBleScanResult.
|
||||||
|
* @param[in] count Size of the results array in entries.
|
||||||
|
* @param[out] total_out Total output entries.
|
||||||
|
*/
|
||||||
Result btdevGetBleScanResult(BtdrvBleScanResult *results, u8 count, u8 *total_out);
|
Result btdevGetBleScanResult(BtdrvBleScanResult *results, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuStartBleScanForPaired.
|
/// Wrapper for \ref btmuStartBleScanForPaired.
|
||||||
@ -95,20 +102,32 @@ Result btdevGetBleConnectionInfoList(BtdrvBleConnectionInfo *info, u8 count, u8
|
|||||||
/// Wrapper for \ref btmuAcquireBleServiceDiscoveryEvent.
|
/// Wrapper for \ref btmuAcquireBleServiceDiscoveryEvent.
|
||||||
Result btdevAcquireBleServiceDiscoveryEvent(Event* out_event);
|
Result btdevAcquireBleServiceDiscoveryEvent(Event* out_event);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattServices.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetGattServices.
|
||||||
|
* @param[in] connection_handle ConnectionHandle
|
||||||
|
* @param[out] services Output array of \ref BtdevGattService.
|
||||||
|
* @param[in] count Size of the services array in entries. The max is 100.
|
||||||
|
* @param[out] total_out Total output entries.
|
||||||
|
*/
|
||||||
Result btdevGetGattServices(u32 connection_handle, BtdevGattService *services, u8 count, u8 *total_out);
|
Result btdevGetGattServices(u32 connection_handle, BtdevGattService *services, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattService.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetGattService.
|
||||||
|
* @param[in] connection_handle ConnectionHandle
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[out] service \ref BtdevGattService
|
||||||
|
* @param[out] flag Whether a \ref BtdevGattService was returned.
|
||||||
|
*/
|
||||||
Result btdevGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtdevGattService *service, bool *flag);
|
Result btdevGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtdevGattService *service, bool *flag);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuAcquireBlePairingEvent.
|
/// Wrapper for \ref btmuAcquireBlePairingEvent.
|
||||||
Result btdevAcquireBlePairingEvent(Event* out_event);
|
Result btdevAcquireBlePairingEvent(Event* out_event);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuBlePairDevice.
|
/// Wrapper for \ref btmuBlePairDevice.
|
||||||
Result btdevPairGattServer(BtdrvBleAdvertisePacketParameter param, u32 id);
|
Result btdevPairGattServer(u32 connection_handle, BtdrvBleAdvertisePacketParameter param);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuBleUnPairDevice.
|
/// Wrapper for \ref btmuBleUnPairDevice.
|
||||||
Result btdevUnpairGattServer(BtdrvBleAdvertisePacketParameter param, u32 id);
|
Result btdevUnpairGattServer(u32 connection_handle, BtdrvBleAdvertisePacketParameter param);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuBleUnPairDevice2.
|
/// Wrapper for \ref btmuBleUnPairDevice2.
|
||||||
Result btdevUnpairGattServer2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param);
|
Result btdevUnpairGattServer2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param);
|
||||||
@ -119,61 +138,114 @@ Result btdevGetPairedGattServerAddress(BtdrvBleAdvertisePacketParameter param, B
|
|||||||
/// Wrapper for \ref btmuAcquireBleMtuConfigEvent.
|
/// Wrapper for \ref btmuAcquireBleMtuConfigEvent.
|
||||||
Result btdevAcquireBleMtuConfigEvent(Event* out_event);
|
Result btdevAcquireBleMtuConfigEvent(Event* out_event);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuConfigureBleMtu. mtu must be 0x18-0x200.
|
/**
|
||||||
Result btdevConfigureBleMtu(u32 id, u16 mtu);
|
* @brief Wrapper for \ref btmuConfigureBleMtu.
|
||||||
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
|
* @param[in] mtu MTU, must be 0x18-0x200.
|
||||||
|
*/
|
||||||
|
Result btdevConfigureBleMtu(u32 connection_handle, u16 mtu);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetBleMtu.
|
/// Wrapper for \ref btmuGetBleMtu.
|
||||||
Result btdevGetBleMtu(u32 id, u16 *out);
|
Result btdevGetBleMtu(u32 connection_handle, u16 *out);
|
||||||
|
|
||||||
/// Wrapper for \ref btRegisterBleEvent.
|
/// Wrapper for \ref btRegisterBleEvent.
|
||||||
Result btdevAcquireBleGattOperationEvent(Event* out_event);
|
Result btdevAcquireBleGattOperationEvent(Event* out_event);
|
||||||
|
|
||||||
/// Wrapper for \ref btdevRegisterGattOperationNotification.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuRegisterBleGattDataPath.
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
*/
|
||||||
Result btdevRegisterGattOperationNotification(const BtdrvGattAttributeUuid *uuid);
|
Result btdevRegisterGattOperationNotification(const BtdrvGattAttributeUuid *uuid);
|
||||||
|
|
||||||
/// Wrapper for \ref btdevUnregisterGattOperationNotification.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuUnregisterBleGattDataPath.
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
*/
|
||||||
Result btdevUnregisterGattOperationNotification(const BtdrvGattAttributeUuid *uuid);
|
Result btdevUnregisterGattOperationNotification(const BtdrvGattAttributeUuid *uuid);
|
||||||
|
|
||||||
/// Wrapper for \ref btGetLeEventInfo.
|
/**
|
||||||
|
* @brief Wrapper for \ref btGetLeEventInfo.
|
||||||
|
* @param[out] out \ref BtdrvBleClientGattOperationInfo
|
||||||
|
*/
|
||||||
Result btdevGetGattOperationResult(BtdrvBleClientGattOperationInfo *out);
|
Result btdevGetGattOperationResult(BtdrvBleClientGattOperationInfo *out);
|
||||||
|
|
||||||
/// Wrapper for \ref btLeClientReadCharacteristic.
|
/**
|
||||||
|
* @brief Wrapper for \ref btLeClientReadCharacteristic.
|
||||||
|
* @note An error is thrown if the properties from \ref btdevGattCharacteristicGetProperties don't allow using this.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
*/
|
||||||
Result btdevReadGattCharacteristic(BtdevGattCharacteristic *c);
|
Result btdevReadGattCharacteristic(BtdevGattCharacteristic *c);
|
||||||
|
|
||||||
/// Wrapper for \ref btLeClientWriteCharacteristic.
|
/**
|
||||||
|
* @brief Wrapper for \ref btLeClientWriteCharacteristic.
|
||||||
|
* @note An error is thrown if the properties from \ref btdevGattCharacteristicGetProperties don't allow using this.
|
||||||
|
* @note This uses the Value from \ref btdevGattCharacteristicSetValue.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
*/
|
||||||
Result btdevWriteGattCharacteristic(BtdevGattCharacteristic *c);
|
Result btdevWriteGattCharacteristic(BtdevGattCharacteristic *c);
|
||||||
|
|
||||||
/// Wrapper for \ref btLeClientRegisterNotification / \ref btLeClientDeregisterNotification, flag controls which func to call.
|
/**
|
||||||
|
* @brief Wrapper for \ref btLeClientRegisterNotification / \ref btLeClientDeregisterNotification.
|
||||||
|
* @note An error is thrown if the properties from \ref btdevGattCharacteristicGetProperties don't allow using this.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
* @param[in] flag Whether to enable/disable, controls which func to call.
|
||||||
|
*/
|
||||||
Result btdevEnableGattCharacteristicNotification(BtdevGattCharacteristic *c, bool flag);
|
Result btdevEnableGattCharacteristicNotification(BtdevGattCharacteristic *c, bool flag);
|
||||||
|
|
||||||
/// Wrapper for \ref btLeClientReadDescriptor.
|
/**
|
||||||
|
* @brief Wrapper for \ref btLeClientReadDescriptor.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
*/
|
||||||
Result btdevReadGattDescriptor(BtdevGattDescriptor *d);
|
Result btdevReadGattDescriptor(BtdevGattDescriptor *d);
|
||||||
|
|
||||||
/// Wrapper for \ref btLeClientWriteDescriptor.
|
/**
|
||||||
|
* @brief Wrapper for \ref btLeClientWriteDescriptor.
|
||||||
|
* @note This uses the Value from \ref btdevGattDescriptorSetValue.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
*/
|
||||||
Result btdevWriteGattDescriptor(BtdevGattDescriptor *d);
|
Result btdevWriteGattDescriptor(BtdevGattDescriptor *d);
|
||||||
|
|
||||||
///@name GattAttribute
|
///@name GattAttribute
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// Creates a \ref BtdevGattAttribute object.
|
/**
|
||||||
|
* @brief Creates a \ref BtdevGattAttribute object. This is intended for internal use.
|
||||||
|
* @param a \ref BtdevGattAttribute
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[in] handle Handle
|
||||||
|
* @param[in] connection_handle ConnectionHandle
|
||||||
|
*/
|
||||||
void btdevGattAttributeCreate(BtdevGattAttribute *a, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle);
|
void btdevGattAttributeCreate(BtdevGattAttribute *a, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle);
|
||||||
|
|
||||||
/// Gets the Type.
|
/**
|
||||||
|
* @brief Gets the Type.
|
||||||
|
* @param a \ref BtdevGattAttribute
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u8 btdevGattAttributeGetType(BtdevGattAttribute *a) {
|
NX_CONSTEXPR u8 btdevGattAttributeGetType(BtdevGattAttribute *a) {
|
||||||
return a->type;
|
return a->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the Uuid.
|
/**
|
||||||
|
* @brief Gets the Uuid.
|
||||||
|
* @param a \ref BtdevGattAttribute
|
||||||
|
* @param[out] out \ref BtdrvGattAttributeUuid
|
||||||
|
*/
|
||||||
NX_CONSTEXPR void btdevGattAttributeGetUuid(BtdevGattAttribute *a, BtdrvGattAttributeUuid *out) {
|
NX_CONSTEXPR void btdevGattAttributeGetUuid(BtdevGattAttribute *a, BtdrvGattAttributeUuid *out) {
|
||||||
*out = a->uuid;
|
*out = a->uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the Handle.
|
/**
|
||||||
|
* @brief Gets the Handle.
|
||||||
|
* @param a \ref BtdevGattAttribute
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u16 btdevGattAttributeGetHandle(BtdevGattAttribute *a) {
|
NX_CONSTEXPR u16 btdevGattAttributeGetHandle(BtdevGattAttribute *a) {
|
||||||
return a->handle;
|
return a->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the ConnectionHandle.
|
/**
|
||||||
|
* @brief Gets the ConnectionHandle.
|
||||||
|
* @param a \ref BtdevGattAttribute
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u32 btdevGattAttributeGetConnectionHandle(BtdevGattAttribute *a) {
|
NX_CONSTEXPR u32 btdevGattAttributeGetConnectionHandle(BtdevGattAttribute *a) {
|
||||||
return a->connection_handle;
|
return a->connection_handle;
|
||||||
}
|
}
|
||||||
@ -183,31 +255,67 @@ NX_CONSTEXPR u32 btdevGattAttributeGetConnectionHandle(BtdevGattAttribute *a) {
|
|||||||
///@name GattService
|
///@name GattService
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// Creates a \ref BtdevGattService object.
|
/**
|
||||||
|
* @brief Creates a \ref BtdevGattService object. This is intended for internal use.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[in] handle Handle
|
||||||
|
* @param[in] connection_handle ConnectionHandle
|
||||||
|
* @param[in] instance_id InstanceId
|
||||||
|
* @param[in] end_group_handle EndGroupHandle
|
||||||
|
* @param[in] primary_service PrimaryService
|
||||||
|
*/
|
||||||
void btdevGattServiceCreate(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u16 end_group_handle, bool primary_service);
|
void btdevGattServiceCreate(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u16 end_group_handle, bool primary_service);
|
||||||
|
|
||||||
/// Gets the InstanceId.
|
/**
|
||||||
|
* @brief Gets the InstanceId.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u16 btdevGattServiceGetInstanceId(BtdevGattService *s) {
|
NX_CONSTEXPR u16 btdevGattServiceGetInstanceId(BtdevGattService *s) {
|
||||||
return s->instance_id;
|
return s->instance_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the EndGroupHandle.
|
/**
|
||||||
|
* @brief Gets the EndGroupHandle.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u16 btdevGattServiceGetEndGroupHandle(BtdevGattService *s) {
|
NX_CONSTEXPR u16 btdevGattServiceGetEndGroupHandle(BtdevGattService *s) {
|
||||||
return s->end_group_handle;
|
return s->end_group_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets whether this is the PrimaryService.
|
/**
|
||||||
|
* @brief Gets whether this is the PrimaryService.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u16 btdevGattServiceIsPrimaryService(BtdevGattService *s) {
|
NX_CONSTEXPR u16 btdevGattServiceIsPrimaryService(BtdevGattService *s) {
|
||||||
return s->primary_service;
|
return s->primary_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattIncludedServices.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetGattIncludedServices.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
* @param[out] services Output array of \ref BtdevGattService.
|
||||||
|
* @param[in] count Size of the services array in entries. The max is 100.
|
||||||
|
* @param[out] total_out Total output entries.
|
||||||
|
*/
|
||||||
Result btdevGattServiceGetIncludedServices(BtdevGattService *s, BtdevGattService *services, u8 count, u8 *total_out);
|
Result btdevGattServiceGetIncludedServices(BtdevGattService *s, BtdevGattService *services, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattCharacteristics.
|
/**
|
||||||
Result btdevGattServiceGetCharacteristics(BtdevGattService *s, BtdevGattCharacteristic *characteristic, u8 count, u8 *total_out);
|
* @brief Wrapper for \ref btmuGetGattCharacteristics.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
* @param[out] characteristics Output array of \ref BtdevGattCharacteristic.
|
||||||
|
* @param[in] count Size of the characteristics array in entries. The max is 100.
|
||||||
|
* @param[out] total_out Total output entries.
|
||||||
|
*/
|
||||||
|
Result btdevGattServiceGetCharacteristics(BtdevGattService *s, BtdevGattCharacteristic *characteristics, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattCharacteristics.
|
/**
|
||||||
|
* @brief Same as \ref btdevGattServiceGetCharacteristics except this only returns the \ref BtdevGattCharacteristic which contains a matching \ref BtdrvGattAttributeUuid.
|
||||||
|
* @param s \ref BtdevGattService
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[out] characteristic \ref BtdevGattCharacteristic
|
||||||
|
* @param[out] flag Whether a \ref BtdevGattService was returned.
|
||||||
|
*/
|
||||||
Result btdevGattServiceGetCharacteristic(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, BtdevGattCharacteristic *characteristic, bool *flag);
|
Result btdevGattServiceGetCharacteristic(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, BtdevGattCharacteristic *characteristic, bool *flag);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
@ -215,32 +323,75 @@ Result btdevGattServiceGetCharacteristic(BtdevGattService *s, const BtdrvGattAtt
|
|||||||
///@name GattCharacteristic
|
///@name GattCharacteristic
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// Creates a \ref BtdevGattCharacteristic object.
|
/**
|
||||||
|
* @brief Creates a \ref BtdevGattCharacteristic object. This is intended for internal use.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[in] handle Handle
|
||||||
|
* @param[in] connection_handle ConnectionHandle
|
||||||
|
* @param[in] instance_id InstanceId
|
||||||
|
* @param[in] properties Properties
|
||||||
|
*/
|
||||||
void btdevGattCharacteristicCreate(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u8 properties);
|
void btdevGattCharacteristicCreate(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u8 properties);
|
||||||
|
|
||||||
/// Gets the InstanceId.
|
/**
|
||||||
|
* @brief Gets the InstanceId.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u16 btdevGattCharacteristicGetInstanceId(BtdevGattCharacteristic *c) {
|
NX_CONSTEXPR u16 btdevGattCharacteristicGetInstanceId(BtdevGattCharacteristic *c) {
|
||||||
return c->instance_id;
|
return c->instance_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the Properties.
|
/**
|
||||||
|
* @brief Gets the Properties.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
*/
|
||||||
NX_CONSTEXPR u8 btdevGattCharacteristicGetProperties(BtdevGattCharacteristic *c) {
|
NX_CONSTEXPR u8 btdevGattCharacteristicGetProperties(BtdevGattCharacteristic *c) {
|
||||||
return c->properties;
|
return c->properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetBelongingGattService.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetBelongingGattService.
|
||||||
|
* @note Gets the \ref BtdevGattService which belongs to this object.
|
||||||
|
* @param c \ref BtdevGattCharacteristic.
|
||||||
|
* @param[out] service \ref BtdevGattService
|
||||||
|
*/
|
||||||
Result btdevGattCharacteristicGetService(BtdevGattCharacteristic *c, BtdevGattService *service);
|
Result btdevGattCharacteristicGetService(BtdevGattCharacteristic *c, BtdevGattService *service);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattDescriptors.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetGattDescriptors.
|
||||||
|
* @note Gets the descriptors which belongs to this object.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
* @param[out] descriptors Output array of \ref BtdevGattDescriptor.
|
||||||
|
* @param[in] count Size of the descriptors array in entries. The max is 100.
|
||||||
|
* @param[out] total_out Total output entries.
|
||||||
|
*/
|
||||||
Result btdevGattCharacteristicGetDescriptors(BtdevGattCharacteristic *c, BtdevGattDescriptor *descriptors, u8 count, u8 *total_out);
|
Result btdevGattCharacteristicGetDescriptors(BtdevGattCharacteristic *c, BtdevGattDescriptor *descriptors, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/// Same as \ref btdevGattCharacteristicGetDescriptors except this only returns a \ref BtdevGattDescriptor which contains a matching \ref BtdrvGattAttributeUuid.
|
/**
|
||||||
|
* @brief Same as \ref btdevGattCharacteristicGetDescriptors except this only returns a \ref BtdevGattDescriptor which contains a matching \ref BtdrvGattAttributeUuid.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[out] descriptor \ref BtdevGattDescriptor
|
||||||
|
* @param[out] flag Whether a \ref BtdevGattDescriptor was returned.
|
||||||
|
*/
|
||||||
Result btdevGattCharacteristicGetDescriptor(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, BtdevGattDescriptor *descriptor, bool *flag);
|
Result btdevGattCharacteristicGetDescriptor(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, BtdevGattDescriptor *descriptor, bool *flag);
|
||||||
|
|
||||||
/// Sets the Value in the object, max size is 0x200.
|
/**
|
||||||
|
* @brief Sets the Value in the object.
|
||||||
|
* @note See also \ref btdevWriteGattCharacteristic.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
* @param[in] buffer Input buffer.
|
||||||
|
* @param[in] size Input buffer size, max is 0x200.
|
||||||
|
*/
|
||||||
void btdevGattCharacteristicSetValue(BtdevGattCharacteristic *c, const void* buffer, size_t size);
|
void btdevGattCharacteristicSetValue(BtdevGattCharacteristic *c, const void* buffer, size_t size);
|
||||||
|
|
||||||
/// Gets the Value in the object, returns the copied value size.
|
/**
|
||||||
|
* @brief Gets the Value in the object, returns the copied value size.
|
||||||
|
* @param c \ref BtdevGattCharacteristic
|
||||||
|
* @param[out] buffer Output buffer.
|
||||||
|
* @param[in] size Output buffer size, max is 0x200.
|
||||||
|
*/
|
||||||
u64 btdevGattCharacteristicGetValue(BtdevGattCharacteristic *c, void* buffer, size_t size);
|
u64 btdevGattCharacteristicGetValue(BtdevGattCharacteristic *c, void* buffer, size_t size);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
@ -248,19 +399,46 @@ u64 btdevGattCharacteristicGetValue(BtdevGattCharacteristic *c, void* buffer, si
|
|||||||
///@name GattDescriptor
|
///@name GattDescriptor
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// Creates a \ref BtdevGattDescriptor object.
|
/**
|
||||||
|
* @brief Creates a \ref BtdevGattDescriptor object. This is intended for internal use.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
|
* @param[in] handle Handle
|
||||||
|
* @param[in] connection_handle ConnectionHandle
|
||||||
|
*/
|
||||||
void btdevGattDescriptorCreate(BtdevGattDescriptor *d, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle);
|
void btdevGattDescriptorCreate(BtdevGattDescriptor *d, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetBelongingGattService.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetBelongingGattService.
|
||||||
|
* @note Gets the \ref BtdevGattService which belongs to this object.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
* @param[out] service \ref BtdevGattService
|
||||||
|
*/
|
||||||
Result btdevGattDescriptorGetService(BtdevGattDescriptor *d, BtdevGattService *service);
|
Result btdevGattDescriptorGetService(BtdevGattDescriptor *d, BtdevGattService *service);
|
||||||
|
|
||||||
/// Wrapper for \ref btmuGetGattCharacteristics.
|
/**
|
||||||
|
* @brief Wrapper for \ref btmuGetGattCharacteristics.
|
||||||
|
* @note Gets the \ref BtdevGattCharacteristic which belongs to this object.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
* @param[out] characteristic \ref BtdevGattCharacteristic
|
||||||
|
*/
|
||||||
Result btdevGattDescriptorGetCharacteristic(BtdevGattDescriptor *d, BtdevGattCharacteristic *characteristic);
|
Result btdevGattDescriptorGetCharacteristic(BtdevGattDescriptor *d, BtdevGattCharacteristic *characteristic);
|
||||||
|
|
||||||
/// Sets the Value in the object, max size is 0x200.
|
/**
|
||||||
|
* @brief Sets the Value in the object.
|
||||||
|
* @note See also \ref btdevWriteGattDescriptor.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
* @param[in] buffer Input buffer.
|
||||||
|
* @param[in] size Input buffer size, max is 0x200.
|
||||||
|
*/
|
||||||
void btdevGattDescriptorSetValue(BtdevGattDescriptor *d, const void* buffer, size_t size);
|
void btdevGattDescriptorSetValue(BtdevGattDescriptor *d, const void* buffer, size_t size);
|
||||||
|
|
||||||
/// Gets the Value in the object, returns the copied value size.
|
/**
|
||||||
|
* @brief Gets the Value in the object, returns the copied value size.
|
||||||
|
* @param d \ref BtdevGattDescriptor
|
||||||
|
* @param[out] buffer Output buffer.
|
||||||
|
* @param[in] size Output buffer size, max is 0x200.
|
||||||
|
*/
|
||||||
u64 btdevGattDescriptorGetValue(BtdevGattDescriptor *d, void* buffer, size_t size);
|
u64 btdevGattDescriptorGetValue(BtdevGattDescriptor *d, void* buffer, size_t size);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
@ -1,6 +1,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.
|
||||||
* @author yellows8
|
* @author yellows8
|
||||||
* @copyright libnx Authors
|
* @copyright libnx Authors
|
||||||
*/
|
*/
|
||||||
@ -22,73 +23,73 @@ 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] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
|
* @param[in] unk Unknown
|
||||||
*/
|
*/
|
||||||
Result btLeClientReadCharacteristic(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btLeClientReadCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientReadDescriptor
|
* @brief LeClientReadDescriptor
|
||||||
* @note This is essentially the same as \ref btdrvReadGattDescriptor.
|
* @note This is essentially the same as \ref btdrvReadGattDescriptor.
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
* @param[in] id2 \ref BtdrvGattId
|
* @param[in] id2 \ref BtdrvGattId
|
||||||
|
* @param[in] unk Unknown
|
||||||
*/
|
*/
|
||||||
Result btLeClientReadDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2);
|
Result btLeClientReadDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientWriteCharacteristic
|
* @brief LeClientWriteCharacteristic
|
||||||
* @note This is essentially the same as \ref btdrvWriteGattCharacteristic.
|
* @note This is essentially the same as \ref btdrvWriteGattCharacteristic.
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] flag2 Flag
|
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \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] flag Flag
|
||||||
*/
|
*/
|
||||||
Result btLeClientWriteCharacteristic(bool flag, u8 unk, bool flag2, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size);
|
Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientWriteDescriptor
|
* @brief LeClientWriteDescriptor
|
||||||
* @note This is essentially the same as \ref btdrvWriteGattDescriptor.
|
* @note This is essentially the same as \ref btdrvWriteGattDescriptor.
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
* @param[in] id2 \ref BtdrvGattId
|
* @param[in] id2 \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
|
||||||
*/
|
*/
|
||||||
Result btLeClientWriteDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size);
|
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientRegisterNotification
|
* @brief LeClientRegisterNotification
|
||||||
* @note This is essentially the same as \ref btdrvRegisterGattNotification.
|
* @note This is essentially the same as \ref btdrvRegisterGattNotification.
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
*/
|
*/
|
||||||
Result btLeClientRegisterNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btLeClientRegisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LeClientDeregisterNotification
|
* @brief LeClientDeregisterNotification
|
||||||
* @note This is essentially the same as \ref btdrvUnregisterGattNotification.
|
* @note This is essentially the same as \ref btdrvUnregisterGattNotification.
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
*/
|
*/
|
||||||
Result btLeClientDeregisterNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btLeClientDeregisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetLeResponse
|
* @brief SetLeResponse
|
||||||
@ -103,13 +104,13 @@ Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvG
|
|||||||
/**
|
/**
|
||||||
* @brief LeSendIndication
|
* @brief LeSendIndication
|
||||||
* @param[in] unk Unknown
|
* @param[in] unk Unknown
|
||||||
* @param[in] flag Flag
|
|
||||||
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
|
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
|
||||||
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
|
* @param[in] uuid1 \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
|
||||||
*/
|
*/
|
||||||
Result btLeSendIndication(u8 unk, bool flag, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size);
|
Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size, bool flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetLeEventInfo
|
* @brief GetLeEventInfo
|
||||||
@ -117,7 +118,7 @@ Result btLeSendIndication(u8 unk, bool flag, const BtdrvGattAttributeUuid *uuid0
|
|||||||
* @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.
|
||||||
* @oaram[out] type Output BleEventType.
|
* @param[out] type Output BleEventType.
|
||||||
*/
|
*/
|
||||||
Result btGetLeEventInfo(void* buffer, size_t size, u32 *type);
|
Result btGetLeEventInfo(void* buffer, size_t size, u32 *type);
|
||||||
|
|
||||||
|
@ -860,73 +860,73 @@ Result btdrvUnregisterGattDataPath(const BtdrvGattAttributeUuid *uuid);
|
|||||||
/**
|
/**
|
||||||
* @brief ReadGattCharacteristic
|
* @brief ReadGattCharacteristic
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
|
* @param[in] unk Unknown
|
||||||
*/
|
*/
|
||||||
Result btdrvReadGattCharacteristic(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btdrvReadGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ReadGattDescriptor
|
* @brief ReadGattDescriptor
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
* @param[in] id2 \ref BtdrvGattId
|
* @param[in] id2 \ref BtdrvGattId
|
||||||
|
* @param[in] unk Unknown
|
||||||
*/
|
*/
|
||||||
Result btdrvReadGattDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2);
|
Result btdrvReadGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief WriteGattCharacteristic
|
* @brief WriteGattCharacteristic
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] flag2 Flag
|
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \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] flag Flag
|
||||||
*/
|
*/
|
||||||
Result btdrvWriteGattCharacteristic(bool flag, u8 unk, bool flag2, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size);
|
Result btdrvWriteGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief WriteGattDescriptor
|
* @brief WriteGattDescriptor
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] unk2 Unknown
|
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
* @param[in] id2 \ref BtdrvGattId
|
* @param[in] id2 \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
|
||||||
*/
|
*/
|
||||||
Result btdrvWriteGattDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size);
|
Result btdrvWriteGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RegisterGattNotification
|
* @brief RegisterGattNotification
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
*/
|
*/
|
||||||
Result btdrvRegisterGattNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btdrvRegisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief UnregisterGattNotification
|
* @brief UnregisterGattNotification
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] flag Flag
|
* @param[in] connection_handle ConnectionHandle
|
||||||
* @param[in] unk Unknown
|
* @param[in] primary_service PrimaryService
|
||||||
* @param[in] id0 \ref BtdrvGattId
|
* @param[in] id0 \ref BtdrvGattId
|
||||||
* @param[in] id1 \ref BtdrvGattId
|
* @param[in] id1 \ref BtdrvGattId
|
||||||
*/
|
*/
|
||||||
Result btdrvUnregisterGattNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
Result btdrvUnregisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetLeHidEventInfo
|
* @brief GetLeHidEventInfo
|
||||||
|
@ -141,7 +141,7 @@ typedef struct {
|
|||||||
|
|
||||||
/// BleConnectionInfo
|
/// BleConnectionInfo
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 id; ///< Id, 0xFFFFFFFF ([5.0.0-5.0.2] 0xFFFF) is invalid.
|
u32 connection_handle; ///< ConnectionHandle, 0xFFFFFFFF ([5.0.0-5.0.2] 0xFFFF) is invalid.
|
||||||
BtdrvAddress addr; ///< \ref BtdrvAddress
|
BtdrvAddress addr; ///< \ref BtdrvAddress
|
||||||
u8 pad[2]; ///< Padding
|
u8 pad[2]; ///< Padding
|
||||||
} BtdrvBleConnectionInfo;
|
} BtdrvBleConnectionInfo;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file btm.h
|
* @file btm.h
|
||||||
* @brief btm service IPC wrapper.
|
* @brief btm service IPC wrapper.
|
||||||
|
* @note See also: https://switchbrew.org/wiki/BTM_services
|
||||||
* @author yellows8
|
* @author yellows8
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -354,9 +355,9 @@ Result btmBleOverrideConnection(u32 id);
|
|||||||
/**
|
/**
|
||||||
* @brief BleDisconnect
|
* @brief BleDisconnect
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id This must match a BtdrvBleConnectionInfo::id from \ref btmBleGetConnectionState. [5.1.0+] 0xFFFFFFFF is invalid.
|
* @param[in] connection_handle This must match a BtdrvBleConnectionInfo::id from \ref btmBleGetConnectionState. [5.1.0+] 0xFFFFFFFF is invalid.
|
||||||
*/
|
*/
|
||||||
Result btmBleDisconnect(u32 id);
|
Result btmBleDisconnect(u32 connection_handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BleGetConnectionState
|
* @brief BleGetConnectionState
|
||||||
@ -385,18 +386,18 @@ Result btmAcquireBlePairingEvent(Event* out_event);
|
|||||||
/**
|
/**
|
||||||
* @brief BlePairDevice
|
* @brief BlePairDevice
|
||||||
* @note Only available on [5.1.0+].
|
* @note Only available on [5.1.0+].
|
||||||
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
|
||||||
*/
|
*/
|
||||||
Result btmBlePairDevice(BtdrvBleAdvertisePacketParameter param, u32 id);
|
Result btmBlePairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BleUnpairDeviceOnBoth
|
* @brief BleUnpairDeviceOnBoth
|
||||||
* @note Only available on [5.1.0+].
|
* @note Only available on [5.1.0+].
|
||||||
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
|
||||||
*/
|
*/
|
||||||
Result btmBleUnpairDeviceOnBoth(BtdrvBleAdvertisePacketParameter param, u32 id);
|
Result btmBleUnpairDeviceOnBoth(u32 connection_handle, BtdrvBleAdvertisePacketParameter param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BleUnPairDevice
|
* @brief BleUnPairDevice
|
||||||
@ -427,65 +428,65 @@ Result btmAcquireBleServiceDiscoveryEvent(Event* out_event);
|
|||||||
/**
|
/**
|
||||||
* @brief GetGattServices
|
* @brief GetGattServices
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[out] services Output array of \ref BtmGattService.
|
* @param[out] services Output array of \ref BtmGattService.
|
||||||
* @param[in] count Size of the services array in entries. The max is 100.
|
* @param[in] count Size of the services array in entries. The max is 100.
|
||||||
* @param[out] total_out Total output entries.
|
* @param[out] total_out Total output entries.
|
||||||
*/
|
*/
|
||||||
Result btmGetGattServices(u32 id, BtmGattService *services, u8 count, u8 *total_out);
|
Result btmGetGattServices(u32 connection_handle, BtmGattService *services, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Same as \ref btmGetGattServices except this only returns the \ref BtmGattService which matches the input \ref BtdrvGattAttributeUuid.
|
* @brief Same as \ref btmGetGattServices except this only returns the \ref BtmGattService which matches the input \ref BtdrvGattAttributeUuid.
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
* @param[out] service \ref BtmGattService
|
* @param[out] service \ref BtmGattService
|
||||||
* @param[out] flag Whether a \ref BtmGattService was returned.
|
* @param[out] flag Whether a \ref BtmGattService was returned.
|
||||||
*/
|
*/
|
||||||
Result btmGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag);
|
Result btmGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Same as \ref btmGetGattServices except this only returns \ref BtmGattService entries where various checks pass with u16 fields.
|
* @brief Same as \ref btmGetGattServices except this only returns \ref BtmGattService entries where various checks pass with u16 fields.
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] unk1 Unknown
|
* @param[in] handle Handle
|
||||||
* @param[out] services \ref BtmGattService
|
* @param[out] services \ref BtmGattService
|
||||||
* @param[in] count Size of the services array in entries. The max is 100.
|
* @param[in] count Size of the services array in entries. The max is 100.
|
||||||
* @param[out] out Output value.
|
* @param[out] out Output value.
|
||||||
*/
|
*/
|
||||||
Result btmGetGattIncludedServices(u32 id, u16 unk1, BtmGattService *services, u8 count, u8 *out);
|
Result btmGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is similar to \ref btmGetGattIncludedServices except this only returns 1 \ref BtmGattService.
|
* @brief This is similar to \ref btmGetGattIncludedServices except this only returns 1 \ref BtmGattService.
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] unk1 Unknown
|
* @param[in] handle Handle
|
||||||
* @param[out] service \ref BtmGattService
|
* @param[out] service \ref BtmGattService
|
||||||
* @param[out] flag Whether a \ref BtmGattService was returned.
|
* @param[out] flag Whether a \ref BtmGattService was returned.
|
||||||
*/
|
*/
|
||||||
Result btmGetBelongingService(u32 id, u16 unk1, BtmGattService *service, bool *flag);
|
Result btmGetBelongingService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetGattCharacteristics
|
* @brief GetGattCharacteristics
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] unk1 This controls which \ref BtmGattCharacteristic entries to return.
|
* @param[in] handle This controls which \ref BtmGattCharacteristic entries to return.
|
||||||
* @param[out] characteristics \ref BtmGattCharacteristic
|
* @param[out] characteristics \ref BtmGattCharacteristic
|
||||||
* @param[in] count Size of the characteristics array in entries. The max is 100.
|
* @param[in] count Size of the characteristics array in entries. The max is 100.
|
||||||
* @param[out] total_out Total output entries.
|
* @param[out] total_out Total output entries.
|
||||||
*/
|
*/
|
||||||
Result btmGetGattCharacteristics(u32 id, u16 unk1, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out);
|
Result btmGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetGattDescriptors
|
* @brief GetGattDescriptors
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] unk1 This controls which \ref BtmGattDescriptor entries to return.
|
* @param[in] handle This controls which \ref BtmGattDescriptor entries to return.
|
||||||
* @param[out] descriptors \ref BtmGattDescriptor
|
* @param[out] descriptors \ref BtmGattDescriptor
|
||||||
* @param[in] count Size of the descriptors array in entries. The max is 100.
|
* @param[in] count Size of the descriptors array in entries. The max is 100.
|
||||||
* @param[out] total_out Total output entries.
|
* @param[out] total_out Total output entries.
|
||||||
*/
|
*/
|
||||||
Result btmGetGattDescriptors(u32 id, u16 unk1, BtmGattDescriptor *descriptors, u8 count, u8 *total_out);
|
Result btmGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief AcquireBleMtuConfigEvent
|
* @brief AcquireBleMtuConfigEvent
|
||||||
@ -498,18 +499,18 @@ Result btmAcquireBleMtuConfigEvent(Event* out_event);
|
|||||||
/**
|
/**
|
||||||
* @brief ConfigureBleMtu
|
* @brief ConfigureBleMtu
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[in] mtu MTU
|
* @param[in] mtu MTU
|
||||||
*/
|
*/
|
||||||
Result btmConfigureBleMtu(u32 id, u16 mtu);
|
Result btmConfigureBleMtu(u32 connection_handle, u16 mtu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetBleMtu
|
* @brief GetBleMtu
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
* @param[in] id Same as \ref btmBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmBleDisconnect.
|
||||||
* @param[out] out Output MTU.
|
* @param[out] out Output MTU.
|
||||||
*/
|
*/
|
||||||
Result btmGetBleMtu(u32 id, u16 *out);
|
Result btmGetBleMtu(u32 connection_handle, u16 *out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RegisterBleGattDataPath
|
* @brief RegisterBleGattDataPath
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
* @file btmu.h
|
* @file btmu.h
|
||||||
* @brief btm:u (btm user) service IPC wrapper.
|
* @brief btm:u (btm user) service IPC wrapper.
|
||||||
* @note Only available on [5.0.0+].
|
* @note Only available on [5.0.0+].
|
||||||
|
* @note See also btdev.
|
||||||
|
* @note See also: https://switchbrew.org/wiki/BTM_services
|
||||||
* @author yellows8
|
* @author yellows8
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -122,9 +124,9 @@ Result btmuBleConnect(BtdrvAddress addr);
|
|||||||
/**
|
/**
|
||||||
* @brief BleDisconnect
|
* @brief BleDisconnect
|
||||||
* @note This is similar to \ref btmBleDisconnect.
|
* @note This is similar to \ref btmBleDisconnect.
|
||||||
* @param[in] id This must match a BtdrvBleConnectionInfo::id from \ref btmuBleGetConnectionState. [5.1.0+] 0xFFFFFFFF is invalid.
|
* @param[in] connection_handle This must match a BtdrvBleConnectionInfo::connection_handle from \ref btmuBleGetConnectionState. [5.1.0+] 0xFFFFFFFF is invalid.
|
||||||
*/
|
*/
|
||||||
Result btmuBleDisconnect(u32 id);
|
Result btmuBleDisconnect(u32 connection_handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BleGetConnectionState
|
* @brief BleGetConnectionState
|
||||||
@ -146,18 +148,18 @@ Result btmuAcquireBlePairingEvent(Event* out_event);
|
|||||||
/**
|
/**
|
||||||
* @brief BlePairDevice
|
* @brief BlePairDevice
|
||||||
* @note This is similar to \ref btmBlePairDevice.
|
* @note This is similar to \ref btmBlePairDevice.
|
||||||
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
|
||||||
*/
|
*/
|
||||||
Result btmuBlePairDevice(BtdrvBleAdvertisePacketParameter param, u32 id);
|
Result btmuBlePairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BleUnPairDevice
|
* @brief BleUnPairDevice
|
||||||
* @note This is similar to \ref btmBleUnpairDeviceOnBoth.
|
* @note This is similar to \ref btmBleUnpairDeviceOnBoth.
|
||||||
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
* @param[in] param \ref BtdrvBleAdvertisePacketParameter
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
|
||||||
*/
|
*/
|
||||||
Result btmuBleUnPairDevice(BtdrvBleAdvertisePacketParameter param, u32 id);
|
Result btmuBleUnPairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BleUnPairDevice2
|
* @brief BleUnPairDevice2
|
||||||
@ -188,65 +190,65 @@ Result btmuAcquireBleServiceDiscoveryEvent(Event* out_event);
|
|||||||
/**
|
/**
|
||||||
* @brief GetGattServices
|
* @brief GetGattServices
|
||||||
* @note This is similar to \ref btmGetGattServices.
|
* @note This is similar to \ref btmGetGattServices.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[out] services Output array of \ref BtmGattService.
|
* @param[out] services Output array of \ref BtmGattService.
|
||||||
* @param[in] count Size of the services array in entries. The max is 100.
|
* @param[in] count Size of the services array in entries. The max is 100.
|
||||||
* @param[out] total_out Total output entries.
|
* @param[out] total_out Total output entries.
|
||||||
*/
|
*/
|
||||||
Result btmuGetGattServices(u32 id, BtmGattService *services, u8 count, u8 *total_out);
|
Result btmuGetGattServices(u32 connection_handle, BtmGattService *services, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Same as \ref btmuGetGattServices except this only returns the \ref BtmGattService which matches the input \ref BtdrvGattAttributeUuid.
|
* @brief Same as \ref btmuGetGattServices except this only returns the \ref BtmGattService which matches the input \ref BtdrvGattAttributeUuid.
|
||||||
* @note This is similar to \ref btmGetGattService.
|
* @note This is similar to \ref btmGetGattService.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||||
* @param[out] service \ref BtmGattService
|
* @param[out] service \ref BtmGattService
|
||||||
* @param[out] flag Whether a \ref BtmGattService was returned.
|
* @param[out] flag Whether a \ref BtmGattService was returned.
|
||||||
*/
|
*/
|
||||||
Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag);
|
Result btmuGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Same as \ref btmuGetGattServices except this only returns \ref BtmGattService entries where various checks pass with u16 fields.
|
* @brief Same as \ref btmuGetGattServices except this only returns \ref BtmGattService entries where various checks pass with u16 fields.
|
||||||
* @note This is similar to \ref btmGetGattIncludedServices.
|
* @note This is similar to \ref btmGetGattIncludedServices.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] unk1 Unknown
|
* @param[in] handle Handle
|
||||||
* @param[out] services \ref BtmGattService
|
* @param[out] services \ref BtmGattService
|
||||||
* @param[in] count Size of the services array in entries. The max is 100.
|
* @param[in] count Size of the services array in entries. The max is 100.
|
||||||
* @param[out] out Output value.
|
* @param[out] out Output value.
|
||||||
*/
|
*/
|
||||||
Result btmuGetGattIncludedServices(u32 id, u16 unk1, BtmGattService *services, u8 count, u8 *out);
|
Result btmuGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is similar to \ref btmuGetGattIncludedServices except this only returns 1 \ref BtmGattService.
|
* @brief This is similar to \ref btmuGetGattIncludedServices except this only returns 1 \ref BtmGattService.
|
||||||
* @note This is similar to \ref btmGetBelongingService.
|
* @note This is similar to \ref btmGetBelongingService.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] unk1 Unknown
|
* @param[in] handle Handle
|
||||||
* @param[out] service \ref BtmGattService
|
* @param[out] service \ref BtmGattService
|
||||||
* @param[out] flag Whether a \ref BtmGattService was returned.
|
* @param[out] flag Whether a \ref BtmGattService was returned.
|
||||||
*/
|
*/
|
||||||
Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmGattService *service, bool *flag);
|
Result btmuGetBelongingGattService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetGattCharacteristics
|
* @brief GetGattCharacteristics
|
||||||
* @note This is similar to \ref btmGetGattCharacteristics.
|
* @note This is similar to \ref btmGetGattCharacteristics.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] unk1 This controls which \ref BtmGattCharacteristic entries to return.
|
* @param[in] handle This controls which \ref BtmGattCharacteristic entries to return.
|
||||||
* @param[out] characteristics \ref BtmGattCharacteristic
|
* @param[out] characteristics \ref BtmGattCharacteristic
|
||||||
* @param[in] count Size of the characteristics array in entries. The max is 100.
|
* @param[in] count Size of the characteristics array in entries. The max is 100.
|
||||||
* @param[out] total_out Total output entries.
|
* @param[out] total_out Total output entries.
|
||||||
*/
|
*/
|
||||||
Result btmuGetGattCharacteristics(u32 id, u16 unk1, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out);
|
Result btmuGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetGattDescriptors
|
* @brief GetGattDescriptors
|
||||||
* @note This is similar to \ref btmGetGattDescriptors.
|
* @note This is similar to \ref btmGetGattDescriptors.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] unk1 This controls which \ref BtmGattDescriptor entries to return.
|
* @param[in] handle This controls which \ref BtmGattDescriptor entries to return.
|
||||||
* @param[out] descriptors \ref BtmGattDescriptor
|
* @param[out] descriptors \ref BtmGattDescriptor
|
||||||
* @param[in] count Size of the descriptors array in entries. The max is 100.
|
* @param[in] count Size of the descriptors array in entries. The max is 100.
|
||||||
* @param[out] total_out Total output entries.
|
* @param[out] total_out Total output entries.
|
||||||
*/
|
*/
|
||||||
Result btmuGetGattDescriptors(u32 id, u16 unk1, BtmGattDescriptor *descriptors, u8 count, u8 *total_out);
|
Result btmuGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief AcquireBleMtuConfigEvent
|
* @brief AcquireBleMtuConfigEvent
|
||||||
@ -259,18 +261,18 @@ Result btmuAcquireBleMtuConfigEvent(Event* out_event);
|
|||||||
/**
|
/**
|
||||||
* @brief ConfigureBleMtu
|
* @brief ConfigureBleMtu
|
||||||
* @note This is similar to \ref btmConfigureBleMtu.
|
* @note This is similar to \ref btmConfigureBleMtu.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[in] mtu MTU
|
* @param[in] mtu MTU
|
||||||
*/
|
*/
|
||||||
Result btmuConfigureBleMtu(u32 id, u16 mtu);
|
Result btmuConfigureBleMtu(u32 connection_handle, u16 mtu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetBleMtu
|
* @brief GetBleMtu
|
||||||
* @note This is similar to \ref btmGetBleMtu.
|
* @note This is similar to \ref btmGetBleMtu.
|
||||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
* @param[in] connection_handle Same as \ref btmuBleDisconnect.
|
||||||
* @param[out] out Output MTU.
|
* @param[out] out Output MTU.
|
||||||
*/
|
*/
|
||||||
Result btmuGetBleMtu(u32 id, u16 *out);
|
Result btmuGetBleMtu(u32 connection_handle, u16 *out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RegisterBleGattDataPath
|
* @brief RegisterBleGattDataPath
|
||||||
|
@ -156,12 +156,12 @@ Result btdevAcquireBlePairingEvent(Event* out_event) {
|
|||||||
return btmuAcquireBlePairingEvent(out_event);
|
return btmuAcquireBlePairingEvent(out_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevPairGattServer(BtdrvBleAdvertisePacketParameter param, u32 id) {
|
Result btdevPairGattServer(u32 connection_handle, BtdrvBleAdvertisePacketParameter param) {
|
||||||
return btmuBlePairDevice(param, id);
|
return btmuBlePairDevice(connection_handle, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevUnpairGattServer(BtdrvBleAdvertisePacketParameter param, u32 id) {
|
Result btdevUnpairGattServer(u32 connection_handle, BtdrvBleAdvertisePacketParameter param) {
|
||||||
return btmuBleUnPairDevice(param, id);
|
return btmuBleUnPairDevice(connection_handle, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevUnpairGattServer2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param) {
|
Result btdevUnpairGattServer2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param) {
|
||||||
@ -176,13 +176,13 @@ Result btdevAcquireBleMtuConfigEvent(Event* out_event) {
|
|||||||
return btmuAcquireBleMtuConfigEvent(out_event);
|
return btmuAcquireBleMtuConfigEvent(out_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevConfigureBleMtu(u32 id, u16 mtu) {
|
Result btdevConfigureBleMtu(u32 connection_handle, u16 mtu) {
|
||||||
if (mtu < 0x18 || mtu > 0x200) return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would Abort here, sdknso impls the same thing in the btmu func as well (but we don't).
|
if (mtu < 0x18 || mtu > 0x200) return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would Abort here, sdknso impls the same thing in the btmu func as well (but we don't).
|
||||||
return btmuConfigureBleMtu(id, mtu);
|
return btmuConfigureBleMtu(connection_handle, mtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevGetBleMtu(u32 id, u16 *out) {
|
Result btdevGetBleMtu(u32 connection_handle, u16 *out) {
|
||||||
return btmuGetBleMtu(id, out);
|
return btmuGetBleMtu(connection_handle, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevAcquireBleGattOperationEvent(Event* out_event) {
|
Result btdevAcquireBleGattOperationEvent(Event* out_event) {
|
||||||
@ -292,7 +292,7 @@ Result btdevReadGattCharacteristic(BtdevGattCharacteristic *c) {
|
|||||||
btdevGattAttributeGetUuid(&tmpservice.attr, &gattid0.uuid);
|
btdevGattAttributeGetUuid(&tmpservice.attr, &gattid0.uuid);
|
||||||
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(c);
|
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(c);
|
||||||
btdevGattAttributeGetUuid(&c->attr, &gattid1.uuid);
|
btdevGattAttributeGetUuid(&c->attr, &gattid1.uuid);
|
||||||
rc = btLeClientReadCharacteristic(btdevGattServiceIsPrimaryService(&tmpservice), 0, btdevGattAttributeGetConnectionHandle(&c->attr), &gattid0, &gattid1);
|
rc = btLeClientReadCharacteristic(btdevGattAttributeGetConnectionHandle(&c->attr), btdevGattServiceIsPrimaryService(&tmpservice), &gattid0, &gattid1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -319,7 +319,7 @@ Result btdevWriteGattCharacteristic(BtdevGattCharacteristic *c) {
|
|||||||
btdevGattAttributeGetUuid(&tmpservice.attr, &gattid0.uuid);
|
btdevGattAttributeGetUuid(&tmpservice.attr, &gattid0.uuid);
|
||||||
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(c);
|
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(c);
|
||||||
btdevGattAttributeGetUuid(&c->attr, &gattid1.uuid);
|
btdevGattAttributeGetUuid(&c->attr, &gattid1.uuid);
|
||||||
rc = btLeClientWriteCharacteristic(btdevGattServiceIsPrimaryService(&tmpservice), 0, (prop & BIT(3)) != 0, btdevGattAttributeGetConnectionHandle(&c->attr), &gattid0, &gattid1, value, value_size);
|
rc = btLeClientWriteCharacteristic(btdevGattAttributeGetConnectionHandle(&c->attr), btdevGattServiceIsPrimaryService(&tmpservice), &gattid0, &gattid1, value, value_size, 0, (prop & BIT(3)) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -342,11 +342,11 @@ Result btdevEnableGattCharacteristicNotification(BtdevGattCharacteristic *c, boo
|
|||||||
btdevGattAttributeGetUuid(&tmpservice.attr, &gattid0.uuid);
|
btdevGattAttributeGetUuid(&tmpservice.attr, &gattid0.uuid);
|
||||||
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(c);
|
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(c);
|
||||||
btdevGattAttributeGetUuid(&c->attr, &gattid1.uuid);
|
btdevGattAttributeGetUuid(&c->attr, &gattid1.uuid);
|
||||||
bool is_primary = btdevGattServiceIsPrimaryService(&tmpservice);
|
bool primary_service = btdevGattServiceIsPrimaryService(&tmpservice);
|
||||||
if (flag)
|
if (flag)
|
||||||
rc = btLeClientRegisterNotification(is_primary, connection_handle, &gattid0, &gattid1);
|
rc = btLeClientRegisterNotification(connection_handle, primary_service, &gattid0, &gattid1);
|
||||||
else
|
else
|
||||||
rc = btLeClientDeregisterNotification(is_primary, connection_handle, &gattid0, &gattid1);
|
rc = btLeClientDeregisterNotification(connection_handle, primary_service, &gattid0, &gattid1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -369,7 +369,7 @@ Result btdevReadGattDescriptor(BtdevGattDescriptor *d) {
|
|||||||
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(&tmpcharacteristic);
|
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(&tmpcharacteristic);
|
||||||
btdevGattAttributeGetUuid(&tmpcharacteristic.attr, &gattid1.uuid);
|
btdevGattAttributeGetUuid(&tmpcharacteristic.attr, &gattid1.uuid);
|
||||||
btdevGattAttributeGetUuid(&d->attr, &gattid2.uuid);
|
btdevGattAttributeGetUuid(&d->attr, &gattid2.uuid);
|
||||||
rc = btLeClientReadDescriptor(btdevGattServiceIsPrimaryService(&tmpservice), 0, btdevGattAttributeGetConnectionHandle(&d->attr), &gattid0, &gattid1, &gattid2);
|
rc = btLeClientReadDescriptor(btdevGattAttributeGetConnectionHandle(&d->attr), btdevGattServiceIsPrimaryService(&tmpservice), &gattid0, &gattid1, &gattid2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -396,7 +396,7 @@ Result btdevWriteGattDescriptor(BtdevGattDescriptor *d) {
|
|||||||
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(&tmpcharacteristic);
|
gattid1.instance_id = btdevGattCharacteristicGetInstanceId(&tmpcharacteristic);
|
||||||
btdevGattAttributeGetUuid(&tmpcharacteristic.attr, &gattid1.uuid);
|
btdevGattAttributeGetUuid(&tmpcharacteristic.attr, &gattid1.uuid);
|
||||||
btdevGattAttributeGetUuid(&d->attr, &gattid2.uuid);
|
btdevGattAttributeGetUuid(&d->attr, &gattid2.uuid);
|
||||||
rc = btLeClientWriteDescriptor(btdevGattServiceIsPrimaryService(&tmpservice), 0, btdevGattAttributeGetConnectionHandle(&d->attr), &gattid0, &gattid1, &gattid2, value, value_size);
|
rc = btLeClientWriteDescriptor(btdevGattAttributeGetConnectionHandle(&d->attr), btdevGattServiceIsPrimaryService(&tmpservice), &gattid0, &gattid1, &gattid2, value, value_size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -441,7 +441,7 @@ Result btdevGattServiceGetIncludedServices(BtdevGattService *s, BtdevGattService
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdevGattServiceGetCharacteristics(BtdevGattService *s, BtdevGattCharacteristic *characteristic, u8 count, u8 *total_out) {
|
Result btdevGattServiceGetCharacteristics(BtdevGattService *s, BtdevGattCharacteristic *characteristics, u8 count, u8 *total_out) {
|
||||||
Result rc=0;
|
Result rc=0;
|
||||||
BtmGattCharacteristic tmpcharacteristics[100]={0};
|
BtmGattCharacteristic tmpcharacteristics[100]={0};
|
||||||
u8 tmp_total_out=0;
|
u8 tmp_total_out=0;
|
||||||
@ -450,7 +450,7 @@ Result btdevGattServiceGetCharacteristics(BtdevGattService *s, BtdevGattCharacte
|
|||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
if (tmp_total_out > count) tmp_total_out = count;
|
if (tmp_total_out > count) tmp_total_out = count;
|
||||||
for (u8 i=0; i<tmp_total_out; i++) {
|
for (u8 i=0; i<tmp_total_out; i++) {
|
||||||
btdevGattCharacteristicCreate(characteristic, &tmpcharacteristics[i].uuid, tmpcharacteristics[i].handle, s->attr.connection_handle, tmpcharacteristics[i].instance_id, tmpcharacteristics[i].properties);
|
btdevGattCharacteristicCreate(&characteristics[i], &tmpcharacteristics[i].uuid, tmpcharacteristics[i].handle, s->attr.connection_handle, tmpcharacteristics[i].instance_id, tmpcharacteristics[i].properties);
|
||||||
}
|
}
|
||||||
if (total_out) *total_out = tmp_total_out;
|
if (total_out) *total_out = tmp_total_out;
|
||||||
}
|
}
|
||||||
|
@ -24,50 +24,50 @@ Service* btGetServiceSession(void) {
|
|||||||
return &g_btSrv;
|
return &g_btSrv;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientReadCharacteristic(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btLeClientReadCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { flag!=0, unk, {0}, unk2, *id0, *id1, appletGetAppletResourceUserId() };
|
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 0, in,
|
return serviceDispatchIn(&g_btSrv, 0, in,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientReadDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2) {
|
Result btLeClientReadDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
BtdrvGattId id2;
|
BtdrvGattId id2;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { flag!=0, unk, {0}, unk2, *id0, *id1, *id2, appletGetAppletResourceUserId() };
|
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btSrv, 1, in,
|
return serviceDispatchIn(&g_btSrv, 1, in,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientWriteCharacteristic(bool flag, u8 unk, bool flag2, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size) {
|
Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 flag2;
|
u8 flag;
|
||||||
u8 pad;
|
u8 pad;
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { flag!=0, unk, flag2!=0, 0, unk2, *id0, *id1, appletGetAppletResourceUserId() };
|
} in = { primary_service!=0, unk, flag!=0, 0, connection_handle, *id0, *id1, 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(bool flag, u8 unk, bool flag2, u32 unk2, co
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientWriteDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size) {
|
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) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
BtdrvGattId id2;
|
BtdrvGattId id2;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { flag!=0, unk, {0}, unk2, *id0, *id1, *id2, appletGetAppletResourceUserId() };
|
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2, 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,27 +95,27 @@ Result btLeClientWriteDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btLeClientNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
|
static Result _btLeClientNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 pad[3];
|
u8 pad[3];
|
||||||
u32 unk;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { flag!=0, {0}, unk, *id0, *id1, appletGetAppletResourceUserId() };
|
} in = { primary_service!=0, {0}, connection_handle, *id0, *id1, 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(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btLeClientRegisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
||||||
return _btLeClientNotification(flag, unk, id0, id1, 4);
|
return _btLeClientNotification(connection_handle, primary_service, id0, id1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeClientDeregisterNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btLeClientDeregisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
||||||
return _btLeClientNotification(flag, unk, id0, id1, 5);
|
return _btLeClientNotification(connection_handle, primary_service, id0, id1, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size) {
|
Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size) {
|
||||||
@ -135,7 +135,7 @@ Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvG
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btLeSendIndication(u8 unk, bool flag, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size) {
|
Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size, bool flag) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 flag;
|
u8 flag;
|
||||||
|
@ -129,14 +129,14 @@ static Result _btdrvCmdOutU32OutBuf(void* buffer, size_t size, u32 *out, u32 cmd
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btdrvGattNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
|
static Result _btdrvGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 pad[3];
|
u8 pad[3];
|
||||||
u32 unk;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
} in = { flag!=0, {0}, unk, *id0, *id1 };
|
} in = { primary_service!=0, {0}, connection_handle, *id0, *id1 };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
||||||
}
|
}
|
||||||
@ -998,55 +998,55 @@ Result btdrvUnregisterGattDataPath(const BtdrvGattAttributeUuid *uuid) {
|
|||||||
return _btdrvCmdInUuidNoOut(uuid, cmd_id);
|
return _btdrvCmdInUuidNoOut(uuid, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvReadGattCharacteristic(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btdrvReadGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 89 : 90;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 89 : 90;
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
} in = { flag!=0, unk, {0}, unk2, *id0, *id1};
|
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1};
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvReadGattDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2) {
|
Result btdrvReadGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 90 : 91;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 90 : 91;
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
BtdrvGattId id2;
|
BtdrvGattId id2;
|
||||||
} in = { flag!=0, unk, {0}, unk2, *id0, *id1, *id2 };
|
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2 };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvWriteGattCharacteristic(bool flag, u8 unk, bool flag2, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size) {
|
Result btdrvWriteGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 91 : 92;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 91 : 92;
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 flag2;
|
u8 flag;
|
||||||
u8 pad;
|
u8 pad;
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
} in = { flag!=0, unk, flag2!=0, 0, unk2, *id0, *id1 };
|
} in = { primary_service!=0, unk, flag!=0, 0, connection_handle, *id0, *id1 };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in,
|
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -1054,20 +1054,20 @@ Result btdrvWriteGattCharacteristic(bool flag, u8 unk, bool flag2, u32 unk2, con
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvWriteGattDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size) {
|
Result btdrvWriteGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 92 : 93;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 92 : 93;
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u8 flag;
|
u8 primary_service;
|
||||||
u8 unk;
|
u8 unk;
|
||||||
u8 pad[2];
|
u8 pad[2];
|
||||||
u32 unk2;
|
u32 connection_handle;
|
||||||
BtdrvGattId id0;
|
BtdrvGattId id0;
|
||||||
BtdrvGattId id1;
|
BtdrvGattId id1;
|
||||||
BtdrvGattId id2;
|
BtdrvGattId id2;
|
||||||
} in = { flag!=0, unk, {0}, unk2, *id0, *id1, *id2 };
|
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2 };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in,
|
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -1075,19 +1075,19 @@ Result btdrvWriteGattDescriptor(bool flag, u8 unk, u32 unk2, const BtdrvGattId *
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvRegisterGattNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btdrvRegisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
return _btdrvGattNotification(flag, unk, id0, id1, 94);
|
return _btdrvGattNotification(connection_handle, primary_service, id0, id1, 94);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvUnregisterGattNotification(bool flag, u32 unk, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
Result btdrvUnregisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 93 : 95;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 93 : 95;
|
||||||
|
|
||||||
return _btdrvGattNotification(flag, unk, id0, id1, cmd_id);
|
return _btdrvGattNotification(connection_handle, primary_service, id0, id1, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btdrvGetLeHidEventInfo(void* buffer, size_t size, u32 *type) {
|
Result btdrvGetLeHidEventInfo(void* buffer, size_t size, u32 *type) {
|
||||||
|
@ -115,21 +115,21 @@ static Result _btmGetBleScanResults(BtdrvBleScanResult *results, u8 count, u8 *t
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btmBlePairDevice(BtdrvBleAdvertisePacketParameter param, u32 id, u32 cmd_id) {
|
static Result _btmBlePairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
BtdrvBleAdvertisePacketParameter param;
|
BtdrvBleAdvertisePacketParameter param;
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
} in = { param, id };
|
} in = { param, connection_handle };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btmSrv, cmd_id, in);
|
return serviceDispatchIn(&g_btmSrv, cmd_id, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btmGetGattServiceData(u32 id, u16 unk1, void* buffer, size_t entrysize, u8 count, u8 *out, u32 cmd_id) {
|
static Result _btmGetGattServiceData(u32 connection_handle, u16 handle, void* buffer, size_t entrysize, u8 count, u8 *out, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
u16 unk1;
|
u16 handle;
|
||||||
u16 pad;
|
u16 pad;
|
||||||
u32 unk0;
|
u32 connection_handle;
|
||||||
} in = { unk1, 0, id };
|
} in = { handle, 0, connection_handle };
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_btmSrv, cmd_id, in, *out,
|
return serviceDispatchInOut(&g_btmSrv, cmd_id, in, *out,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
@ -362,12 +362,12 @@ Result btmBleOverrideConnection(u32 id) {
|
|||||||
return _btmCmdInU32NoOut(id, 36);
|
return _btmCmdInU32NoOut(id, 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmBleDisconnect(u32 id) {
|
Result btmBleDisconnect(u32 connection_handle) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 25 : 37;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 25 : 37;
|
||||||
|
|
||||||
return _btmCmdInU32NoOut(id, cmd_id);
|
return _btmCmdInU32NoOut(connection_handle, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmBleGetConnectionState(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out) {
|
Result btmBleGetConnectionState(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out) {
|
||||||
@ -400,18 +400,18 @@ Result btmAcquireBlePairingEvent(Event* out_event) {
|
|||||||
return _btmCmdGetEventOutFlag(out_event, true, cmd_id);
|
return _btmCmdGetEventOutFlag(out_event, true, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmBlePairDevice(BtdrvBleAdvertisePacketParameter param, u32 id) {
|
Result btmBlePairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param) {
|
||||||
if (hosversionBefore(5,1,0))
|
if (hosversionBefore(5,1,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
return _btmBlePairDevice(param, id, 41);
|
return _btmBlePairDevice(connection_handle, param, 41);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmBleUnpairDeviceOnBoth(BtdrvBleAdvertisePacketParameter param, u32 id) {
|
Result btmBleUnpairDeviceOnBoth(u32 connection_handle, BtdrvBleAdvertisePacketParameter param) {
|
||||||
if (hosversionBefore(5,1,0))
|
if (hosversionBefore(5,1,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
return _btmBlePairDevice(param, id, 42);
|
return _btmBlePairDevice(connection_handle, param, 42);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmBleUnPairDevice(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param) {
|
Result btmBleUnPairDevice(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param) {
|
||||||
@ -443,26 +443,26 @@ Result btmAcquireBleServiceDiscoveryEvent(Event* out_event) {
|
|||||||
return _btmCmdGetEventOutFlag(out_event, true, 45);
|
return _btmCmdGetEventOutFlag(out_event, true, 45);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetGattServices(u32 id, BtmGattService *services, u8 count, u8 *total_out) {
|
Result btmGetGattServices(u32 connection_handle, BtmGattService *services, u8 count, u8 *total_out) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 29 : 46;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 29 : 46;
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_btmSrv, cmd_id, id, *total_out,
|
return serviceDispatchInOut(&g_btmSrv, cmd_id, connection_handle, *total_out,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
.buffers = { { services, sizeof(BtmGattService)*count } },
|
.buffers = { { services, sizeof(BtmGattService)*count } },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag) {
|
Result btmGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 30 : 47;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 30 : 47;
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
BtdrvGattAttributeUuid uuid;
|
BtdrvGattAttributeUuid uuid;
|
||||||
} in = { id, *uuid };
|
} in = { connection_handle, *uuid };
|
||||||
|
|
||||||
u8 tmp=0;
|
u8 tmp=0;
|
||||||
Result rc = serviceDispatchInOut(&g_btmSrv, cmd_id, in, tmp,
|
Result rc = serviceDispatchInOut(&g_btmSrv, cmd_id, in, tmp,
|
||||||
@ -473,24 +473,24 @@ Result btmGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmGattServ
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetGattIncludedServices(u32 id, u16 unk1, BtmGattService *services, u8 count, u8 *out) {
|
Result btmGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 31 : 48;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 31 : 48;
|
||||||
|
|
||||||
return _btmGetGattServiceData(id, unk1, services, sizeof(BtmGattService), count, out, cmd_id);
|
return _btmGetGattServiceData(connection_handle, handle, services, sizeof(BtmGattService), count, out, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetBelongingService(u32 id, u16 unk1, BtmGattService *service, bool *flag) {
|
Result btmGetBelongingService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 32 : 49;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 32 : 49;
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u16 unk1;
|
u16 handle;
|
||||||
u16 pad;
|
u16 pad;
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
} in = { unk1, 0, id };
|
} in = { handle, 0, connection_handle };
|
||||||
|
|
||||||
u8 tmp=0;
|
u8 tmp=0;
|
||||||
Result rc = serviceDispatchInOut(&g_btmSrv, cmd_id, in, tmp,
|
Result rc = serviceDispatchInOut(&g_btmSrv, cmd_id, in, tmp,
|
||||||
@ -501,20 +501,20 @@ Result btmGetBelongingService(u32 id, u16 unk1, BtmGattService *service, bool *f
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetGattCharacteristics(u32 id, u16 unk1, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) {
|
Result btmGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 33 : 50;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 33 : 50;
|
||||||
|
|
||||||
return _btmGetGattServiceData(id, unk1, characteristics, sizeof(BtmGattCharacteristic), count, total_out, cmd_id);
|
return _btmGetGattServiceData(connection_handle, handle, characteristics, sizeof(BtmGattCharacteristic), count, total_out, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetGattDescriptors(u32 id, u16 unk1, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) {
|
Result btmGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 34 : 51;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 34 : 51;
|
||||||
|
|
||||||
return _btmGetGattServiceData(id, unk1, descriptors, sizeof(BtmGattDescriptor), count, total_out, cmd_id);
|
return _btmGetGattServiceData(connection_handle, handle, descriptors, sizeof(BtmGattDescriptor), count, total_out, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmAcquireBleMtuConfigEvent(Event* out_event) {
|
Result btmAcquireBleMtuConfigEvent(Event* out_event) {
|
||||||
@ -525,7 +525,7 @@ Result btmAcquireBleMtuConfigEvent(Event* out_event) {
|
|||||||
return _btmCmdGetEventOutFlag(out_event, true, cmd_id);
|
return _btmCmdGetEventOutFlag(out_event, true, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmConfigureBleMtu(u32 id, u16 mtu) {
|
Result btmConfigureBleMtu(u32 connection_handle, u16 mtu) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 36 : 53;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 36 : 53;
|
||||||
@ -533,18 +533,18 @@ Result btmConfigureBleMtu(u32 id, u16 mtu) {
|
|||||||
const struct {
|
const struct {
|
||||||
u16 mtu;
|
u16 mtu;
|
||||||
u16 pad;
|
u16 pad;
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
} in = { mtu, 0, id };
|
} in = { mtu, 0, connection_handle };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btmSrv, cmd_id, in);
|
return serviceDispatchIn(&g_btmSrv, cmd_id, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetBleMtu(u32 id, u16 *out) {
|
Result btmGetBleMtu(u32 connection_handle, u16 *out) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(5,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
u32 cmd_id = hosversionBefore(5,1,0) ? 37 : 54;
|
u32 cmd_id = hosversionBefore(5,1,0) ? 37 : 54;
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_btmSrv, cmd_id, id, *out);
|
return serviceDispatchInOut(&g_btmSrv, cmd_id, connection_handle, *out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmRegisterBleGattDataPath(const BtmBleDataPath *path) {
|
Result btmRegisterBleGattDataPath(const BtmBleDataPath *path) {
|
||||||
|
@ -85,22 +85,22 @@ static Result _btmuGetBleScanResults(BtdrvBleScanResult *results, u8 count, u8 *
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btmuBlePairDevice(BtdrvBleAdvertisePacketParameter param, u32 id, u32 cmd_id) {
|
static Result _btmuBlePairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
BtdrvBleAdvertisePacketParameter param;
|
BtdrvBleAdvertisePacketParameter param;
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
} in = { param, id };
|
} in = { param, connection_handle };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btmuIBtmUserCore, cmd_id, in);
|
return serviceDispatchIn(&g_btmuIBtmUserCore, cmd_id, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _btmuGetGattServiceData(u32 id, u16 unk1, void* buffer, size_t entrysize, u8 count, u8 *out, u32 cmd_id) {
|
static Result _btmuGetGattServiceData(u32 connection_handle, u16 handle, void* buffer, size_t entrysize, u8 count, u8 *out, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
u16 unk1;
|
u16 handle;
|
||||||
u16 pad;
|
u16 pad;
|
||||||
u32 unk0;
|
u32 connection_handle;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { unk1, 0, id, appletGetAppletResourceUserId() };
|
} in = { handle, 0, connection_handle, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_btmuIBtmUserCore, cmd_id, in, *out,
|
return serviceDispatchInOut(&g_btmuIBtmUserCore, cmd_id, in, *out,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
@ -188,8 +188,8 @@ Result btmuBleConnect(BtdrvAddress addr) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuBleDisconnect(u32 id) {
|
Result btmuBleDisconnect(u32 connection_handle) {
|
||||||
return _btmuCmdInU32NoOut(id, 19);
|
return _btmuCmdInU32NoOut(connection_handle, 19);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuBleGetConnectionState(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out) {
|
Result btmuBleGetConnectionState(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out) {
|
||||||
@ -205,12 +205,12 @@ Result btmuAcquireBlePairingEvent(Event* out_event) {
|
|||||||
return _btmuCmdGetEventOutFlag(out_event, true, 21);
|
return _btmuCmdGetEventOutFlag(out_event, true, 21);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuBlePairDevice(BtdrvBleAdvertisePacketParameter param, u32 id) {
|
Result btmuBlePairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param) {
|
||||||
return _btmuBlePairDevice(param, id, 22);
|
return _btmuBlePairDevice(connection_handle, param, 22);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuBleUnPairDevice(BtdrvBleAdvertisePacketParameter param, u32 id) {
|
Result btmuBleUnPairDevice(u32 connection_handle, BtdrvBleAdvertisePacketParameter param) {
|
||||||
return _btmuBlePairDevice(param, id, 23);
|
return _btmuBlePairDevice(connection_handle, param, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuBleUnPairDevice2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param) {
|
Result btmuBleUnPairDevice2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param) {
|
||||||
@ -233,12 +233,12 @@ Result btmuAcquireBleServiceDiscoveryEvent(Event* out_event) {
|
|||||||
return _btmuCmdGetEventOutFlag(out_event, true, 26);
|
return _btmuCmdGetEventOutFlag(out_event, true, 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetGattServices(u32 id, BtmGattService *services, u8 count, u8 *total_out) {
|
Result btmuGetGattServices(u32 connection_handle, BtmGattService *services, u8 count, u8 *total_out) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { id, 0, appletGetAppletResourceUserId() };
|
} in = { connection_handle, 0, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_btmuIBtmUserCore, 27, in, *total_out,
|
return serviceDispatchInOut(&g_btmuIBtmUserCore, 27, in, *total_out,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
@ -247,12 +247,12 @@ Result btmuGetGattServices(u32 id, BtmGattService *services, u8 count, u8 *total
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag) {
|
Result btmuGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtmGattService *service, bool *flag) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
BtdrvGattAttributeUuid uuid;
|
BtdrvGattAttributeUuid uuid;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { id, *uuid, appletGetAppletResourceUserId() };
|
} in = { connection_handle, *uuid, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
u8 tmp=0;
|
u8 tmp=0;
|
||||||
Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 28, in, tmp,
|
Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 28, in, tmp,
|
||||||
@ -264,17 +264,17 @@ Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmGattSer
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetGattIncludedServices(u32 id, u16 unk1, BtmGattService *services, u8 count, u8 *out) {
|
Result btmuGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out) {
|
||||||
return _btmuGetGattServiceData(id, unk1, services, sizeof(BtmGattService), count, out, 29);
|
return _btmuGetGattServiceData(connection_handle, handle, services, sizeof(BtmGattService), count, out, 29);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmGattService *service, bool *flag) {
|
Result btmuGetBelongingGattService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag) {
|
||||||
const struct {
|
const struct {
|
||||||
u16 unk1;
|
u16 handle;
|
||||||
u16 pad;
|
u16 pad;
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { unk1, 0, id, appletGetAppletResourceUserId() };
|
} in = { handle, 0, connection_handle, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
u8 tmp=0;
|
u8 tmp=0;
|
||||||
Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 30, in, tmp,
|
Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 30, in, tmp,
|
||||||
@ -286,37 +286,37 @@ Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmGattService *service, bo
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetGattCharacteristics(u32 id, u16 unk1, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) {
|
Result btmuGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) {
|
||||||
return _btmuGetGattServiceData(id, unk1, characteristics, sizeof(BtmGattCharacteristic), count, total_out, 31);
|
return _btmuGetGattServiceData(connection_handle, handle, characteristics, sizeof(BtmGattCharacteristic), count, total_out, 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetGattDescriptors(u32 id, u16 unk1, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) {
|
Result btmuGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) {
|
||||||
return _btmuGetGattServiceData(id, unk1, descriptors, sizeof(BtmGattDescriptor), count, total_out, 32);
|
return _btmuGetGattServiceData(connection_handle, handle, descriptors, sizeof(BtmGattDescriptor), count, total_out, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuAcquireBleMtuConfigEvent(Event* out_event) {
|
Result btmuAcquireBleMtuConfigEvent(Event* out_event) {
|
||||||
return _btmuCmdGetEventOutFlag(out_event, true, 33);
|
return _btmuCmdGetEventOutFlag(out_event, true, 33);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuConfigureBleMtu(u32 id, u16 mtu) {
|
Result btmuConfigureBleMtu(u32 connection_handle, u16 mtu) {
|
||||||
const struct {
|
const struct {
|
||||||
u16 mtu;
|
u16 mtu;
|
||||||
u16 pad;
|
u16 pad;
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { mtu, 0, id, appletGetAppletResourceUserId() };
|
} in = { mtu, 0, connection_handle, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchIn(&g_btmuIBtmUserCore, 34, in,
|
return serviceDispatchIn(&g_btmuIBtmUserCore, 34, in,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmuGetBleMtu(u32 id, u16 *out) {
|
Result btmuGetBleMtu(u32 connection_handle, u16 *out) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 id;
|
u32 connection_handle;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
} in = { id, 0, appletGetAppletResourceUserId() };
|
} in = { connection_handle, 0, appletGetAppletResourceUserId() };
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_btmuIBtmUserCore, 35, in, *out,
|
return serviceDispatchInOut(&g_btmuIBtmUserCore, 35, in, *out,
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
|
Loading…
Reference in New Issue
Block a user