mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-03 18:12:14 +02:00
btmu/btdrv: Use bool flag where needed and updated docs.
This commit is contained in:
parent
2d524080fa
commit
b2b3680b91
@ -242,7 +242,7 @@ typedef struct {
|
||||
|
||||
/// BleConnectionInfo
|
||||
typedef struct {
|
||||
u32 id; ///< Id, 0xFFFFFFFF is invalid.
|
||||
u32 id; ///< Id, 0xFFFFFFFF ([5.0.0-5.0.2] 0xFFFF) is invalid.
|
||||
BtdrvAddress addr; ///< \ref BtdrvAddress
|
||||
u8 pad[2]; ///< Padding
|
||||
} BtdrvBleConnectionInfo;
|
||||
|
@ -136,7 +136,7 @@ Result btmuBleConnect(BtdrvAddress addr);
|
||||
|
||||
/**
|
||||
* @brief BleDisconnect
|
||||
* @param[in] id This must match a BtdrvBleConnectionInfo::id from \ref btmuBleGetConnectionState (0xFFFFFFFF is invalid).
|
||||
* @param[in] id This must match a BtdrvBleConnectionInfo::id from \ref btmuBleGetConnectionState. [5.1.0+] 0xFFFFFFFF is invalid.
|
||||
*/
|
||||
Result btmuBleDisconnect(u32 id);
|
||||
|
||||
@ -206,9 +206,9 @@ Result btmuGetGattServices(u32 id, BtmuGattService *services, u8 count, u8 *tota
|
||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
||||
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||
* @param[out] service \ref BtmuGattService
|
||||
* @param[out] total_out Total output entries.
|
||||
* @param[out] flag Whether a \ref BtmuGattService was returned.
|
||||
*/
|
||||
Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmuGattService *service, u8 *total_out);
|
||||
Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmuGattService *service, bool *flag);
|
||||
|
||||
/**
|
||||
* @brief Same as \ref btmuGetGattServices except this only returns \ref BtmuGattService entries where various checks pass with u16 fields.
|
||||
@ -225,9 +225,9 @@ Result btmuGetGattIncludedServices(u32 id, u16 unk1, BtmuGattService *services,
|
||||
* @param[in] id Same as \ref btmuBleDisconnect.
|
||||
* @param[in] unk1 Unknown
|
||||
* @param[out] service \ref BtmuGattService
|
||||
* @param[out] total_out Total output entries.
|
||||
* @param[out] flag Whether a \ref BtmuGattService was returned.
|
||||
*/
|
||||
Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmuGattService *service, u8 *total_out);
|
||||
Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmuGattService *service, bool *flag);
|
||||
|
||||
/**
|
||||
* @brief GetGattCharacteristics
|
||||
|
@ -247,25 +247,28 @@ Result btmuGetGattServices(u32 id, BtmuGattService *services, u8 count, u8 *tota
|
||||
);
|
||||
}
|
||||
|
||||
Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmuGattService *service, u8 *total_out) {
|
||||
Result btmuGetGattService(u32 id, const BtdrvGattAttributeUuid *uuid, BtmuGattService *service, bool *flag) {
|
||||
const struct {
|
||||
u32 id;
|
||||
BtdrvGattAttributeUuid uuid;
|
||||
u64 AppletResourceUserId;
|
||||
} in = { id, *uuid, appletGetAppletResourceUserId() };
|
||||
|
||||
return serviceDispatchInOut(&g_btmuIBtmUserCore, 28, in, *total_out,
|
||||
u8 tmp=0;
|
||||
Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 28, in, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out | SfBufferAttr_FixedSize },
|
||||
.buffers = { { service, sizeof(*service) } },
|
||||
.in_send_pid = true,
|
||||
);
|
||||
if (R_SUCCEEDED(rc) && flag) *flag = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result btmuGetGattIncludedServices(u32 id, u16 unk1, BtmuGattService *services, u8 count, u8 *out) {
|
||||
return _btmuGetGattServiceData(id, unk1, services, sizeof(BtmuGattService), count, out, 29);
|
||||
}
|
||||
|
||||
Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmuGattService *service, u8 *total_out) {
|
||||
Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmuGattService *service, bool *flag) {
|
||||
const struct {
|
||||
u16 unk1;
|
||||
u16 pad;
|
||||
@ -273,11 +276,14 @@ Result btmuGetBelongingGattService(u32 id, u16 unk1, BtmuGattService *service, u
|
||||
u64 AppletResourceUserId;
|
||||
} in = { unk1, 0, id, appletGetAppletResourceUserId() };
|
||||
|
||||
return serviceDispatchInOut(&g_btmuIBtmUserCore, 30, in, *total_out,
|
||||
u8 tmp=0;
|
||||
Result rc = serviceDispatchInOut(&g_btmuIBtmUserCore, 30, in, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out | SfBufferAttr_FixedSize },
|
||||
.buffers = { { service, sizeof(*service) } },
|
||||
.in_send_pid = true,
|
||||
);
|
||||
if (R_SUCCEEDED(rc) && flag) *flag = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result btmuGetGattCharacteristics(u32 id, u16 unk1, BtmuGattCharacteristic *characteristics, u8 count, u8 *total_out) {
|
||||
|
Loading…
Reference in New Issue
Block a user