bugfix:Feature write conflict

Signed-off-by: xftz <fandonghai1@h-partners.com>
This commit is contained in:
xftz 2024-05-27 17:39:43 +08:00
parent 728234b523
commit 8b836af481
7 changed files with 39 additions and 1 deletions

View File

@ -36,6 +36,7 @@ int32_t GetBurstAdvId(void);
int32_t SendDeviceInfoToSHByType(LpFeatureType type);
int32_t SendAdvInfoToMlps(LpBroadcastParam *lpAdvParam, LpServerType type);
int32_t SwtichHeartbeatReportChannel(bool isToAP);
bool IsSupportLpFeature(void);
#ifdef __cplusplus
}

View File

@ -55,4 +55,9 @@ int32_t SwtichHeartbeatReportChannel(bool isToAP)
{
(void)isToAP;
return SOFTBUS_OK;
}
bool IsSupportLpFeature(void)
{
return false;
}

View File

@ -34,6 +34,8 @@
#include "lnn_meta_node_interface.h"
#include "lnn_p2p_info.h"
#include "lnn_device_info_recovery.h"
#include "lnn_feature_capability.h"
#include "lnn_ble_lpdevice.h"
#include "softbus_def.h"
#include "softbus_errcode.h"
#include "softbus_utils.h"
@ -166,8 +168,19 @@ static void RestoreLocalDeviceInfo(void)
LNN_LOGI(LNN_LEDGER, "load remote deviceInfo devicekey success");
}
static void LnnSetLocalFeature(void)
{
if (IsSupportLpFeature()) {
uint64_t feature = 1 << BIT_BLE_SUPPORT_LP_HEARTBEAT;
if (LnnSetLocalNum64Info(NUM_KEY_FEATURE_CAPA, feature) != SOFTBUS_OK) {
LNN_LOGE(LNN_LEDGER, "set feature fail");
}
}
}
int32_t LnnInitNetLedgerDelay(void)
{
LnnSetLocalFeature();
LnnLoadLocalDeviceAccountIdInfo();
LnnInitCloudSyncModule();
if (LnnInitLocalLedgerDelay() != SOFTBUS_OK) {

View File

@ -40,6 +40,9 @@ bus_center_ledger_inc = [
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
"$dsoftbus_root_path/core/bus_center/utils/include",
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
"$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
"$dsoftbus_root_path/interfaces/kits/common",
]
bus_center_ledger_deps = []
bus_center_ledger_external_deps = [ "huks:libhukssdk" ]

View File

@ -246,6 +246,10 @@ ohos_unittest("LedgerLaneHubTest") {
include_dirs = bus_center_unittest_dirs
deps = bus_center_unittest_deps
include_dirs += [
"$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
"$dsoftbus_root_path/interfaces/kits/common",
]
if (is_standard_system) {
external_deps = [
"c_utils:utils",
@ -298,6 +302,8 @@ ohos_unittest("LNNNetBuilderTest") {
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/core/bus_center/service/include",
"$dsoftbus_root_path/tests/core/bus_center/lnn/net_builder/include",
"$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
"$dsoftbus_root_path/interfaces/kits/common",
]
deps = [
@ -382,6 +388,8 @@ ohos_unittest("LNNNetBuilderMockTest") {
"$dsoftbus_root_path/core/connection/p2p/common/include",
"$dsoftbus_root_path/core/connection/p2p/manager/include",
"$dsoftbus_root_path/core/authentication/include",
"$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
"$dsoftbus_root_path/interfaces/kits/common",
]
deps = [
@ -1063,6 +1071,8 @@ ohos_unittest("LNNLedgerMockTest") {
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
"$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
"lane/include",
"$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/interface",
"$dsoftbus_root_path/interfaces/kits/common",
]
deps = [

View File

@ -184,6 +184,7 @@ public:
virtual void LnnDeinitBusCenterEvent(void);
virtual int32_t AuthStartVerify(const AuthConnInfo *connInfo, uint32_t requestId,
const AuthVerifyCallback *callback, AuthVerifyModule module, bool isFastAuth);
virtual bool IsSupportLpFeature(void);
};
class NetBuilderDepsInterfaceMock : public NetBuilderDepsInterface {
public:
@ -310,7 +311,7 @@ public:
AuthVerifyModule, bool));
MOCK_METHOD2(LnnIsNeedCleanConnectionFsm, bool (const NodeInfo *, ConnectionAddrType));
MOCK_METHOD1(AuthFlushDevice, int32_t (const char *uuid));
MOCK_METHOD0(IsSupportLpFeature, bool ());
static int32_t ActionOfLnnGetSettingDeviceName(char *deviceName, uint32_t len);
};
} // namespace OHOS

View File

@ -646,5 +646,10 @@ int32_t AuthFlushDevice(const char *uuid)
{
return GetNetBuilderDepsInterface()->AuthFlushDevice(uuid);
}
bool IsSupportLpFeature(void)
{
return GetNetBuilderDepsInterface()->IsSupportLpFeature();
}
} // extern "C"
} // namespace OHOS