From e9ee0b2421eedc664c7a1439da50f6d94453ca89 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 29 Dec 2020 14:46:10 -0500 Subject: [PATCH] btm/btdrv: Updated param names. --- nx/include/switch/runtime/btdev.h | 6 +++--- nx/include/switch/services/btm.h | 24 ++++++++++++------------ nx/include/switch/services/btmu.h | 24 ++++++++++++------------ nx/source/runtime/btdev.c | 12 ++++++------ nx/source/services/btm.c | 26 +++++++++++++------------- nx/source/services/btmu.c | 26 +++++++++++++------------- 6 files changed, 59 insertions(+), 59 deletions(-) diff --git a/nx/include/switch/runtime/btdev.h b/nx/include/switch/runtime/btdev.h index 7382e3f9..2ff65146 100644 --- a/nx/include/switch/runtime/btdev.h +++ b/nx/include/switch/runtime/btdev.h @@ -56,10 +56,10 @@ bool btdevGattAttributeUuidIsSame(const BtdrvGattAttributeUuid *a, const BtdrvGa Result btdevAcquireBleScanEvent(Event* out_event); /// Wrapper for \ref btmuGetBleScanFilterParameter. -Result btdevGetBleScanParameter(u16 unk, BtdrvBleAdvertisePacketParameter *out); +Result btdevGetBleScanParameter(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out); /// Wrapper for \ref btmuGetBleScanFilterParameter2. -Result btdevGetBleScanParameter2(u16 unk, BtdrvGattAttributeUuid *out); +Result btdevGetBleScanParameter2(u16 parameter_id, BtdrvGattAttributeUuid *out); /// Wrapper for \ref btdevStartBleScanGeneral. Result btdevStartBleScanGeneral(BtdrvBleAdvertisePacketParameter param); @@ -94,7 +94,7 @@ Result btdevAcquireBleConnectionStateChangedEvent(Event* out_event); Result btdevConnectToGattServer(BtdrvAddress addr); /// Wrapper for \ref btmuBleDisconnect. -Result btdevDisconnectFromGattServer(u32 id); +Result btdevDisconnectFromGattServer(u32 connection_handle); /// Wrapper for \ref btmuBleGetConnectionState. Result btdevGetBleConnectionInfoList(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out); diff --git a/nx/include/switch/services/btm.h b/nx/include/switch/services/btm.h index cac7f99b..cdcca1ea 100644 --- a/nx/include/switch/services/btm.h +++ b/nx/include/switch/services/btm.h @@ -264,18 +264,18 @@ Result btmAcquireBleScanEvent(Event* out_event); /** * @brief GetBleScanParameterGeneral * @note Only available on [5.1.0+]. - * @param[in] unk Must be value 0x1 or 0xFFFF. + * @param[in] parameter_id Must be value 0x1 or 0xFFFF. * @param[out] out \ref BtdrvBleAdvertisePacketParameter */ -Result btmGetBleScanParameterGeneral(u16 unk, BtdrvBleAdvertisePacketParameter *out); +Result btmGetBleScanParameterGeneral(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out); /** * @brief GetBleScanParameterSmartDevice * @note Only available on [5.1.0+]. - * @param[in] unk Must be value 0x2. + * @param[in] parameter_id Must be value 0x2. * @param[out] out \ref BtdrvGattAttributeUuid. The first 4-bytes is always 0. */ -Result btmGetBleScanParameterSmartDevice(u16 unk, BtdrvGattAttributeUuid *out); +Result btmGetBleScanParameterSmartDevice(u16 parameter_id, BtdrvGattAttributeUuid *out); /** * @brief StartBleScanForGeneral @@ -454,44 +454,44 @@ Result btmGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uu * @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+]. * @param[in] connection_handle Same as \ref btmBleDisconnect. - * @param[in] handle Handle + * @param[in] service_handle ServiceHandle * @param[out] services \ref BtmGattService * @param[in] count Size of the services array in entries. The max is 100. * @param[out] out Output value. */ -Result btmGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out); +Result btmGetGattIncludedServices(u32 connection_handle, u16 service_handle, BtmGattService *services, u8 count, u8 *out); /** * @brief This is similar to \ref btmGetGattIncludedServices except this only returns 1 \ref BtmGattService. * @note Only available on [5.0.0+]. * @param[in] connection_handle Same as \ref btmBleDisconnect. - * @param[in] handle Handle + * @param[in] attribute_handle AttributeHandle * @param[out] service \ref BtmGattService * @param[out] flag Whether a \ref BtmGattService was returned. */ -Result btmGetBelongingService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag); +Result btmGetBelongingService(u32 connection_handle, u16 attribute_handle, BtmGattService *service, bool *flag); /** * @brief GetGattCharacteristics * @note Only available on [5.0.0+]. * @param[in] connection_handle Same as \ref btmBleDisconnect. - * @param[in] handle This controls which \ref BtmGattCharacteristic entries to return. + * @param[in] service_handle This controls which \ref BtmGattCharacteristic entries to return. * @param[out] characteristics \ref BtmGattCharacteristic * @param[in] count Size of the characteristics array in entries. The max is 100. * @param[out] total_out Total output entries. */ -Result btmGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out); +Result btmGetGattCharacteristics(u32 connection_handle, u16 service_handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out); /** * @brief GetGattDescriptors * @note Only available on [5.0.0+]. * @param[in] connection_handle Same as \ref btmBleDisconnect. - * @param[in] handle This controls which \ref BtmGattDescriptor entries to return. + * @param[in] char_handle Characteristic handle. This controls which \ref BtmGattDescriptor entries to return. * @param[out] descriptors \ref BtmGattDescriptor * @param[in] count Size of the descriptors array in entries. The max is 100. * @param[out] total_out Total output entries. */ -Result btmGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out); +Result btmGetGattDescriptors(u32 connection_handle, u16 char_handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out); /** * @brief AcquireBleMtuConfigEvent diff --git a/nx/include/switch/services/btmu.h b/nx/include/switch/services/btmu.h index efb3a5b2..04a70cf4 100644 --- a/nx/include/switch/services/btmu.h +++ b/nx/include/switch/services/btmu.h @@ -36,18 +36,18 @@ Result btmuAcquireBleScanEvent(Event* out_event); /** * @brief GetBleScanFilterParameter * @note This is the same as \ref btmGetBleScanParameterGeneral. - * @param[in] unk Must be value 0x1 or 0xFFFF. + * @param[in] parameter_id Must be value 0x1 or 0xFFFF. * @param[out] out \ref BtdrvBleAdvertisePacketParameter */ -Result btmuGetBleScanFilterParameter(u16 unk, BtdrvBleAdvertisePacketParameter *out); +Result btmuGetBleScanFilterParameter(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out); /** * @brief GetBleScanFilterParameter2 * @note This is the same as \ref btmGetBleScanParameterSmartDevice. - * @param[in] unk Must be value 0x2. + * @param[in] parameter_id Must be value 0x2. * @param[out] out \ref BtdrvGattAttributeUuid. The first 4-bytes is always 0. */ -Result btmuGetBleScanFilterParameter2(u16 unk, BtdrvGattAttributeUuid *out); +Result btmuGetBleScanFilterParameter2(u16 parameter_id, BtdrvGattAttributeUuid *out); /** * @brief StartBleScanForGeneral @@ -211,44 +211,44 @@ Result btmuGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *u * @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. * @param[in] connection_handle Same as \ref btmuBleDisconnect. - * @param[in] handle Handle + * @param[in] service_handle ServiceHandle * @param[out] services \ref BtmGattService * @param[in] count Size of the services array in entries. The max is 100. * @param[out] out Output value. */ -Result btmuGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out); +Result btmuGetGattIncludedServices(u32 connection_handle, u16 service_handle, BtmGattService *services, u8 count, u8 *out); /** * @brief This is similar to \ref btmuGetGattIncludedServices except this only returns 1 \ref BtmGattService. * @note This is similar to \ref btmGetBelongingService. * @param[in] connection_handle Same as \ref btmuBleDisconnect. - * @param[in] handle Handle + * @param[in] attribute_handle AttributeHandle * @param[out] service \ref BtmGattService * @param[out] flag Whether a \ref BtmGattService was returned. */ -Result btmuGetBelongingGattService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag); +Result btmuGetBelongingGattService(u32 connection_handle, u16 attribute_handle, BtmGattService *service, bool *flag); /** * @brief GetGattCharacteristics * @note This is similar to \ref btmGetGattCharacteristics. * @param[in] connection_handle Same as \ref btmuBleDisconnect. - * @param[in] handle This controls which \ref BtmGattCharacteristic entries to return. + * @param[in] service_handle This controls which \ref BtmGattCharacteristic entries to return. * @param[out] characteristics \ref BtmGattCharacteristic * @param[in] count Size of the characteristics array in entries. The max is 100. * @param[out] total_out Total output entries. */ -Result btmuGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out); +Result btmuGetGattCharacteristics(u32 connection_handle, u16 service_handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out); /** * @brief GetGattDescriptors * @note This is similar to \ref btmGetGattDescriptors. * @param[in] connection_handle Same as \ref btmuBleDisconnect. - * @param[in] handle This controls which \ref BtmGattDescriptor entries to return. + * @param[in] char_handle Characteristic handle. This controls which \ref BtmGattDescriptor entries to return. * @param[out] descriptors \ref BtmGattDescriptor * @param[in] count Size of the descriptors array in entries. The max is 100. * @param[out] total_out Total output entries. */ -Result btmuGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out); +Result btmuGetGattDescriptors(u32 connection_handle, u16 char_handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out); /** * @brief AcquireBleMtuConfigEvent diff --git a/nx/source/runtime/btdev.c b/nx/source/runtime/btdev.c index d60f666b..f5932098 100644 --- a/nx/source/runtime/btdev.c +++ b/nx/source/runtime/btdev.c @@ -31,12 +31,12 @@ Result btdevAcquireBleScanEvent(Event* out_event) { return btmuAcquireBleScanEvent(out_event); } -Result btdevGetBleScanParameter(u16 unk, BtdrvBleAdvertisePacketParameter *out) { - return btmuGetBleScanFilterParameter(unk, out); +Result btdevGetBleScanParameter(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out) { + return btmuGetBleScanFilterParameter(parameter_id, out); } -Result btdevGetBleScanParameter2(u16 unk, BtdrvGattAttributeUuid *out) { - return btmuGetBleScanFilterParameter2(unk, out); +Result btdevGetBleScanParameter2(u16 parameter_id, BtdrvGattAttributeUuid *out) { + return btmuGetBleScanFilterParameter2(parameter_id, out); } Result btdevStartBleScanGeneral(BtdrvBleAdvertisePacketParameter param) { @@ -107,8 +107,8 @@ Result btdevConnectToGattServer(BtdrvAddress addr) { return btmuBleConnect(addr); } -Result btdevDisconnectFromGattServer(u32 id) { - return btmuBleDisconnect(id); +Result btdevDisconnectFromGattServer(u32 connection_handle) { + return btmuBleDisconnect(connection_handle); } Result btdevGetBleConnectionInfoList(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out) { diff --git a/nx/source/services/btm.c b/nx/source/services/btm.c index 8653eb56..cb278133 100644 --- a/nx/source/services/btm.c +++ b/nx/source/services/btm.c @@ -270,18 +270,18 @@ Result btmAcquireBleScanEvent(Event* out_event) { return _btmCmdGetEventOutFlag(out_event, true, 23); } -Result btmGetBleScanParameterGeneral(u16 unk, BtdrvBleAdvertisePacketParameter *out) { +Result btmGetBleScanParameterGeneral(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out) { if (hosversionBefore(5,1,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - return serviceDispatchInOut(&g_btmSrv, 24, unk, *out); + return serviceDispatchInOut(&g_btmSrv, 24, parameter_id, *out); } -Result btmGetBleScanParameterSmartDevice(u16 unk, BtdrvGattAttributeUuid *out) { +Result btmGetBleScanParameterSmartDevice(u16 parameter_id, BtdrvGattAttributeUuid *out) { if (hosversionBefore(5,1,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - return serviceDispatchInOut(&g_btmSrv, 25, unk, *out); + return serviceDispatchInOut(&g_btmSrv, 25, parameter_id, *out); } Result btmStartBleScanForGeneral(BtdrvBleAdvertisePacketParameter param) { @@ -473,24 +473,24 @@ Result btmGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uu return rc; } -Result btmGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out) { +Result btmGetGattIncludedServices(u32 connection_handle, u16 service_handle, BtmGattService *services, u8 count, u8 *out) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); u32 cmd_id = hosversionBefore(5,1,0) ? 31 : 48; - return _btmGetGattServiceData(connection_handle, handle, services, sizeof(BtmGattService), count, out, cmd_id); + return _btmGetGattServiceData(connection_handle, service_handle, services, sizeof(BtmGattService), count, out, cmd_id); } -Result btmGetBelongingService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag) { +Result btmGetBelongingService(u32 connection_handle, u16 attribute_handle, BtmGattService *service, bool *flag) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); u32 cmd_id = hosversionBefore(5,1,0) ? 32 : 49; const struct { - u16 handle; + u16 attribute_handle; u16 pad; u32 connection_handle; - } in = { handle, 0, connection_handle }; + } in = { attribute_handle, 0, connection_handle }; u8 tmp=0; Result rc = serviceDispatchInOut(&g_btmSrv, cmd_id, in, tmp, @@ -501,20 +501,20 @@ Result btmGetBelongingService(u32 connection_handle, u16 handle, BtmGattService return rc; } -Result btmGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) { +Result btmGetGattCharacteristics(u32 connection_handle, u16 service_handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); u32 cmd_id = hosversionBefore(5,1,0) ? 33 : 50; - return _btmGetGattServiceData(connection_handle, handle, characteristics, sizeof(BtmGattCharacteristic), count, total_out, cmd_id); + return _btmGetGattServiceData(connection_handle, service_handle, characteristics, sizeof(BtmGattCharacteristic), count, total_out, cmd_id); } -Result btmGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) { +Result btmGetGattDescriptors(u32 connection_handle, u16 char_handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); u32 cmd_id = hosversionBefore(5,1,0) ? 34 : 51; - return _btmGetGattServiceData(connection_handle, handle, descriptors, sizeof(BtmGattDescriptor), count, total_out, cmd_id); + return _btmGetGattServiceData(connection_handle, char_handle, descriptors, sizeof(BtmGattDescriptor), count, total_out, cmd_id); } Result btmAcquireBleMtuConfigEvent(Event* out_event) { diff --git a/nx/source/services/btmu.c b/nx/source/services/btmu.c index 48a4d522..d652bfcb 100644 --- a/nx/source/services/btmu.c +++ b/nx/source/services/btmu.c @@ -124,12 +124,12 @@ Result btmuAcquireBleScanEvent(Event* out_event) { return _btmuCmdGetEventOutFlag(out_event, true, 0); } -Result btmuGetBleScanFilterParameter(u16 unk, BtdrvBleAdvertisePacketParameter *out) { - return serviceDispatchInOut(&g_btmuIBtmUserCore, 1, unk, *out); +Result btmuGetBleScanFilterParameter(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out) { + return serviceDispatchInOut(&g_btmuIBtmUserCore, 1, parameter_id, *out); } -Result btmuGetBleScanFilterParameter2(u16 unk, BtdrvGattAttributeUuid *out) { - return serviceDispatchInOut(&g_btmuIBtmUserCore, 2, unk, *out); +Result btmuGetBleScanFilterParameter2(u16 parameter_id, BtdrvGattAttributeUuid *out) { + return serviceDispatchInOut(&g_btmuIBtmUserCore, 2, parameter_id, *out); } Result btmuStartBleScanForGeneral(BtdrvBleAdvertisePacketParameter param) { @@ -264,17 +264,17 @@ Result btmuGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *u return rc; } -Result btmuGetGattIncludedServices(u32 connection_handle, u16 handle, BtmGattService *services, u8 count, u8 *out) { - return _btmuGetGattServiceData(connection_handle, handle, services, sizeof(BtmGattService), count, out, 29); +Result btmuGetGattIncludedServices(u32 connection_handle, u16 service_handle, BtmGattService *services, u8 count, u8 *out) { + return _btmuGetGattServiceData(connection_handle, service_handle, services, sizeof(BtmGattService), count, out, 29); } -Result btmuGetBelongingGattService(u32 connection_handle, u16 handle, BtmGattService *service, bool *flag) { +Result btmuGetBelongingGattService(u32 connection_handle, u16 attribute_handle, BtmGattService *service, bool *flag) { const struct { - u16 handle; + u16 attribute_handle; u16 pad; u32 connection_handle; u64 AppletResourceUserId; - } in = { handle, 0, connection_handle, appletGetAppletResourceUserId() }; + } in = { attribute_handle, 0, connection_handle, appletGetAppletResourceUserId() }; u8 tmp=0; Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 30, in, tmp, @@ -286,12 +286,12 @@ Result btmuGetBelongingGattService(u32 connection_handle, u16 handle, BtmGattSer return rc; } -Result btmuGetGattCharacteristics(u32 connection_handle, u16 handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) { - return _btmuGetGattServiceData(connection_handle, handle, characteristics, sizeof(BtmGattCharacteristic), count, total_out, 31); +Result btmuGetGattCharacteristics(u32 connection_handle, u16 service_handle, BtmGattCharacteristic *characteristics, u8 count, u8 *total_out) { + return _btmuGetGattServiceData(connection_handle, service_handle, characteristics, sizeof(BtmGattCharacteristic), count, total_out, 31); } -Result btmuGetGattDescriptors(u32 connection_handle, u16 handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) { - return _btmuGetGattServiceData(connection_handle, handle, descriptors, sizeof(BtmGattDescriptor), count, total_out, 32); +Result btmuGetGattDescriptors(u32 connection_handle, u16 char_handle, BtmGattDescriptor *descriptors, u8 count, u8 *total_out) { + return _btmuGetGattServiceData(connection_handle, char_handle, descriptors, sizeof(BtmGattDescriptor), count, total_out, 32); } Result btmuAcquireBleMtuConfigEvent(Event* out_event) {