From ed2a0509b5a6d41b6126ab1e8fdc3d27758cd561 Mon Sep 17 00:00:00 2001 From: weiqian Date: Thu, 21 Nov 2024 15:16:54 +0800 Subject: [PATCH] fix: add lnn errcode Signed-off-by: weiqian --- core/adapter/kv_store/src/lnn_kv_adapter.cpp | 6 +- interfaces/kits/common/softbus_error_code.h | 92 +++++++++++++++++++ .../unittest/bus_center_sdk_test.cpp | 2 +- 3 files changed, 96 insertions(+), 4 deletions(-) diff --git a/core/adapter/kv_store/src/lnn_kv_adapter.cpp b/core/adapter/kv_store/src/lnn_kv_adapter.cpp index 5805613af..8502bc54f 100644 --- a/core/adapter/kv_store/src/lnn_kv_adapter.cpp +++ b/core/adapter/kv_store/src/lnn_kv_adapter.cpp @@ -89,7 +89,7 @@ int32_t KVAdapter::RegisterDataChangeListener( LNN_LOGI(LNN_LEDGER, "Register db data change listener"); if (!IsCloudSyncEnabled()) { LNN_LOGW(LNN_LEDGER, "not support cloud sync"); - return SOFTBUS_ERR; + return SOFTBUS_KV_CLOUD_DISABLED; } if (dataChangeListener == nullptr) { LNN_LOGE(LNN_LEDGER, "dataChangeListener is null"); @@ -117,7 +117,7 @@ int32_t KVAdapter::UnRegisterDataChangeListener() LNN_LOGI(LNN_LEDGER, "UnRegister db data change listener"); if (!IsCloudSyncEnabled()) { LNN_LOGW(LNN_LEDGER, "not support cloud sync"); - return SOFTBUS_ERR; + return SOFTBUS_KV_CLOUD_DISABLED; } { std::lock_guard lock(kvAdapterMutex_); @@ -344,7 +344,7 @@ int32_t KVAdapter::CloudSync() LNN_LOGI(LNN_LEDGER, "call!"); if (!IsCloudSyncEnabled()) { LNN_LOGW(LNN_LEDGER, "not support cloud sync"); - return SOFTBUS_ERR; + return SOFTBUS_KV_CLOUD_DISABLED; } std::function callback = CloudSyncCallback; DistributedKv::Status status; diff --git a/interfaces/kits/common/softbus_error_code.h b/interfaces/kits/common/softbus_error_code.h index 4f2e649ff..ef5534ec5 100644 --- a/interfaces/kits/common/softbus_error_code.h +++ b/interfaces/kits/common/softbus_error_code.h @@ -181,6 +181,13 @@ enum SoftBusErrNo { SOFTBUS_INFLATE_FAIL, SOFTBUS_GET_IRK_FAIL, SOFTBUS_SPLIT_STRING_FAIL, + SOFTBUS_STRTOK_FAIL, + SOFTBUS_HUKS_FINISH_ERR, + SOFTBUS_HUKS_UPDATE_ERR, + SOFTBUS_HUKS_PARAM_SET_ERR, + SOFTBUS_HUKS_GENERATE_KEY_ERR, + SOFTBUS_HUKS_DELETE_KEY_ERR, + SOFTBUS_HUKS_GENERATE_RANDOM_ERR, /* errno begin: -((203 << 21) | (5 << 16) | 0xFFFF) */ SOFTBUS_TRANS_ERR_BASE = SOFTBUS_ERRNO(TRANS_SUB_MODULE_CODE), @@ -528,6 +535,39 @@ enum SoftBusErrNo { SOFTBUS_AUTH_PACK_SOCKET_PKT_FAIL, SOFTBUS_AUTH_SOCKET_EVENT_INVALID, SOFTBUS_AUTH_NOT_NEED_SEND_V1_DEV_ID, + SOFTBUS_AUTH_PACK_DEV_KEY_FAILED, + SOFTBUS_AUTH_UNPACK_DEV_KEY_FAILED, + SOFTBUS_AUTH_INVALID_TERMINATOR, + SOFTBUS_AUTH_HEX_STR_TO_BYTES_ERR, + SOFTBUS_AUTH_CONN_INFO_NOT_FOUND, + SOFTBUS_AUTH_SOCKET_DATA_PROC_ERR, + SOFTBUS_AUTH_NEGO_MSG_PROC_ERR, + SOFTBUS_AUTH_DP_CHANGE_LISTENER_INVALID, + SOFTBUS_AUTH_LISTENER_MODULE_INVALID, + SOFTBUS_AUTH_ADD_REQUEST_FAIL, + SOFTBUS_AUTH_HICHAIN_INIT_FAIL, + SOFTBUS_AUTH_UNREG_DATA_FAIL, + SOFTBUS_AUTH_HICHAIN_SA_PROC_ERR, + SOFTBUS_AUTH_SESSION_KEY_PROC_ERR, + SOFTBUS_AUTH_COMM_INIT_FAIL, + SOFTBUS_AUTH_POST_MSG_FAIL, + SOFTBUS_AUTH_LINK_NOT_EXIST, + SOFTBUS_AUTH_ALLOC_LANE_FAIL, + SOFTBUS_AUTH_UPDATE_PROCESS_FAIL, + SOFTBUS_AUTH_CONN_NOT_ACTIVR, + SOFTBUS_CHANNEL_AUTH_KEY_NOT_FOUND, + SOFTBUS_CHANNEL_AUTH_ADD_EA_FAIL, + SOFTBUS_CHANNEL_AUTH_REMOVE_EA_FAIL, + SOFTBUS_CHANNEL_AUTH_ILLEAGAL_DATA_LENGTH, + SOFTBUS_CHANNEL_AUTH_GET_NEGOTIATE_INFO_FAIL, + SOFTBUS_CHANNEL_AUTH_UNPACK_FLAG_FIELD_FAIL, + SOFTBUS_CHANNEL_AUTH_CRC_CHECK_FAIL, + SOFTBUS_CHANNEL_AUTH_ILLEGAL_VERSION, + SOFTBUS_CHANNEL_AUTH_SET_HML_ABILITY_FAIL, + SOFTBUS_CHANNEL_AUTH_MERGE_DATA_FAIL, + SOFTBUS_CHANNEL_AUTH_SET_AES_KEY_FAIL, + SOFTBUS_CHANNEL_AUTH_GET_P2P_INFO_FAIL, + SOFTBUS_CHANNEL_AUTH_HML_LINK_FAIL, /* hichain mapping softbus errcode */ SOFTBUS_AUTH_HICHAIN_PROOF_MISMATCH = @@ -681,6 +721,58 @@ enum SoftBusErrNo { SOFTBUS_NETWORK_UNREGISTER_SERVICE_FAILED, SOFTBUS_NETWORK_FSM_CLEAN_FAILED, SOFTBUS_KV_IGNORE_OLD_DEVICE_INFO, + SOFTBUS_NETWORK_PROXY_INVOKE_FAILED, + SOFTBUS_NETWORK_CLIENT_NOT_INIT, + SOFTBUS_NETWORK_INVALID_REPLY_DATA, + SOFTBUS_NETWORK_GET_CLIENT_NAME_FAILED, + SOFTBUS_NETWORK_ADD_DEATH_RECIPIENT_FAILED, + SOFTBUS_NETWORK_LEAVE_LNN_FAILED, + SOFTBUS_NETWORK_START_TIME_SYNC_FAILED, + SOFTBUS_NETWORK_STOP_TIME_SYNC_FAILED, + SOFTBUS_NETWORK_PUBLISH_LNN_FAILED, + SOFTBUS_NETWORK_REFRESH_LNN_FAILED, + SOFTBUS_NETWORK_BUILD_SUB_MSG_FAILED, + SOFTBUS_NETWORK_BUILD_PUBLISH_MSG_FAILED, + SOFTBUS_NETWORK_HB_BUILD_ADV_DATA_FAILED, + SOFTBUS_NETWORK_HB_BUILD_FILTER_FAILED, + SOFTBUS_NETWORK_HB_UPDATE_ADV_DATA_FAILED, + SOFTBUS_NETWORK_HB_UPDATE_FILTER_FAILED, + SOFTBUS_NETWORK_HB_START_ADV_FAILED, + SOFTBUS_NETWORK_HB_STOP_ADV_FAILED, + SOFTBUS_NETWORK_HB_START_SCAN_FAILED, + SOFTBUS_NETWORK_HB_STOP_SCAN_FAILED, + SOFTBUS_NETWORK_GET_TRUSTED_DEV_INFO_FAILED, + SOFTBUS_NETWORK_HB_SEND_TO_LP_FAILED, + SOFTBUS_NETWORK_HB_GET_ADV_HANDLE_FAILED, + SOFTBUS_NETWORK_HB_REG_SCAN_LISTENER_FAILED, + SOFTBUS_NETWORK_CAPABILITY_PROC_ERR, + SOFTBUS_NETWORK_HB_SET_REPORT_CHANNEL_FAILED, + SOFTBUS_NETWORK_LP_INIT_FAILED, + SOFTBUS_NETWORK_LP_DEV_INFO_PROC_ERR, + SOFTBUS_NETWORK_LP_KEEP_ALIVE_PROC_ERR, + SOFTBUS_NETWORK_SET_DEVICE_INFO_ERR, + SOFTBUS_NETWORK_GENERATE_CIPHER_INFO_FAILED, + SOFTBUS_NETWORK_INVALID_DEV_INFO, + SOFTBUS_NETWORK_DB_LOCK_INIT_FAILED, + SOFTBUS_NETWORK_DATABASE_FAILED, + SOFTBUS_NETWORK_GET_PATH_FAILED, + SOFTBUS_NETWORK_ASYNC_CALLBACK_FAILED, + SOFTBUS_NETWORK_INIT_TRUST_DEV_INFO_FAILED, + SOFTBUS_NETWORK_MAP_INIT_FAILED, + SOFTBUS_NETWORK_MAP_SET_FAILED, + SOFTBUS_NETWORK_MAP_GET_FAILED, + SOFTBUS_NETWORK_INIT_CIPHER_FAILED, + SOFTBUS_NETWORK_REGCOMP_FAILED, + SOFTBUS_NETWORK_BUILD_FILTER_FAILED, + SOFTBUS_NETWORK_BLE_BUILD_ADV_DATA_FAILED, + SOFTBUS_NETWORK_BLE_START_ADV_FAILED, + SOFTBUS_NETWORK_BLE_END_ADV_FAILED, + SOFTBUS_NETWORK_INIT_FAST_OFFLINE_FAILED, + SOFTBUS_NETWORK_INIT_FAST_ONLINE_FAILED, + SOFTBUS_NETWORK_INIT_LFINDER_FAILED, + SOFTBUS_NETWORK_UPDATE_LFINDER_FAILED, + SOFTBUS_NETWORK_DLOPEN_FAILED, + SOFTBUS_NETWORK_JOIN_META_START_ERR, /* errno begin: -((203 << 21) | (4 << 16) | (1 << 12) | 0x0FFF) */ SOFTBUS_LANE_ERR_BASE = SOFTBUS_SUB_ERRNO(LNN_SUB_MODULE_CODE, LNN_LANE_MODULE_CODE), diff --git a/tests/sdk/bus_center/unittest/bus_center_sdk_test.cpp b/tests/sdk/bus_center/unittest/bus_center_sdk_test.cpp index aa2e45f38..b4bef5462 100644 --- a/tests/sdk/bus_center/unittest/bus_center_sdk_test.cpp +++ b/tests/sdk/bus_center/unittest/bus_center_sdk_test.cpp @@ -603,7 +603,7 @@ HWTEST_F(BusCenterSdkTest, SERVER_IPC_SET_NODE_DATA_CHANGE_Test002, TestSize.Lev char networkId[] = "12313"; uint16_t dataChangeFlag = 11; int32_t ret = ServerIpcSetNodeDataChangeFlag(pkgName, networkId, dataChangeFlag); - EXPECT_TRUE(ret == SOFTBUS_ERR); + EXPECT_NE(ret, SOFTBUS_OK); } } // namespace OHOS