From a7a7ee5eacc2052b5ed7706aa91ea19976f3dc1e Mon Sep 17 00:00:00 2001 From: 18082231538 <1399410084@qq.com> Date: Fri, 11 Aug 2023 19:01:02 +0800 Subject: [PATCH] bugfix for mac address Signed-off-by: 18082231538 <1399410084@qq.com> --- frameworks/inner/src/bluetooth_host.cpp | 26 ++----------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/frameworks/inner/src/bluetooth_host.cpp b/frameworks/inner/src/bluetooth_host.cpp index 853c6ec2..385adbd4 100644 --- a/frameworks/inner/src/bluetooth_host.cpp +++ b/frameworks/inner/src/bluetooth_host.cpp @@ -1131,30 +1131,8 @@ int BluetoothHost::SetFastScan(bool isEnable) int BluetoothHost::GetRandomAddress(const std::string &realAddr, std::string &randomAddr) const { HILOGI("enter."); - randomAddr = ""; - if (!IS_BT_ENABLED()) { - HILOGE("bluetooth is off."); - if (!pimpl) { - HILOGE("pimpl is null."); - return BT_ERR_INVALID_STATE; - } - randomAddr = GenerateRandomMacAddress(); - pimpl->stagingRealAddr_ = realAddr; - pimpl->stagingRandomAddr_ = randomAddr; - HILOGI("GetRandomAddress, realAddr: %{public}s, randomAddr: %{public}s", - GetEncryptAddr(realAddr).c_str(), GetEncryptAddr(randomAddr).c_str()); - return BT_NO_ERROR; - } - - if (!pimpl || !pimpl->proxy_) { - HILOGE("pimpl or bluetooth host is nullptr"); - return BT_ERR_UNAVAILABLE_PROXY; - } - if (!IsValidBluetoothAddr(realAddr)) { - HILOGE("realAddr is invalid: %{public}s", realAddr.c_str()); - return BT_ERR_INVALID_PARAM; - } - return pimpl->proxy_->GetRandomAddress(realAddr, randomAddr); + randomAddr = realAddr; + return BT_NO_ERROR; } } // namespace Bluetooth } // namespace OHOS -- Gitee