btdrv: update StartInquiry and RespondToSspRequest service wrappers for 12.0.0

This commit is contained in:
ndeadly 2021-04-19 23:38:50 +02:00
parent 7a0f6b8a14
commit 3a4447feee
2 changed files with 71 additions and 22 deletions

View File

@ -436,32 +436,60 @@ Result btdrvDisableBluetooth(void);
Result btdrvFinalizeBluetooth(void);
/**
* @brief GetAdapterProperties
* @param[out] property \ref BtdrvAdapterProperty
* @brief GetAdapterProperties [1.0.0-11.0.1]
* @param[out] properties \ref BtdrvAdapterProperty
*/
Result btdrvGetAdapterProperties(BtdrvAdapterProperty *property);
Result btdrvLegacyGetAdapterProperties(BtdrvAdapterPropertyOld *properties);
/**
* @brief GetAdapterProperty
* @brief GetAdapterProperties [12.0.0+]
* @param[out] properties \ref BtdrvAdapterPropertySet
*/
Result btdrvGetAdapterProperties(BtdrvAdapterPropertySet *properties);
/**
* @brief GetAdapterProperty [1.0.0-11.0.1]
* @param[in] type \ref BtdrvBluetoothPropertyType
* @param[out] buffer Output buffer, see \ref BtdrvBluetoothPropertyType for the contents.
* @param[in] size Output buffer size.
*/
Result btdrvGetAdapterProperty(BtdrvBluetoothPropertyType type, void* buffer, size_t size);
Result btdrvLegacyGetAdapterProperty(BtdrvBluetoothPropertyType type, void* buffer, size_t size);
/**
* @brief SetAdapterProperty
* @brief GetAdapterProperty [12.0.0+]
* @param[in] type \ref BtdrvAdapterPropertyType
* @param[in] property \ref BtdrvAdapterProperty
*/
Result btdrvGetAdapterProperty(BtdrvAdapterPropertyType type, BtdrvAdapterProperty *property);
/**
* @brief SetAdapterProperty [1.0.0-11.0.1]
* @param[in] type \ref BtdrvBluetoothPropertyType
* @param[in] buffer Input buffer, see \ref BtdrvBluetoothPropertyType for the contents.
* @param[in] size Input buffer size.
*/
Result btdrvSetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buffer, size_t size);
Result btdrvLegacySetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buffer, size_t size);
/**
* @brief This starts Inquiry, the output data will be available via \ref btdrvGetEventInfo. Inquiry will automatically stop in 10.24 seconds.
* @brief SetAdapterProperty [12.0.0+]
* @param[in] type \ref BtdrvAdapterPropertyType
* @param[in] property \ref BtdrvAdapterProperty
*/
Result btdrvSetAdapterProperty(BtdrvAdapterPropertyType type, const BtdrvAdapterProperty *property);
/**
* @brief StartInquiry [1.0.0-11.0.1] This starts Inquiry, the output data will be available via \ref btdrvGetEventInfo. Inquiry will automatically stop in 10.24 seconds.
* @note This is used by btm-sysmodule.
*/
Result btdrvStartInquiry(void);
Result btdrvLegacyStartInquiry(void);
/**
* @brief [12.0.0+] This starts Inquiry, the output data will be available via \ref btdrvGetEventInfo.
* @param[in] services Bitmask of allowed services. When -1 the original defaults from pre-12.0.0 are used.
* @param[in] duration Inquiry duration in nanoseconds.
* @note This is used by btm-sysmodule.
*/
Result btdrvStartInquiry(u32 services, s64 duration);
/**
* @brief This stops Inquiry which was started by \ref btdrvStartInquiry, if it's still active.
@ -514,17 +542,17 @@ Result btdrvRespondToPinRequest(BtdrvAddress addr, const BtdrvPinCode *pin_code)
* @note This is used by btm-sysmodule.
* @param[in] addr \ref BtdrvAddress
* @param[in] variant BluetoothSspVariant
* @param[in] flag Whether the request is accepted.
* @param[in] unk Unknown
* @param[in] accept Whether the request is accepted.
* @param[in] passkey Passkey.
*/
Result btdrvRespondToSspRequest(BtdrvAddress addr, u8 variant, bool flag, u32 unk);
Result btdrvRespondToSspRequest(BtdrvAddress addr, u8 variant, bool accept, u32 passkey);
/**
* @brief GetEventInfo
* @note This is used by btm-sysmodule.
* @param[out] buffer Output buffer, see \ref BtdrvEventInfo.
* @param[in] size Output buffer size.
* @oaram[out] type Output BtdrvEventType.
* @param[out] type Output BtdrvEventType.
*/
Result btdrvGetEventInfo(void* buffer, size_t size, BtdrvEventType *type);

View File

@ -180,10 +180,19 @@ Result btdrvSetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buff
);
}
Result btdrvStartInquiry(void) {
Result btdrvLegacyStartInquiry(void) {
return _btdrvCmdNoIO(8);
}
Result btdrvStartInquiry(u32 services, s64 duration) {
const struct {
u32 services;
s64 duration;
} in = { services, duration };
return serviceDispatchIn(&g_btdrvSrv, 8, in);
}
Result btdrvStopInquiry(void) {
return _btdrvCmdNoIO(9);
}
@ -239,15 +248,27 @@ Result btdrvRespondToPinRequest(BtdrvAddress addr, const BtdrvPinCode *pin_code)
return serviceDispatchIn(&g_btdrvSrv, 13, in);
}
Result btdrvRespondToSspRequest(BtdrvAddress addr, u8 variant, bool flag, u32 unk) {
Result btdrvRespondToSspRequest(BtdrvAddress addr, u8 variant, bool accept, u32 passkey) {
if (hosversionBefore(12,0,0)) {
const struct {
BtdrvAddress addr;
u8 variant;
u8 flag;
u32 unk;
} in = { addr, variant, flag!=0, unk };
u8 accept;
u32 passkey;
} in = { addr, variant, accept!=0, passkey };
return serviceDispatchIn(&g_btdrvSrv, 14, in);
}
else {
const struct {
BtdrvAddress addr;
u8 accept;
u8 variant;
u32 passkey;
} in = { addr, accept!=0, variant, passkey };
return serviceDispatchIn(&g_btdrvSrv, 14, in);
}
}
Result btdrvGetEventInfo(void* buffer, size_t size, BtdrvEventType *type) {