From c8f6a2b1f86741551d7ab9051d293090b0a5691a Mon Sep 17 00:00:00 2001 From: y30033032 Date: Thu, 7 Nov 2024 10:46:37 +0800 Subject: [PATCH 1/3] bug fix: IPC Error code rectification Signed-off-by: y30033032 --- .../ipc/small/src/bus_center_client_proxy.c | 44 ++++---- .../ipc/small/src/lnn_bus_center_ipc.c | 6 +- .../standard/src/bus_center_client_proxy.cpp | 18 +-- .../src/bus_center_client_proxy_standard.cpp | 104 +++++++++--------- .../ipc/standard/src/lnn_bus_center_ipc.cpp | 6 +- interfaces/kits/common/softbus_error_code.h | 10 +- .../bus_center/test/ipc/client_proxy_test.cpp | 4 +- 7 files changed, 100 insertions(+), 92 deletions(-) diff --git a/core/bus_center/ipc/small/src/bus_center_client_proxy.c b/core/bus_center/ipc/small/src/bus_center_client_proxy.c index 2b61352a0..bdbe8d75a 100644 --- a/core/bus_center/ipc/small/src/bus_center_client_proxy.c +++ b/core/bus_center/ipc/small/src/bus_center_client_proxy.c @@ -31,7 +31,7 @@ static int32_t GetSvcIdentityByPkgName(const char *pkgName, SvcIdentity *svc) struct CommonScvId svcId = {0}; if (SERVER_GetIdentityByPkgName(pkgName, &svcId) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get bus center callback failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } svc->handle = svcId.handle; svc->token = svcId.token; @@ -54,7 +54,7 @@ static int32_t GetAllClientIdentity(SvcIdentity *svc, int num) if (SERVER_GetAllClientIdentity(svcId, num) != SOFTBUS_OK) { SoftBusFree(svcId); LNN_LOGE(LNN_EVENT, "get bus center callback failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_IDENTITY_FAILED; } for (int i = 0; i < num; i++) { svc[i].handle = svcId[i].handle; @@ -85,7 +85,7 @@ int32_t ClientOnJoinLNNResult(const char *pkgName, void *addr, uint32_t addrType SvcIdentity svc = {0}; if (GetSvcIdentityByPkgName(pkgName, &svc) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -93,7 +93,7 @@ int32_t ClientOnJoinLNNResult(const char *pkgName, void *addr, uint32_t addrType int32_t ans = SendRequest(svc, CLIENT_ON_JOIN_RESULT, &io, NULL, option, NULL); if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -113,7 +113,7 @@ int32_t ClientOnLeaveLNNResult(const char *pkgName, const char *networkId, int r SvcIdentity svc = {0}; if (GetSvcIdentityByPkgName(pkgName, &svc) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -121,7 +121,7 @@ int32_t ClientOnLeaveLNNResult(const char *pkgName, const char *networkId, int r int32_t ans = SendRequest(svc, CLIENT_ON_LEAVE_RESULT, &io, NULL, option, NULL); if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -143,11 +143,11 @@ int32_t ClinetOnNodeOnlineStateChanged(bool isOnline, void *info, uint32_t infoT int i; if (SERVER_GetClientInfoNodeNum(&num) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc num failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_NUM_FAILED; } if (num == 0) { LNN_LOGE(LNN_EVENT, "svc num is 0"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_NUM_ZERO; } SvcIdentity *svc = (SvcIdentity *)SoftBusCalloc(sizeof(SvcIdentity) * num); if (svc == NULL) { @@ -157,7 +157,7 @@ int32_t ClinetOnNodeOnlineStateChanged(bool isOnline, void *info, uint32_t infoT if (GetAllClientIdentity(svc, num) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc num failed"); SoftBusFree(svc); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -167,7 +167,7 @@ int32_t ClinetOnNodeOnlineStateChanged(bool isOnline, void *info, uint32_t infoT if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); SoftBusFree(svc); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } } SoftBusFree(svc); @@ -191,11 +191,11 @@ int32_t ClinetOnNodeBasicInfoChanged(void *info, uint32_t infoTypeLen, int32_t t int i; if (SERVER_GetClientInfoNodeNum(&num) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc num failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_NUM_FAILED; } if (num == 0) { LNN_LOGE(LNN_EVENT, "svc num NULL"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_NUM_ZERO; } SvcIdentity *svc = (SvcIdentity *)SoftBusCalloc(sizeof(SvcIdentity) * num); if (svc == NULL) { @@ -205,7 +205,7 @@ int32_t ClinetOnNodeBasicInfoChanged(void *info, uint32_t infoTypeLen, int32_t t if (GetAllClientIdentity(svc, num) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc num failed."); SoftBusFree(svc); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -215,7 +215,7 @@ int32_t ClinetOnNodeBasicInfoChanged(void *info, uint32_t infoTypeLen, int32_t t if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); SoftBusFree(svc); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } } SoftBusFree(svc); @@ -240,7 +240,7 @@ int32_t ClientOnTimeSyncResult(const char *pkgName, int32_t pid, const void *inf SvcIdentity svc = {0}; if (GetSvcIdentityByPkgName(pkgName, &svc) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -248,7 +248,7 @@ int32_t ClientOnTimeSyncResult(const char *pkgName, int32_t pid, const void *inf int32_t ans = SendRequest(svc, CLIENT_ON_TIME_SYNC_RESULT, &io, NULL, option, NULL); if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -270,7 +270,7 @@ int32_t ClientOnPublishLNNResult(const char *pkgName, int32_t pid, int32_t publi SvcIdentity svc = {0}; if (GetSvcIdentityByPkgName(pkgName, &svc) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -278,7 +278,7 @@ int32_t ClientOnPublishLNNResult(const char *pkgName, int32_t pid, int32_t publi int32_t ans = SendRequest(svc, CLIENT_ON_PUBLISH_LNN_RESULT, &io, NULL, option, NULL); if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -300,7 +300,7 @@ int32_t ClientOnRefreshLNNResult(const char *pkgName, int32_t pid, int32_t refre SvcIdentity svc = {0}; if (GetSvcIdentityByPkgName(pkgName, &svc) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -308,7 +308,7 @@ int32_t ClientOnRefreshLNNResult(const char *pkgName, int32_t pid, int32_t refre int32_t ans = SendRequest(svc, CLIENT_ON_REFRESH_LNN_RESULT, &io, NULL, option, NULL); if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -330,7 +330,7 @@ int32_t ClientOnRefreshDeviceFound(const char *pkgName, int32_t pid, const void SvcIdentity svc = {0}; if (GetSvcIdentityByPkgName(pkgName, &svc) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "get svc failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED; } MessageOption option; MessageOptionInit(&option); @@ -338,7 +338,7 @@ int32_t ClientOnRefreshDeviceFound(const char *pkgName, int32_t pid, const void int32_t ans = SendRequest(svc, CLIENT_ON_REFRESH_DEVICE_FOUND, &io, NULL, option, NULL); if (ans != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "SendRequest failed, ans=%{public}d", ans); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } \ No newline at end of file diff --git a/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c b/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c index de117fb0c..a1d0704eb 100644 --- a/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c +++ b/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c @@ -116,7 +116,7 @@ static bool IsRepeatJoinLNNRequest(const char *pkgName, const ConnectionAddr *ad if (list == NULL) { LNN_LOGE(LNN_EVENT, "request info list empty"); - return SOFTBUS_ERR; + return SOFTBUS_LIST_EMPTY; } LIST_FOR_EACH_ENTRY(info, &list->list, JoinLnnRequestInfo, node) { if (strncmp(pkgName, info->pkgName, strlen(pkgName)) != 0) { @@ -390,7 +390,7 @@ int32_t LnnIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *net SoftBusList *list = g_lnnRequestInfo.joinLNNRequestInfo; if (list == NULL) { LNN_LOGE(LNN_EVENT, "request info is null"); - return SOFTBUS_ERR; + return SOFTBUS_LIST_EMPTY; } if (SoftBusMutexLock(&g_lnnRequestInfo.lock) != 0) { LNN_LOGE(LNN_EVENT, "get lock fail"); @@ -416,7 +416,7 @@ int32_t LnnIpcNotifyLeaveResult(const char *networkId, int32_t retCode) SoftBusList *list = g_lnnRequestInfo.leaveLNNRequestInfo; if (list == NULL) { LNN_LOGE(LNN_EVENT, "request info is null"); - return SOFTBUS_ERR; + return SOFTBUS_LIST_EMPTY; } if (SoftBusMutexLock(&g_lnnRequestInfo.lock) != 0) { LNN_LOGE(LNN_EVENT, "get lock fail"); diff --git a/core/bus_center/ipc/standard/src/bus_center_client_proxy.cpp b/core/bus_center/ipc/standard/src/bus_center_client_proxy.cpp index 37116c9f4..a43c79ec7 100644 --- a/core/bus_center/ipc/standard/src/bus_center_client_proxy.cpp +++ b/core/bus_center/ipc/standard/src/bus_center_client_proxy.cpp @@ -37,12 +37,12 @@ int32_t ClientOnJoinLNNResult(PkgNameAndPidInfo *info, void *addr, uint32_t addr { if (info == nullptr) { LNN_LOGE(LNN_EVENT, "pkgName is null"); - return SOFTBUS_ERR; + return SOFTBUS_INVALID_PARAM; } sptr clientProxy = GetClientProxy(info->pkgName, info->pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } return clientProxy->OnJoinLNNResult(addr, addrTypeLen, networkId, retCode); } @@ -57,7 +57,7 @@ int32_t ClientOnLeaveLNNResult( sptr clientProxy = GetClientProxy(pkgName, pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } return clientProxy->OnLeaveLNNResult(networkId, retCode); } @@ -138,7 +138,7 @@ int32_t ClientNotifyHichainProofException( sptr clientProxy = new (std::nothrow) BusCenterClientProxy(proxy.second); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } clientProxy->OnHichainProofException(proxy.first.c_str(), proofInfo, proofLen, deviceTypeId, errCode); } @@ -155,7 +155,7 @@ int32_t ClientOnTimeSyncResult(const char *pkgName, int32_t pid, const void *inf sptr clientProxy = GetClientProxy(pkgName, pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } return clientProxy->OnTimeSyncResult(info, infoTypeLen, retCode); } @@ -170,7 +170,7 @@ int32_t ClientOnPublishLNNResult(const char *pkgName, int32_t pid, int32_t publi sptr clientProxy = GetClientProxy(pkgName, pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } clientProxy->OnPublishLNNResult(publishId, reason); return SOFTBUS_OK; @@ -186,7 +186,7 @@ int32_t ClientOnRefreshLNNResult(const char *pkgName, int32_t pid, int32_t refre sptr clientProxy = GetClientProxy(pkgName, pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } clientProxy->OnRefreshLNNResult(refreshId, reason); return SOFTBUS_OK; @@ -202,7 +202,7 @@ int32_t ClientOnRefreshDeviceFound( sptr clientProxy = GetClientProxy(pkgName, pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } clientProxy->OnRefreshDeviceFound(device, deviceLen); return SOFTBUS_OK; @@ -224,7 +224,7 @@ int32_t ClientOnDataLevelChanged(const char *pkgName, int32_t pid, const char *n sptr clientProxy = GetClientProxy(pkgName, pid); if (clientProxy == nullptr) { LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL; } clientProxy->OnDataLevelChanged(networkId, dataLevelInfo); return SOFTBUS_OK; diff --git a/core/bus_center/ipc/standard/src/bus_center_client_proxy_standard.cpp b/core/bus_center/ipc/standard/src/bus_center_client_proxy_standard.cpp index c51bfb3f8..8c5098ab5 100644 --- a/core/bus_center/ipc/standard/src/bus_center_client_proxy_standard.cpp +++ b/core/bus_center/ipc/standard/src/bus_center_client_proxy_standard.cpp @@ -58,38 +58,38 @@ int32_t BusCenterClientProxy::OnJoinLNNResult(void *addr, uint32_t addrTypeLen, sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_INVALID_PARAM; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (addr == nullptr || (retCode == 0 && networkId == nullptr)) { LNN_LOGE(LNN_EVENT, "invalid parameters"); - return SOFTBUS_ERR; + return SOFTBUS_INVALID_PARAM; } MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (!data.WriteUint32(addrTypeLen)) { LNN_LOGE(LNN_EVENT, "write addr type length failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteRawData(addr, addrTypeLen)) { LNN_LOGE(LNN_EVENT, "write addr failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITERAWDATA_FAILED; } if (!data.WriteInt32(retCode)) { LNN_LOGE(LNN_EVENT, "write retCode failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (retCode == 0 && !data.WriteCString(networkId)) { LNN_LOGE(LNN_EVENT, "write networkId failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITECSTRING_FAILED; } MessageParcel reply; MessageOption option = { MessageOption::TF_ASYNC }; if (remote->SendRequest(CLIENT_ON_JOIN_RESULT, data, reply, option) != 0) { LNN_LOGE(LNN_EVENT, "send request failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -100,45 +100,45 @@ int32_t BusCenterClientProxy::OnJoinMetaNodeResult(void *addr, uint32_t addrType sptr remote = Remote(); if (remote == nullptr || metaInfo == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (addr != nullptr) { if (!data.WriteUint32(addrTypeLen)) { LNN_LOGE(LNN_EVENT, "write addr type length failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteRawData(addr, addrTypeLen)) { LNN_LOGE(LNN_EVENT, "write addr failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITERAWDATA_FAILED; } } else { if (!data.WriteUint32(0)) { LNN_LOGE(LNN_EVENT, "write addr type length failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } } if (!data.WriteUint32(infoLen)) { LNN_LOGE(LNN_EVENT, "write infoLen failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteRawData(metaInfo, infoLen)) { LNN_LOGE(LNN_EVENT, "write metaInfo failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITERAWDATA_FAILED; } if (!data.WriteInt32(retCode)) { LNN_LOGE(LNN_EVENT, "write retCode failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } MessageParcel reply; MessageOption option = { MessageOption::TF_ASYNC }; if (remote->SendRequest(CLIENT_ON_JOIN_METANODE_RESULT, data, reply, option) != 0) { LNN_LOGE(LNN_EVENT, "OnJoinMetaNodeResult send request failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -148,7 +148,7 @@ int32_t BusCenterClientProxy::OnLeaveLNNResult(const char *networkId, int retCod sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (networkId == nullptr) { LNN_LOGE(LNN_EVENT, "invalid parameters"); @@ -157,21 +157,21 @@ int32_t BusCenterClientProxy::OnLeaveLNNResult(const char *networkId, int retCod MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (!data.WriteCString(networkId)) { LNN_LOGE(LNN_EVENT, "write networkId failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITECSTRING_FAILED; } if (!data.WriteInt32(retCode)) { LNN_LOGE(LNN_EVENT, "write retCode failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } MessageParcel reply; MessageOption option = { MessageOption::TF_ASYNC }; if (remote->SendRequest(CLIENT_ON_LEAVE_RESULT, data, reply, option) != 0) { LNN_LOGE(LNN_EVENT, "send request fail"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -181,7 +181,7 @@ int32_t BusCenterClientProxy::OnLeaveMetaNodeResult(const char *networkId, int r sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (networkId == nullptr) { LNN_LOGE(LNN_EVENT, "invalid parameters"); @@ -190,21 +190,21 @@ int32_t BusCenterClientProxy::OnLeaveMetaNodeResult(const char *networkId, int r MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (!data.WriteCString(networkId)) { LNN_LOGE(LNN_EVENT, "write networkId failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITECSTRING_FAILED; } if (!data.WriteInt32(retCode)) { LNN_LOGE(LNN_EVENT, "write retCode failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } MessageParcel reply; MessageOption option = { MessageOption::TF_ASYNC }; if (remote->SendRequest(CLIENT_ON_LEAVE_METANODE_RESULT, data, reply, option) != 0) { LNN_LOGE(LNN_EVENT, "send request fail"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } return SOFTBUS_OK; } @@ -215,7 +215,7 @@ int32_t BusCenterClientProxy::OnNodeOnlineStateChanged(const char *pkgName, bool sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (pkgName == nullptr) { LNN_LOGE(LNN_EVENT, "pkgName is nullptr"); @@ -228,35 +228,35 @@ int32_t BusCenterClientProxy::OnNodeOnlineStateChanged(const char *pkgName, bool MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (!data.WriteCString(pkgName)) { LNN_LOGE(LNN_EVENT, "write pkgName failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITECSTRING_FAILED; } if (!data.WriteBool(isOnline)) { LNN_LOGE(LNN_EVENT, "write online state failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEBOOL_FAILED; } if (!data.WriteUint32(infoTypeLen)) { LNN_LOGE(LNN_EVENT, "write info type length failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteRawData(info, infoTypeLen)) { LNN_LOGE(LNN_EVENT, "write node info failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITERAWDATA_FAILED; } MessageParcel reply; MessageOption option; int ret = remote->SendRequest(CLIENT_ON_NODE_ONLINE_STATE_CHANGED, data, reply, option); if (ret != 0) { LNN_LOGE(LNN_EVENT, "send request failed, ret=%{public}d", ret); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } int32_t serverRet; if (!reply.ReadInt32(serverRet)) { LNN_LOGE(LNN_EVENT, "read serverRet failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_READINT32_FAILED; } return serverRet; } @@ -267,7 +267,7 @@ int32_t BusCenterClientProxy::OnNodeBasicInfoChanged(const char *pkgName, void * sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (pkgName == nullptr) { LNN_LOGE(LNN_EVENT, "pkgName is nullptr"); @@ -280,35 +280,35 @@ int32_t BusCenterClientProxy::OnNodeBasicInfoChanged(const char *pkgName, void * MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (!data.WriteCString(pkgName)) { LNN_LOGE(LNN_EVENT, "write pkgName failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITECSTRING_FAILED; } if (!data.WriteInt32(type)) { LNN_LOGE(LNN_EVENT, "write type failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteUint32(infoTypeLen)) { LNN_LOGE(LNN_EVENT, "write info type length failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteRawData(info, infoTypeLen)) { LNN_LOGE(LNN_EVENT, "write node info failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITERAWDATA_FAILED; } MessageParcel reply; MessageOption option; int ret = remote->SendRequest(CLIENT_ON_NODE_BASIC_INFO_CHANGED, data, reply, option); if (ret != 0) { LNN_LOGE(LNN_EVENT, "send request failed, ret=%{public}d", ret); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } int32_t serverRet; if (!reply.ReadInt32(serverRet)) { LNN_LOGE(LNN_EVENT, "read serverRet failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_READINT32_FAILED; } return SOFTBUS_OK; } @@ -366,7 +366,7 @@ int32_t BusCenterClientProxy::OnLocalNetworkIdChanged(const char *pkgName) sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_IPC_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (pkgName == nullptr) { LNN_LOGE(LNN_EVENT, "pkgName is nullptr"); @@ -402,7 +402,7 @@ int32_t BusCenterClientProxy::OnNodeDeviceTrustedChange(const char *pkgName, int sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_IPC_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (pkgName == nullptr|| msg == nullptr) { LNN_LOGE(LNN_EVENT, "invalid parameters"); @@ -489,7 +489,7 @@ int32_t BusCenterClientProxy::OnTimeSyncResult(const void *info, uint32_t infoTy sptr remote = Remote(); if (remote == nullptr) { LNN_LOGE(LNN_EVENT, "remote is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REMOTE_NULL; } if (info == nullptr) { LNN_LOGE(LNN_EVENT, "invalid parameters"); @@ -498,31 +498,31 @@ int32_t BusCenterClientProxy::OnTimeSyncResult(const void *info, uint32_t infoTy MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LNN_LOGE(LNN_EVENT, "write InterfaceToken failed!"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITETOKEN_FAILED; } if (!data.WriteUint32(infoTypeLen)) { LNN_LOGE(LNN_EVENT, "write info length failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } if (!data.WriteRawData(info, infoTypeLen)) { LNN_LOGE(LNN_EVENT, "write info failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITERAWDATA_FAILED; } if (!data.WriteInt32(retCode)) { LNN_LOGE(LNN_EVENT, "write retCode failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_WRITEINT32_FAILED; } MessageParcel reply; MessageOption option; int ret = remote->SendRequest(CLIENT_ON_TIME_SYNC_RESULT, data, reply, option); if (ret != 0) { LNN_LOGE(LNN_EVENT, "send request failed, ret=%{public}d", ret); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_SEND_REQUEST_FAILED; } int32_t serverRet; if (!reply.ReadInt32(serverRet)) { LNN_LOGE(LNN_EVENT, "read serverRet failed"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_READINT32_FAILED; } return SOFTBUS_OK; } diff --git a/core/bus_center/ipc/standard/src/lnn_bus_center_ipc.cpp b/core/bus_center/ipc/standard/src/lnn_bus_center_ipc.cpp index 649c18991..345bf6ac4 100644 --- a/core/bus_center/ipc/standard/src/lnn_bus_center_ipc.cpp +++ b/core/bus_center/ipc/standard/src/lnn_bus_center_ipc.cpp @@ -261,12 +261,12 @@ int32_t LnnIpcRegDataLevelChangeCb(const char *pkgName, int32_t callingPid) DataLevelChangeReqInfo *info = new (std::nothrow) DataLevelChangeReqInfo(); if (info == nullptr) { COMM_LOGE(COMM_SVC, "DataLevelChangeReqInfo object is nullptr"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_REG_CB_FAILED; } if (strcpy_s(info->pkgName, PKG_NAME_SIZE_MAX, pkgName) != EOK) { LNN_LOGE(LNN_EVENT, "copy pkgName fail"); delete info; - return SOFTBUS_MEM_ERR; + return SOFTBUS_STRCPY_ERR; } info->pid = callingPid; g_dataLevelChangeRequestInfo.push_back(info); @@ -406,7 +406,7 @@ int32_t LnnIpcStopRefreshLNN(const char *pkgName, int32_t callingPid, int32_t su if (IsRepeatRefreshLnnRequest(pkgName, callingPid, subscribeId) && DeleteRefreshLnnInfo(pkgName, callingPid, subscribeId) != SOFTBUS_OK) { LNN_LOGE(LNN_EVENT, "stop refresh lnn, clean info fail"); - return SOFTBUS_ERR; + return SOFTBUS_NETWORK_STOP_REFRESH_LNN_FAILED; } return LnnStopDiscDevice(pkgName, subscribeId, false); } diff --git a/interfaces/kits/common/softbus_error_code.h b/interfaces/kits/common/softbus_error_code.h index 7e4d35180..c230731cb 100644 --- a/interfaces/kits/common/softbus_error_code.h +++ b/interfaces/kits/common/softbus_error_code.h @@ -619,7 +619,15 @@ enum SoftBusErrNo { SOFTBUS_NETWORK_BUILDER_INIT_FAILED, SOFTBUS_NETWORK_META_NODE_INIT_FAILED, SOFTBUS_CENTER_EVENT_INIT_FAILED, - + SOFTBUS_NETWORK_GET_CLIENT_IDENTITY_FAILED, + SOFTBUS_NETWORK_WRITEBOOL_FAILED, + SOFTBUS_NETWORK_REG_CB_FAILED, + SOFTBUS_NETWORK_GET_SERVICE_IDENTITY_FAILED, + SOFTBUS_NETWORK_GET_SERVICE_NUM_FAILED, + SOFTBUS_NETWORK_GET_SERVICE_NUM_ZERO, + SOFTBUS_NETWORK_GET_CLIENT_PROXY_NULL, + SOFTBUS_NETWORK_STOP_REFRESH_LNN_FAILED, + /* errno begin: -((203 << 21) | (4 << 16) | (1 << 12) | 0x0FFF) */ SOFTBUS_LANE_ERR_BASE = SOFTBUS_SUB_ERRNO(LNN_SUB_MODULE_CODE, LNN_LANE_MODULE_CODE), SOFTBUS_LANE_SELECT_FAIL, diff --git a/tests/core/bus_center/test/ipc/client_proxy_test.cpp b/tests/core/bus_center/test/ipc/client_proxy_test.cpp index 92853d58b..4ea05421b 100644 --- a/tests/core/bus_center/test/ipc/client_proxy_test.cpp +++ b/tests/core/bus_center/test/ipc/client_proxy_test.cpp @@ -71,9 +71,9 @@ HWTEST_F(ClientProxyTest, OnJoinLNNResultTest_01, TestSize.Level1) char *addr = const_cast(TEST_ADDR); void *addrInput = reinterpret_cast(addr); int32_t ret = clientProxy->OnJoinLNNResult(nullptr, TEST_ADDR_TYPE_LEN, TEST_NETWORK_ID, TEST_RET_CODE); - EXPECT_TRUE(ret == SOFTBUS_ERR); + EXPECT_NE(ret, SOFTBUS_OK); ret = clientProxy->OnJoinLNNResult(addrInput, TEST_ADDR_TYPE_LEN, nullptr, TEST_RET_CODE); - EXPECT_TRUE(ret == SOFTBUS_ERR); + EXPECT_NE(ret, SOFTBUS_OK); ret = clientProxy->OnJoinLNNResult(addrInput, TEST_ADDR_TYPE_LEN, TEST_NETWORK_ID, TEST_RET_CODE); EXPECT_TRUE(ret == SOFTBUS_OK); } From 944e4a4a0831122f835675271c95e0e7b9314587 Mon Sep 17 00:00:00 2001 From: "37.2" Date: Sun, 10 Nov 2024 09:46:27 +0800 Subject: [PATCH 2/3] add legacy dfx Signed-off-by: 37.2 Change-Id: I32e464f5f801846a6242acf63f7a695f2ed76d3d --- .../event/src/convert/conn_event_converter.h | 24 ++++++++++++++++--- .../interface/include/form/conn_event_form.h | 10 ++++++++ .../unittest/mock/conn_hisysevent_matcher.h | 18 ++++++++++++-- .../event/unittest/src/conn_event_test.cpp | 13 ++++++++-- 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/core/common/dfx/event/src/convert/conn_event_converter.h b/core/common/dfx/event/src/convert/conn_event_converter.h index eed05ebc4..b653b35f7 100644 --- a/core/common/dfx/event/src/convert/conn_event_converter.h +++ b/core/common/dfx/event/src/convert/conn_event_converter.h @@ -82,8 +82,17 @@ CONN_ASSIGNER(Errcode, StaChannel, staChannel) CONN_ASSIGNER(Errcode, ApChannel, apChannel) CONN_ASSIGNER(String, PeerDevVer, peerDevVer) CONN_ASSIGNER(Errcode, RemoteScreenStatus, remoteScreenStatus) +CONN_ASSIGNER(Errcode, BusinessType, businessType) +CONN_ASSIGNER(Int32, BusinessId, businessId) +CONN_ASSIGNER(Errcode, Timeout, timeout) +CONN_ASSIGNER(Errcode, FastestConnectEnable, fastestConnectEnable) +CONN_ASSIGNER(Errcode, CoapDataChannel, coapDataChannel) +CONN_ASSIGNER(Errcode, EnableWideBandwidth, enableWideBandwidth) +CONN_ASSIGNER(Errcode, P2pRole, p2pRole) +CONN_ASSIGNER(Errcode, NeedHmlConnect, needHmlConnect) +CONN_ASSIGNER(String, BusinessTag, businessTag) -#define CONN_ASSIGNER_SIZE 48 // Size of g_connAssigners +#define CONN_ASSIGNER_SIZE 57 // Size of g_connAssigners static HiSysEventParamAssigner g_connAssigners[] = { { "STAGE_RES", HISYSEVENT_INT32, ConnAssignerResult }, { "ERROR_CODE", HISYSEVENT_INT32, ConnAssignerErrcode }, @@ -125,14 +134,23 @@ static HiSysEventParamAssigner g_connAssigners[] = { { "NEGOTIATE_TIME", HISYSEVENT_UINT64, ConnAssignerNegotiateTime }, { "LINK_TIME", HISYSEVENT_UINT64, ConnAssignerLinkTime }, { "OS_TYPE", HISYSEVENT_INT32, ConnAssignerOsType }, - { "LOCAL_DEVICE_TYPE", HISYSEVENT_STRING, ConnAssignerLocalDeviceType }, - { "REMOTE_DEVICE_TYPE", HISYSEVENT_STRING, ConnAssignerRemoteDeviceType }, + { "LOCAL_DEV_TYPE", HISYSEVENT_STRING, ConnAssignerLocalDeviceType }, + { "PEER_DEV_TYPE", HISYSEVENT_STRING, ConnAssignerRemoteDeviceType }, { "P2P_CHANNEL", HISYSEVENT_INT32, ConnAssignerP2pChannel }, { "HML_CHANNEL", HISYSEVENT_INT32, ConnAssignerHmlChannel }, { "STA_CHANNEL", HISYSEVENT_INT32, ConnAssignerStaChannel }, { "AP_CHANNEL", HISYSEVENT_INT32, ConnAssignerApChannel }, { "PEER_DEV_VER", HISYSEVENT_STRING, ConnAssignerPeerDevVer }, { "REMOTE_SCREEN_STATUS", HISYSEVENT_INT32, ConnAssignerRemoteScreenStatus}, + { "BUSINESS_TYPE", HISYSEVENT_INT32, ConnAssignerBusinessType }, + { "BUSINESS_ID", HISYSEVENT_INT32, ConnAssignerBusinessId }, + { "TIME_OUT", HISYSEVENT_INT32, ConnAssignerTimeout }, + { "FASTEST_CONNECT_ENABLE", HISYSEVENT_INT32, ConnAssignerFastestConnectEnable}, + { "COAP_DATA_CHANNEL", HISYSEVENT_INT32, ConnAssignerCoapDataChannel }, + { "ENABLE_WIDE_BANDWIDTH", HISYSEVENT_INT32, ConnAssignerEnableWideBandwidth }, + { "P2P_ROLE", HISYSEVENT_INT32, ConnAssignerP2pRole }, + { "NEED_HML_CONNECT", HISYSEVENT_INT32, ConnAssignerNeedHmlConnect }, + { "BUSINESS_TAG", HISYSEVENT_STRING, ConnAssignerBusinessTag }, // Modification Note: remember updating CONN_ASSIGNER_SIZE }; diff --git a/core/common/dfx/interface/include/form/conn_event_form.h b/core/common/dfx/interface/include/form/conn_event_form.h index 1d9139141..6a854fd0c 100644 --- a/core/common/dfx/interface/include/form/conn_event_form.h +++ b/core/common/dfx/interface/include/form/conn_event_form.h @@ -34,6 +34,7 @@ typedef enum { EVENT_SCENE_SOCKET_CONNECT = 7, EVENT_SCENE_SOCKET_SHUTDOWN = 8, EVENT_SCENE_SOCKET_CLOSE = 9, + EVENT_SCENE_LEGACY_CONNECT = 10, } ConnEventScene; typedef enum { @@ -112,6 +113,15 @@ typedef struct { int32_t apChannel; // HOTSPOT_CHAN const char *peerDevVer; // REMOTE_OS_VERSION int32_t remoteScreenStatus; // REMOTE_SCREEN_STATUS + int32_t businessType; // BUSINESS_TYPE + int32_t businessId; // BUSINESS_ID + int32_t timeout; // TIME_OUT + int32_t fastestConnectEnable; // FASTEST_CONNECT_ENABLE + int32_t coapDataChannel; // COAP_DATA_CHANNEL + int32_t enableWideBandwidth; // ENABLE_WIDE_BANDWIDTH + int32_t p2pRole; // P2P_ROLE + int32_t needHmlConnect; // NEED_HML_CONNECT + const char *businessTag; // BUSINESS_TAG } ConnEventExtra; typedef enum { diff --git a/tests/core/common/dfx/event/unittest/mock/conn_hisysevent_matcher.h b/tests/core/common/dfx/event/unittest/mock/conn_hisysevent_matcher.h index f88d59669..47ba33a2b 100644 --- a/tests/core/common/dfx/event/unittest/mock/conn_hisysevent_matcher.h +++ b/tests/core/common/dfx/event/unittest/mock/conn_hisysevent_matcher.h @@ -51,6 +51,11 @@ static void MatchConnEventNameTypeExtraStrParam(const HiSysEventParam *params, i EXPECT_STREQ(params[index].v.s, extraParam); } +static void MatchNotConnEventNameExtraStrParam(const HiSysEventParam *params, int32_t index, const char * extraParam) +{ + EXPECT_NE(params[index].name, g_connAssigners[index].name); +} + static void MatchConnEventNameTypeExtraStrParamAnony(const HiSysEventParam *params, int32_t index, const char * extraParam) { @@ -66,14 +71,23 @@ static void MatchConnEventNameTypeExtraStrParamAnony(const HiSysEventParam *para static int32_t MatchConnEventNameTypeExtraForAddMsg(const HiSysEventParam *params, int32_t index, ConnEventExtra extra) { MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.osType); - MatchConnEventNameTypeExtraStrParam(params, ++index, extra.localDeviceType); - MatchConnEventNameTypeExtraStrParam(params, ++index, extra.remoteDeviceType); + MatchNotConnEventNameExtraStrParam(params, ++index, extra.localDeviceType); + MatchNotConnEventNameExtraStrParam(params, ++index, extra.remoteDeviceType); MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.p2pChannel); MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.hmlChannel); MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.staChannel); MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.apChannel); MatchConnEventNameTypeExtraStrParam(params, ++index, extra.peerDevVer); MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.remoteScreenStatus); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.businessType); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.businessId); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.timeout); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.fastestConnectEnable); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.coapDataChannel); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.enableWideBandwidth); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.p2pRole); + MatchConnEventNameTypeExtraInt32Param(params, ++index, extra.needHmlConnect); + MatchConnEventNameTypeExtraStrParam(params, ++index, extra.businessTag); return ++index; } diff --git a/tests/core/common/dfx/event/unittest/src/conn_event_test.cpp b/tests/core/common/dfx/event/unittest/src/conn_event_test.cpp index 6b0329d6d..f20654da4 100644 --- a/tests/core/common/dfx/event/unittest/src/conn_event_test.cpp +++ b/tests/core/common/dfx/event/unittest/src/conn_event_test.cpp @@ -74,6 +74,15 @@ static ConnEventExtra g_validExtra = { .apChannel = 22, .peerDevVer = "peerDevVer", .remoteScreenStatus = 1, + .businessType = 1, + .businessId = 1, + .timeout = 1, + .fastestConnectEnable = 1, + .coapDataChannel = 1, + .enableWideBandwidth = 1, + .p2pRole = 1, + .needHmlConnect = 1, + .businessTag = "test", }; /** @@ -163,7 +172,7 @@ static ConnEventExtra g_invalidExtra = { HWTEST_F(ConnEventTest, ConnEventTest003, TestSize.Level0) { constexpr int32_t TWO_VALID_EXTRA_SIZE = 2; // result, errcode is valid - constexpr int32_t VALID_EXTRA_SIZE = 15; + constexpr int32_t VALID_EXTRA_SIZE = 22; HiSysEventMock mock; EXPECT_CALL(mock, @@ -183,7 +192,7 @@ HWTEST_F(ConnEventTest, ConnEventTest004, TestSize.Level0) { ConnEventExtra emptyExtra = { 0 }; constexpr int32_t TWO_VALID_EXTRA_SIZE = 2; // result, errcode is valid - constexpr int32_t VALID_EXTRA_SIZE = 15; + constexpr int32_t VALID_EXTRA_SIZE = 22; HiSysEventMock mock; EXPECT_CALL(mock, From 5b84ee93bb29e343e170df370d22e84ff91262e8 Mon Sep 17 00:00:00 2001 From: sunxuejiao Date: Tue, 12 Nov 2024 14:37:07 +0800 Subject: [PATCH 3/3] add trans dfx event enum type Signed-off-by: sunxuejiao --- core/common/dfx/interface/include/form/trans_event_form.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/common/dfx/interface/include/form/trans_event_form.h b/core/common/dfx/interface/include/form/trans_event_form.h index 9970f8b9d..d462787c6 100644 --- a/core/common/dfx/interface/include/form/trans_event_form.h +++ b/core/common/dfx/interface/include/form/trans_event_form.h @@ -39,6 +39,10 @@ typedef enum { EVENT_SCENE_TRANS_PROXY_RESET_PEER = 12, EVENT_SCENE_TRANS_CHANNEL_STATISTICS = 13, EVENT_SCENE_TRANS_CHANNEL_INSTANT = 14, + EVENT_SCENE_TRANS_MESSAGE_PARSE = 15, + EVENT_SCENE_TRANS_RECEIVED_DATA = 16, + EVENT_SCENE_TRANS_SEND_DATA = 17, + EVENT_SCENE_CHANNEL_REQUEST = 18, } TransEventScene; typedef enum {