Discovery Module returns true error code

Signed-off-by: quyh <quyihao@huawei.com>
This commit is contained in:
quyh 2024-05-06 19:28:16 +08:00
parent 096dbd2ab4
commit e79c84c4f3
4 changed files with 22 additions and 20 deletions

View File

@ -50,10 +50,10 @@ int32_t ClientIpcOnDeviceFound(const char *pkgName, const DeviceInfo *device, co
return SOFTBUS_IPC_ERR;
}
SvcIdentity svc = {0};
int ret = GetSvcIdentityByPkgName(pkgName, &svc);
if (ret != SOFTBUS_OK) {
int status = GetSvcIdentityByPkgName(pkgName, &svc);
if (status != SOFTBUS_OK) {
DISC_LOGE(DISC_CONTROL, "ondevice found callback get svc failed.");
return ret;
return status;
}
MessageOption option;
MessageOptionInit(&option);
@ -83,10 +83,10 @@ int32_t ClientIpcOnDiscoverFailed(const char *pkgName, int subscribeId, int fail
return SOFTBUS_IPC_ERR;
}
SvcIdentity svc = {0};
int ret = GetSvcIdentityByPkgName(pkgName, &svc);
if (ret != SOFTBUS_OK) {
int status = GetSvcIdentityByPkgName(pkgName, &svc);
if (status != SOFTBUS_OK) {
DISC_LOGE(DISC_CONTROL, "on discovery failed callback get svc failed.");
return ret;
return status;
}
MessageOption option;
MessageOptionInit(&option);
@ -111,10 +111,10 @@ int32_t ClientIpcDiscoverySuccess(const char *pkgName, int subscribeId)
return SOFTBUS_IPC_ERR;
}
SvcIdentity svc = {0};
int ret = GetSvcIdentityByPkgName(pkgName, &svc);
if (ret != SOFTBUS_OK) {
int status = GetSvcIdentityByPkgName(pkgName, &svc);
if (status != SOFTBUS_OK) {
DISC_LOGE(DISC_CONTROL, "on discovery success callback get svc failed.");
return ret;
return status;
}
MessageOption option;
MessageOptionInit(&option);
@ -139,10 +139,10 @@ int32_t ClientIpcOnPublishSuccess(const char *pkgName, int publishId)
return SOFTBUS_IPC_ERR;
}
SvcIdentity svc = {0};
int ret = GetSvcIdentityByPkgName(pkgName, &svc);
if (ret != SOFTBUS_OK) {
int status = GetSvcIdentityByPkgName(pkgName, &svc);
if (status != SOFTBUS_OK) {
DISC_LOGE(DISC_CONTROL, "on publish success callback get svc failed.");
return ret;
return status;
}
MessageOption option;
MessageOptionInit(&option);
@ -172,10 +172,10 @@ int32_t ClientIpcOnPublishFail(const char *pkgName, int publishId, int reason)
return SOFTBUS_IPC_ERR;
}
SvcIdentity svc = {0};
int ret = GetSvcIdentityByPkgName(pkgName, &svc);
if (ret != SOFTBUS_OK) {
int status = GetSvcIdentityByPkgName(pkgName, &svc);
if (status != SOFTBUS_OK) {
DISC_LOGE(DISC_CONTROL, "on publish failed callback get svc failed.");
return ret;
return status;
}
MessageOption option;
MessageOptionInit(&option);

View File

@ -491,6 +491,7 @@ enum SoftBusErrNo {
SOFTBUS_DISCOVER_CHAR_CONVERT_FAILED,
SOFTBUS_DISCOVER_GET_REMOTE_FAILED,
SOFTBUS_DISCOVER_GET_CLIENT_PROXY_FAILED,
SOFTBUS_DISCOVER_ADD_LISTENER_FAILED,
/* errno begin: -((203 << 21) | (1 << 16) | (2 << 12) | 0x0FFF) */
SOFTBUS_DISCOVER_MANAGER_ERR_BASE = SOFTBUS_SUB_ERRNO(DISC_SUB_MODULE_CODE, DISC_MANAGER_SUB_MODULE_CODE),
SOFTBUS_DISCOVER_MANAGER_NOT_INIT,
@ -518,8 +519,8 @@ enum SoftBusErrNo {
SOFTBUS_DISCOVER_BLE_SET_BROADCAST_DATA_FAIL,
SOFTBUS_DISCOVER_BLE_ASSEMBLE_DATA_FAIL,
SOFTBUS_DISCOVER_BLE_PARSE_RECV_DATA_FAIL,
SOFTBUS_DISCOVER_BLE_NO_AVAILABLE_CHANNEL_FAIL,
SOFTBUS_DISCOVER_BLE_NOT_IN_USED_FAIL,
SOFTBUS_DISCOVER_BLE_UNKNOW_TYPE_FAIL,
SOFTBUS_DISCOVER_BLE_SET_FILTER_FAIL,
/* errno begin: -((203 << 21) | (1 << 16) | (4 << 12) | 0x0FFF) */
SOFTBUS_DISCOVER_COAP_ERR_BASE = SOFTBUS_SUB_ERRNO(DISC_SUB_MODULE_CODE, DISC_COAP_SUB_MODULE_CODE),
SOFTBUS_DISCOVER_COAP_NOT_INIT,

View File

@ -91,7 +91,8 @@ int32_t StartDiscoveryInner(const char *packageName, const SubscribeInfo *info,
* @param[in] packageName Indicates the pointer to the package name,
* and the name of the relevant package carrying its own capabilities.
* @param[in] subscribeId ID to stop discovery this time.
* @return <b>SOFTBUS_NO_INIT</b> The internal stop discovery function cannot be started. Other devices can still be found.
* @return <b>SOFTBUS_NO_INIT</b> The internal stop discovery function cannot be started.
* Other devices can still be found.
* @return <b>SOFTBUS_OK</b> Internal stop discovery function started successfully.
* You cannot discover devices with specific functions.
*/

View File

@ -207,7 +207,7 @@ HWTEST_F(SoftbusBleGattTest, RegisterScanListener, TestSize.Level3)
}
ASSERT_EQ(MockBluetooth::interface->RegisterScanListener(&scannerId, GetStubScanListener()),
SOFTBUS_DISCOVER_BLE_NO_AVAILABLE_CHANNEL_FAIL);
SOFTBUS_BC_ADAPTER_REGISTER_FAIL);
for (size_t i = 0; i < GATT_SCAN_MAX_NUM; i++) {
ASSERT_EQ(MockBluetooth::interface->UnRegisterScanListener(scanListerIds[i]), SOFTBUS_OK);
@ -396,7 +396,7 @@ HWTEST_F(SoftbusBleGattTest, RegisterBroadcaster, TestSize.Level3)
ASSERT_EQ(MockBluetooth::interface->RegisterBroadcaster(&advIds[i], GetStubAdvCallback()), SOFTBUS_OK);
}
ASSERT_EQ(MockBluetooth::interface->RegisterBroadcaster(&advId, GetStubAdvCallback()),
SOFTBUS_DISCOVER_BLE_NO_AVAILABLE_CHANNEL_FAIL);
SOFTBUS_BC_ADAPTER_REGISTER_FAIL);
for (size_t i = 0; i < GATT_ADV_MAX_NUM; i++) {
ASSERT_EQ(MockBluetooth::interface->UnRegisterBroadcaster(advIds[i]), SOFTBUS_OK);
}