mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 19:00:38 +00:00
commit
b2ef23c190
@ -169,12 +169,13 @@ int32_t SoftbusGattcRegisterCallback(SoftBusGattcCallback *cb, int32_t clientId)
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(cb->ServiceCompleteCallback != NULL, SOFTBUS_INVALID_PARAM, CONN_BLE,
|
||||
"ServiceCompleteCallback is null");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(clientId >= 0, SOFTBUS_INVALID_PARAM, CONN_BLE, "clientId < 0");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(g_softBusGattcManager != NULL, SOFTBUS_ERR, CONN_BLE, "GattcManager is null");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(g_softBusGattcManager != NULL, SOFTBUS_INVALID_PARAM,
|
||||
CONN_BLE, "GattcManager is null");
|
||||
|
||||
SoftBusGattcManager *gattcManager = (SoftBusGattcManager *)SoftBusCalloc(sizeof(SoftBusGattcManager));
|
||||
if (gattcManager == NULL) {
|
||||
CONN_LOGE(CONN_BLE, "calloc failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MALLOC_ERR;
|
||||
}
|
||||
|
||||
gattcManager->callback = *cb;
|
||||
@ -229,8 +230,8 @@ int32_t SoftbusGattcUnRegister(int32_t clientId)
|
||||
CONN_LOGE(CONN_BLE, "BleGattcUnRegister error");
|
||||
ret = SOFTBUS_GATTC_INTERFACE_FAILED;
|
||||
}
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexLock(&g_softBusGattcManager->lock) == SOFTBUS_OK, SOFTBUS_ERR,
|
||||
CONN_BLE, "try to lock failed, clientId=%{public}d", clientId);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexLock(&g_softBusGattcManager->lock) == SOFTBUS_OK,
|
||||
SOFTBUS_LOCK_ERR, CONN_BLE, "try to lock failed, clientId=%{public}d", clientId);
|
||||
SoftBusGattcManager *it = NULL;
|
||||
SoftBusGattcManager *next = NULL;
|
||||
LIST_FOR_EACH_ENTRY_SAFE(it, next, &g_softBusGattcManager->list, SoftBusGattcManager, node) {
|
||||
@ -278,7 +279,7 @@ static int32_t SoftbusGattcAddMacAddrToList(int32_t clientId, const SoftBusBtAdd
|
||||
if (status != SOFTBUS_OK) {
|
||||
SoftBusFree(bleConnAddr);
|
||||
CONN_LOGE(CONN_BLE, "convert bt mac to str fail, error=%{public}d", status);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
bleConnAddr->clientId = clientId;
|
||||
|
||||
@ -434,7 +435,7 @@ int32_t SoftbusGattcSetFastestConn(int32_t clientId)
|
||||
int ret = BleGattcSetFastestConn(clientId, true);
|
||||
if (ret != OHOS_BT_STATUS_SUCCESS) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattcSetFastestConn failed, return code = %{public}d", ret);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SET_FASTEST_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -453,7 +454,7 @@ int32_t SoftbusGattcSetPriority(int32_t clientId, SoftBusBtAddr *addr, SoftbusBl
|
||||
int ret = BleGattcSetPriority(clientId, &bdAddr, (BtGattPriority)priority);
|
||||
if (ret != OHOS_BT_STATUS_SUCCESS) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattcSetPriority failed, return code = %{public}d", ret);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SET_PRIORITY_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -462,13 +463,13 @@ int32_t InitSoftbusAdapterClient(void)
|
||||
{
|
||||
g_softBusGattcManager = CreateSoftBusList();
|
||||
if (g_softBusGattcManager == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CREATE_LIST_ERR;
|
||||
}
|
||||
g_btAddrs = CreateSoftBusList();
|
||||
if (g_btAddrs == NULL) {
|
||||
DestroySoftBusList(g_softBusGattcManager);
|
||||
g_softBusGattcManager = NULL;
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CREATE_LIST_ERR;
|
||||
}
|
||||
g_btGattClientCallbacks.ConnectionStateCb = GattcConnectionStateChangedCallback;
|
||||
g_btGattClientCallbacks.connectParaUpdateCb = GattcConnectParaUpdateCallback;
|
||||
|
@ -65,7 +65,7 @@ int CheckGattsStatus(void)
|
||||
{
|
||||
if (IsGattsManagerEmpty()) {
|
||||
CONN_LOGE(CONN_BLE, "GattsManager isListEmpty");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_LIST_EMPTY;
|
||||
}
|
||||
while (g_halRegFlag == 0) {
|
||||
CONN_LOGE(CONN_BLE, "ble hal registerring");
|
||||
@ -80,7 +80,7 @@ int CheckGattsStatus(void)
|
||||
}
|
||||
if (g_halRegFlag == -1) {
|
||||
CONN_LOGE(CONN_BLE, "g_halRegFlag == -1");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_NUM;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -89,11 +89,11 @@ int SoftBusGattsAddService(SoftBusBtUuid srvcUuid, bool isPrimary, int number)
|
||||
{
|
||||
if ((srvcUuid.uuidLen == 0) || (srvcUuid.uuid == NULL) || (number <= 0)) {
|
||||
CONN_LOGE(CONN_BLE, "invalid param");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
BtUuid uuid = {
|
||||
.uuid = srvcUuid.uuid,
|
||||
@ -102,7 +102,7 @@ int SoftBusGattsAddService(SoftBusBtUuid srvcUuid, bool isPrimary, int number)
|
||||
CONN_LOGI(CONN_BLE, "halServerId=%{public}d", g_halServerId);
|
||||
if (BleGattsAddService(g_halServerId, uuid, isPrimary, number) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsAddService return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -111,11 +111,11 @@ int SoftBusGattsAddCharacteristic(int srvcHandle, SoftBusBtUuid characUuid, int
|
||||
{
|
||||
if ((characUuid.uuidLen == 0) || (characUuid.uuid == NULL)) {
|
||||
CONN_LOGE(CONN_BLE, "invalid param");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
BtUuid uuid = {
|
||||
.uuid = characUuid.uuid,
|
||||
@ -123,7 +123,7 @@ int SoftBusGattsAddCharacteristic(int srvcHandle, SoftBusBtUuid characUuid, int
|
||||
};
|
||||
if (BleGattsAddCharacteristic(g_halServerId, srvcHandle, uuid, properties, permissions) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsAddCharacteristic return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_ADD_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -132,11 +132,11 @@ int SoftBusGattsAddDescriptor(int srvcHandle, SoftBusBtUuid descUuid, int permis
|
||||
{
|
||||
if ((descUuid.uuidLen == 0) || (descUuid.uuid == NULL)) {
|
||||
CONN_LOGE(CONN_BLE, "invalid param");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
BtUuid uuid = {
|
||||
.uuid = descUuid.uuid,
|
||||
@ -144,7 +144,7 @@ int SoftBusGattsAddDescriptor(int srvcHandle, SoftBusBtUuid descUuid, int permis
|
||||
};
|
||||
if (BleGattsAddDescriptor(g_halServerId, srvcHandle, uuid, permissions) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsAddDescriptor return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_ADD_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -153,12 +153,12 @@ int SoftBusGattsStartService(int srvcHandle)
|
||||
{
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
CONN_LOGI(CONN_BLE, "halServerId = %{public}d, srvcHandle = %{public}d", g_halServerId, srvcHandle);
|
||||
if (BleGattsStartService(g_halServerId, srvcHandle) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsStartService return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_START_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -167,12 +167,12 @@ int SoftBusGattsStopService(int srvcHandle)
|
||||
{
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
CONN_LOGI(CONN_BLE, "halServerId = %{public}d, srvcHandle = %{public}d", g_halServerId, srvcHandle);
|
||||
if (BleGattsStopService(g_halServerId, srvcHandle) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsStopService return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -181,11 +181,11 @@ int SoftBusGattsDeleteService(int srvcHandle)
|
||||
{
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
if (BleGattsDeleteService(g_halServerId, srvcHandle) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsDeleteService return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_DELETE_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -194,17 +194,17 @@ int SoftBusGattsConnect(SoftBusBtAddr btAddr)
|
||||
{
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
BdAddr addr;
|
||||
if (memcpy_s(addr.addr, BT_ADDR_LEN, btAddr.addr, BT_ADDR_LEN) != EOK) {
|
||||
CONN_LOGE(CONN_BLE, "memcpy fail");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
CONN_LOGI(CONN_BLE, "BleGattsConnect start");
|
||||
if (BleGattsConnect(g_halServerId, addr) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsConnect return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVER_CONNECT_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -213,17 +213,17 @@ int SoftBusGattsDisconnect(SoftBusBtAddr btAddr, int connId)
|
||||
{
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "CheckGattsStatus return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
BdAddr addr;
|
||||
if (memcpy_s(addr.addr, BT_ADDR_LEN, btAddr.addr, BT_ADDR_LEN) != EOK) {
|
||||
CONN_LOGE(CONN_BLE, "memcpy fail");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
CONN_LOGI(CONN_BLE, "BleGattsDisconnect start");
|
||||
if (BleGattsDisconnect(g_halServerId, addr, connId) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsDisconnect return error");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVER_DISCONNECT_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -237,7 +237,7 @@ int SoftBusGattsSendResponse(SoftBusGattsResponse *param)
|
||||
|
||||
CONN_LOGI(CONN_BLE, "connId=%{public}d", param->connectId);
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
GattsSendRspParam response = {
|
||||
.connectId = param->connectId,
|
||||
@ -247,7 +247,7 @@ int SoftBusGattsSendResponse(SoftBusGattsResponse *param)
|
||||
.value = param->value
|
||||
};
|
||||
if (BleGattsSendResponse(g_halServerId, &response) != SOFTBUS_OK) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVER_SEND_RESPONSE_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -261,7 +261,7 @@ int SoftBusGattsSendNotify(SoftBusGattsNotify *param)
|
||||
|
||||
CONN_LOGD(CONN_BLE, "enter");
|
||||
if (CheckGattsStatus() != SOFTBUS_OK) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_CHECK_STATUS_ERR;
|
||||
}
|
||||
GattsSendIndParam notify = {
|
||||
.connectId = param->connectId,
|
||||
@ -274,7 +274,7 @@ int SoftBusGattsSendNotify(SoftBusGattsNotify *param)
|
||||
notify.connectId, notify.attrHandle, notify.confirm);
|
||||
if (BleGattsSendIndication(g_halServerId, ¬ify) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "BleGattsSendIndication failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_UNDERLAY_SERVER_SEND_INDICATION_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -700,7 +700,7 @@ static void FindCallbackByUdidAndSetHandle(
|
||||
|
||||
static int32_t CreateAndAddGattsManager(SoftBusGattsCallback *callback, SoftBusBtUuid serviceUuid, int32_t expectedMtu)
|
||||
{
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexLock(&g_softBusGattsManager->lock) == SOFTBUS_OK, SOFTBUS_ERR,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexLock(&g_softBusGattsManager->lock) == SOFTBUS_OK, SOFTBUS_LOCK_ERR,
|
||||
CONN_BLE, "try to lock failed");
|
||||
SoftBusGattsManager *it = NULL;
|
||||
LIST_FOR_EACH_ENTRY(it, &g_softBusGattsManager->list, SoftBusGattsManager, node) {
|
||||
@ -716,7 +716,7 @@ static int32_t CreateAndAddGattsManager(SoftBusGattsCallback *callback, SoftBusB
|
||||
if (gattsManager == NULL) {
|
||||
CONN_LOGE(CONN_BLE, "calloc failed");
|
||||
(void)SoftBusMutexUnlock(&g_softBusGattsManager->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MALLOC_ERR;
|
||||
}
|
||||
gattsManager->serviceUuid = serviceUuid;
|
||||
gattsManager->callback = *callback;
|
||||
@ -806,7 +806,7 @@ int InitSoftbusAdapterServer(void)
|
||||
{
|
||||
g_softBusGattsManager = CreateSoftBusList();
|
||||
if (g_softBusGattsManager == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CREATE_LIST_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
@ -192,7 +192,7 @@ int32_t InitBroadcastMgr(void)
|
||||
DISC_CHECK_AND_RETURN_RET_LOGE(ret == SOFTBUS_OK, ret, DISC_BLE, "call from adapter fail!");
|
||||
|
||||
ret = SoftBusAddBtStateListener(&g_softbusBcBtStateLister);
|
||||
DISC_CHECK_AND_RETURN_RET_LOGE(ret != SOFTBUS_ERR, ret, DISC_BLE, "add bt state listener fail!");
|
||||
DISC_CHECK_AND_RETURN_RET_LOGE(ret >= 0, ret, DISC_BLE, "add bt state listener fail!");
|
||||
g_btStateListenerId = ret;
|
||||
g_mgrInit = true;
|
||||
|
||||
|
@ -44,7 +44,7 @@ static int ConvertBtState(int transport, int state)
|
||||
case OHOS_GAP_STATE_TURN_OFF:
|
||||
return (transport == BR_STATE_CB_TRANSPORT) ? SOFTBUS_BR_STATE_TURN_OFF : SOFTBUS_BLE_STATE_TURN_OFF;
|
||||
default:
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_SWITCH_STATE_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ static int ConvertAclState(GapAclState state)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_ACL_SWITCH_STATE_ERR;
|
||||
}
|
||||
|
||||
static SoftBusBtAddr ConvertBtAddr(const BdAddr *bdAddr)
|
||||
@ -165,7 +165,7 @@ static int RegisterListenerCallback(void)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
if (GapRegisterCallbacks(&g_softbusGapCb) != OHOS_BT_STATUS_SUCCESS) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_UNDERLAY_REGISTER_CB_ERR;
|
||||
}
|
||||
g_isRegCb = true;
|
||||
return SOFTBUS_OK;
|
||||
@ -174,10 +174,10 @@ static int RegisterListenerCallback(void)
|
||||
int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
|
||||
{
|
||||
if (listener == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (RegisterListenerCallback() != SOFTBUS_OK) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_UNDERLAY_REGISTER_CB_ERR;
|
||||
}
|
||||
for (int index = 0; index < STATE_LISTENER_MAX_NUM; index++) {
|
||||
if (!g_stateListener[index].isUsed) {
|
||||
@ -186,7 +186,7 @@ int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_ADD_STATE_LISTENER_ERR;
|
||||
}
|
||||
|
||||
int SoftBusRemoveBtStateListener(int listenerId)
|
||||
@ -204,7 +204,7 @@ int SoftBusEnableBt(void)
|
||||
if (EnableBle()) {
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLE_ENABLE_ERR;
|
||||
}
|
||||
|
||||
int SoftBusDisableBt(void)
|
||||
@ -212,7 +212,7 @@ int SoftBusDisableBt(void)
|
||||
if (DisableBle()) {
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLE_DISABLE_ERR;
|
||||
}
|
||||
|
||||
int SoftBusGetBtState(void)
|
||||
@ -234,11 +234,11 @@ int SoftBusGetBrState(void)
|
||||
int SoftBusGetBtMacAddr(SoftBusBtAddr *mac)
|
||||
{
|
||||
if (mac == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!GetLocalAddr(mac->addr, BT_ADDR_LEN)) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_UNDERLAY_GET_ADDR_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -259,7 +259,7 @@ int SoftBusSetBtName(const char *name)
|
||||
if (SetLocalName((unsigned char *)name, strlen(name))) {
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_COMM_BLUETOOTH_UNDERLAY_SET_NAME_ERR;
|
||||
}
|
||||
|
||||
void SoftBusBtInit(void)
|
||||
|
@ -20,7 +20,7 @@
|
||||
int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
|
||||
{
|
||||
(void)listener;
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_FUNC_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int SoftBusRemoveBtStateListener(int listenerId)
|
||||
@ -30,12 +30,12 @@ int SoftBusRemoveBtStateListener(int listenerId)
|
||||
|
||||
int SoftBusEnableBt(void)
|
||||
{
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_FUNC_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int SoftBusDisableBt(void)
|
||||
{
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_FUNC_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int SoftBusGetBrState(void)
|
||||
@ -57,7 +57,7 @@ int SoftBusGetBtName(unsigned char *name, unsigned int *len)
|
||||
|
||||
int SoftBusSetBtName(const char *name)
|
||||
{
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_FUNC_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
void SoftBusBtInit(void)
|
||||
|
@ -35,7 +35,7 @@ static int32_t OpenSppServer(const char *name, int32_t nameLen, const char *uuid
|
||||
{
|
||||
if (name == NULL || nameLen <= 0) {
|
||||
CONN_LOGW(CONN_BR, "OpenSppServer invalid param");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
(void)isSecure;
|
||||
|
||||
@ -57,7 +57,7 @@ static void CloseSppServer(int32_t serverFd)
|
||||
static int32_t ConnectByPort(const char *uuid, const BT_ADDR mac, const int socketPsmValue, void *connectCallback)
|
||||
{
|
||||
if (mac == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
BluetoothCreateSocketPara socketPara;
|
||||
(void)memset_s((char *)&socketPara, sizeof(socketPara), 0, sizeof(socketPara));
|
||||
@ -70,12 +70,12 @@ static int32_t ConnectByPort(const char *uuid, const BT_ADDR mac, const int sock
|
||||
(void)memset_s((char *)&bdAddr, sizeof(bdAddr), 0, sizeof(bdAddr));
|
||||
if (memcpy_s((char *)bdAddr.addr, OHOS_BD_ADDR_LEN, mac, BT_ADDR_LEN) != EOK) {
|
||||
CONN_LOGE(CONN_BR, "Connect memcpy_s failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
int ret = SocketConnectEx(&socketPara, &bdAddr, socketPsmValue, (BtSocketConnectionCallback *)connectCallback);
|
||||
if (ret < 0) {
|
||||
CONN_LOGE(CONN_BR, "connect failed, ret=%{public}d", ret);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BR_SOCKET_CONNECT_ERR;
|
||||
}
|
||||
CONN_LOGI(CONN_BR, "SocketConnectEx ok. clientId=%{public}d", ret);
|
||||
return ret;
|
||||
@ -104,7 +104,7 @@ static int32_t Accept(int32_t serverFd)
|
||||
int32_t ret = SppServerAccept(serverFd);
|
||||
if (ret == BT_SPP_INVALID_ID) {
|
||||
CONN_LOGE(CONN_BR, "Accept spp server failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BR_SPP_SERVER_ERR;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -133,7 +133,7 @@ static int32_t GetRemoteDeviceInfo(int32_t clientFd, const BluetoothRemoteDevice
|
||||
(void)SppGetRemoteAddr(clientFd, &bdAddr);
|
||||
if (memcpy_s((char *)device->mac, BT_ADDR_LEN, (char *)bdAddr.addr, OHOS_BD_ADDR_LEN) != EOK) {
|
||||
CONN_LOGE(CONN_BR, "GetRemoteDeviceInfo memcpy_s failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
|
||||
return SOFTBUS_OK;
|
||||
|
@ -306,7 +306,7 @@ static int32_t RetrySearchService(ConnBleConnection *connection, enum RetrySearc
|
||||
"retry search service just ignore. "
|
||||
"state=%{public}d, count=%{public}d, connId=%{public}u, handle=%{public}d, reason=%{public}d",
|
||||
state, retrySearchServiceCnt, connection->connectionId, underlayerHandle, reason);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
status = SoftbusGattcRefreshServices(underlayerHandle);
|
||||
@ -827,7 +827,7 @@ int32_t ConnGattClientUpdatePriority(ConnBleConnection *connection, ConnectBlePr
|
||||
if (state < BLE_CONNECTION_STATE_CONNECTED || state > BLE_CONNECTION_STATE_EXCHANGED_BASIC_INFO) {
|
||||
CONN_LOGW(CONN_BLE, "current connection state not support update priority, connId=%{public}u, err=%{public}d",
|
||||
connection->connectionId, state);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
SoftbusBleGattPriority gattPriority;
|
||||
@ -843,7 +843,7 @@ int32_t ConnGattClientUpdatePriority(ConnBleConnection *connection, ConnectBlePr
|
||||
break;
|
||||
default:
|
||||
CONN_LOGW(CONN_BLE, "connId=%{public}u, unknownPriority=%{public}d", connection->connectionId, priority);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
SoftBusBtAddr binaryAddr = { 0 };
|
||||
status = ConvertBtMacToBinary(connection->addr, BT_MAC_LEN, binaryAddr.addr, BT_ADDR_LEN);
|
||||
|
@ -214,7 +214,7 @@ int32_t ConnBleConnect(ConnBleConnection *connection)
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(connection != NULL, SOFTBUS_INVALID_PARAM, CONN_BLE,
|
||||
"ble connection connect failed, invalid param, connection is null");
|
||||
const BleUnifyInterface *interface = ConnBleGetUnifyInterface(connection->protocol);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_ERR, CONN_BLE,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_BLE,
|
||||
"ble connection connect failed, protocol not support");
|
||||
return interface->bleClientConnect(connection);
|
||||
}
|
||||
@ -247,7 +247,7 @@ int32_t ConnBleDisconnectNow(ConnBleConnection *connection, enum ConnBleDisconne
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(connection != NULL, SOFTBUS_INVALID_PARAM, CONN_BLE,
|
||||
"ble connection disconnect failed, invalid param, connection is null");
|
||||
const BleUnifyInterface *interface = ConnBleGetUnifyInterface(connection->protocol);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_ERR, CONN_BLE,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_BLE,
|
||||
"ble connection disconnect failed, protocol not support");
|
||||
CONN_LOGI(CONN_BLE,
|
||||
"receive ble disconnect now, connId=%{public}u, side=%{public}d, reason=%{public}d",
|
||||
@ -430,7 +430,7 @@ int32_t ConnBleUpdateConnectionPriority(ConnBleConnection *connection, ConnectBl
|
||||
return SOFTBUS_FUNC_NOT_SUPPORT;
|
||||
}
|
||||
const BleUnifyInterface *interface = ConnBleGetUnifyInterface(connection->protocol);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_ERR, CONN_BLE,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_BLE,
|
||||
"ble connection update connection priority failed, protocol not support");
|
||||
return interface->bleClientUpdatePriority(connection, priority);
|
||||
}
|
||||
@ -444,7 +444,7 @@ int32_t ConnBleSend(ConnBleConnection *connection, const uint8_t *data, uint32_t
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(dataLen != 0, SOFTBUS_INVALID_PARAM, CONN_BLE,
|
||||
"ble connection send data failed, invalid param, data len is 0");
|
||||
const BleUnifyInterface *interface = ConnBleGetUnifyInterface(connection->protocol);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_ERR, CONN_BLE,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(interface != NULL, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_BLE,
|
||||
"ble connection send data failed, protocol not support");
|
||||
return connection->side == CONN_SIDE_SERVER ?
|
||||
interface->bleServerSend(connection, data, dataLen, module) :
|
||||
@ -494,7 +494,7 @@ static void ConnBlePackCtrlMsgHeader(ConnPktHead *header, uint32_t dataLen)
|
||||
// GATT connection keep exchange 'udid' as keeping compatibility
|
||||
static int32_t SendBasicInfo(ConnBleConnection *connection)
|
||||
{
|
||||
int32_t status = SOFTBUS_ERR;
|
||||
int32_t status = SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
char devId[DEVID_BUFF_LEN] = { 0 };
|
||||
BleProtocolType protocol = connection->protocol;
|
||||
ConnBleFeatureBitSet featureBitSet = connection->featureBitSet;
|
||||
@ -593,7 +593,7 @@ static int32_t ParseBasicInfo(ConnBleConnection *connection, const uint8_t *data
|
||||
if (dataLen <= NET_CTRL_MSG_TYPE_HEADER_SIZE) {
|
||||
CONN_LOGI(CONN_BLE,
|
||||
"date len exceed, connId=%{public}u, dataLen=%{public}d", connection->connectionId, dataLen);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
int offset = 0;
|
||||
if (connection->protocol == BLE_COC) {
|
||||
@ -603,7 +603,7 @@ static int32_t ParseBasicInfo(ConnBleConnection *connection, const uint8_t *data
|
||||
if (netCtrlMsgHeader[0] != NET_CTRL_MSG_TYPE_BASIC_INFO) {
|
||||
CONN_LOGI(CONN_BLE,
|
||||
"not basic info type, connId=%{public}u, type=%{public}d", connection->connectionId, netCtrlMsgHeader[0]);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
offset += NET_CTRL_MSG_TYPE_HEADER_SIZE;
|
||||
cJSON *json = cJSON_ParseWithLength((char *)(data + offset), dataLen - offset);
|
||||
@ -618,7 +618,7 @@ static int32_t ParseBasicInfo(ConnBleConnection *connection, const uint8_t *data
|
||||
!GetJsonObjectNumberItem(json, BASIC_INFO_KEY_ROLE, &type)) {
|
||||
cJSON_Delete(json);
|
||||
CONN_LOGE(CONN_BLE, "basic info field not exist, connId=%{public}u", connection->connectionId);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
// optional field
|
||||
int32_t deviceType = 0;
|
||||
@ -902,7 +902,7 @@ static int32_t DoRetryAction(enum BleServerState expect)
|
||||
}
|
||||
}
|
||||
|
||||
return (statusGatt != SOFTBUS_OK || statusCoc != SOFTBUS_OK) ? SOFTBUS_ERR : SOFTBUS_OK;
|
||||
return (statusGatt != SOFTBUS_OK || statusCoc != SOFTBUS_OK) ? SOFTBUS_CONN_BLE_CHECK_STATUS_ERR : SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static void RetryServerStatConsistentHandler(void)
|
||||
@ -1077,7 +1077,7 @@ int32_t ConnBleInitConnectionMudule(SoftBusLooper *looper, ConnBleConnectionEven
|
||||
.onServerDataReceived = BleOnDataReceived,
|
||||
.onServerConnectionClosed = BleOnConnectionClosed,
|
||||
};
|
||||
ret = SOFTBUS_ERR;
|
||||
ret = SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
const BleUnifyInterface *interface;
|
||||
for (int i = BLE_GATT; i < BLE_PROTOCOL_MAX; i++) {
|
||||
interface = ConnBleGetUnifyInterface(i);
|
||||
|
@ -18,12 +18,12 @@
|
||||
|
||||
int32_t ConnBleDirectPipelineOpen(const ConnBleDirectPipelineOption *option, const ConnectResult *result)
|
||||
{
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NOT_IMPLEMENT;
|
||||
}
|
||||
|
||||
int32_t ConnBleDirectPipelineClose(int32_t channelId)
|
||||
{
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NOT_IMPLEMENT;
|
||||
}
|
||||
|
||||
int32_t ConnBleDirectPipelineInit(ConnBleDirectPipelineCallback* cb)
|
||||
@ -35,7 +35,7 @@ int32_t ConnBleDirectPipelineInit(ConnBleDirectPipelineCallback* cb)
|
||||
int32_t ConnBleDirectPipelineSendMessage(int32_t channelId, const uint8_t *data, uint32_t dataLen,
|
||||
PipelineMsgType type)
|
||||
{
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NOT_IMPLEMENT;
|
||||
}
|
||||
|
||||
void PipelineRegisterIpPortVerifyCallBack(const OnMessageReceivedFunc cb)
|
||||
|
@ -20,7 +20,7 @@
|
||||
int32_t ConnBleDirectConnectDevice(const ConnectOption *option, uint32_t reqId, const ConnectResult* result)
|
||||
{
|
||||
CONN_LOGW(CONN_BLE, "do not support ble direct connection");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NOT_IMPLEMENT;
|
||||
}
|
||||
|
||||
bool ConnBleDirectIsEnable(BleProtocolType protocol)
|
||||
|
@ -1418,14 +1418,14 @@ int32_t ConnBleKeepAlive(uint32_t connectionId, uint32_t requestId, uint32_t tim
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(time != 0 && time <= BLE_CONNECT_KEEP_ALIVE_TIMEOUT_MILLIS,
|
||||
SOFTBUS_INVALID_PARAM, CONN_BLE, "time is invaliad, time=%{public}u", time);
|
||||
ConnBleConnection *connection = ConnBleGetConnectionById(connectionId);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(connection != NULL, SOFTBUS_ERR, CONN_BLE,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(connection != NULL, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_BLE,
|
||||
"connection not exist, connectionId=%{public}u", connectionId);
|
||||
int32_t status = ConnBleUpdateConnectionRc(connection, 0, 1);
|
||||
if (status != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "update rc failed, status=%{public}d, connectionId=%{public}u, requestId=%{public}u",
|
||||
status, connectionId, requestId);
|
||||
ConnBleReturnConnection(&connection);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
ConnBleReturnConnection(&connection);
|
||||
ConnPostMsgToLooper(&g_bleManagerSyncHandler, BLE_MRG_MSG_KEEP_ALIVE_TIMEOUT, connectionId, requestId, NULL, time);
|
||||
@ -1436,12 +1436,12 @@ int32_t ConnBleKeepAlive(uint32_t connectionId, uint32_t requestId, uint32_t tim
|
||||
int32_t ConnBleRemoveKeepAlive(uint32_t connectionId, uint32_t requestId)
|
||||
{
|
||||
ConnBleConnection *connection = ConnBleGetConnectionById(connectionId);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(connection != NULL, SOFTBUS_ERR, CONN_BLE,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(connection != NULL, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_BLE,
|
||||
"connection not exist, connectionId=%{public}u", connectionId);
|
||||
bool isExist = false;
|
||||
ConnRemoveMsgFromLooper(
|
||||
&g_bleManagerSyncHandler, BLE_MRG_MSG_KEEP_ALIVE_TIMEOUT, connectionId, requestId, &isExist);
|
||||
int32_t status = SOFTBUS_ERR;
|
||||
int32_t status = SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
do {
|
||||
if (!isExist) {
|
||||
status = SOFTBUS_OK;
|
||||
@ -2182,7 +2182,7 @@ static void ConflictCancelOccupy(const char *udid)
|
||||
static int32_t ConflictGetConnection(const char *udid)
|
||||
{
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(
|
||||
udid != NULL, SOFTBUS_ERR, CONN_BLE, "conflict get connection failed: invalid param, udid is null");
|
||||
udid != NULL, SOFTBUS_INVALID_PARAM, CONN_BLE, "conflict get connection failed: invalid param, udid is null");
|
||||
|
||||
char anomizeUdid[UDID_BUF_LEN] = { 0 };
|
||||
ConvertAnonymizeSensitiveString(anomizeUdid, UDID_BUF_LEN, udid);
|
||||
@ -2191,7 +2191,7 @@ static int32_t ConflictGetConnection(const char *udid)
|
||||
ConnBleConnection *connection = ConnBleGetClientConnectionByUdid(udid, BLE_GATT);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(connection != NULL, SOFTBUS_CONN_BLE_CONNECTION_NOT_EXIST_ERR, CONN_BLE,
|
||||
"conflict get connection failed: connection not exist, udid=%{public}s", anomizeUdid);
|
||||
int32_t result = SOFTBUS_ERR;
|
||||
int32_t result = SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
do {
|
||||
if (SoftBusMutexLock(&connection->lock) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_BLE, "try to lock failed, connId=%{public}u, udid=%{public}s", connection->connectionId,
|
||||
@ -2213,7 +2213,7 @@ static int32_t BleInitLooper(void)
|
||||
g_bleManagerSyncHandler.handler.looper = GetLooper(LOOP_TYPE_CONN);
|
||||
if (g_bleManagerSyncHandler.handler.looper == NULL) {
|
||||
CONN_LOGE(CONN_INIT, "init conn ble looper failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -2223,7 +2223,8 @@ static int32_t InitBleManager(const ConnectCallback *callback)
|
||||
SoftBusList *connections = CreateSoftBusList();
|
||||
SoftBusList *prevents = CreateSoftBusList();
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(
|
||||
connections != NULL && prevents != NULL, SOFTBUS_ERR, CONN_INIT, "init ble manager failed: create list failed");
|
||||
connections != NULL && prevents != NULL, SOFTBUS_CREATE_LIST_ERR,
|
||||
CONN_INIT, "init ble manager failed: create list failed");
|
||||
g_bleManager.connections = connections;
|
||||
g_bleManager.prevents = prevents;
|
||||
ListInit(&g_bleManager.waitings);
|
||||
@ -2235,7 +2236,7 @@ static int32_t InitBleManager(const ConnectCallback *callback)
|
||||
.OnBtStateChanged = OnBtStateChanged,
|
||||
};
|
||||
int32_t listenerId = SoftBusAddBtStateListener(&btStateListener);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(listenerId >= 0, SOFTBUS_ERR, CONN_INIT,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(listenerId >= 0, SOFTBUS_INVALID_NUM, CONN_INIT,
|
||||
"int ble manager failed: add bluetooth state change listener failed, invalid listener id=%{public}d",
|
||||
listenerId);
|
||||
static SoftBusBleConflictListener bleConflictListener = {
|
||||
@ -2285,13 +2286,11 @@ ConnectFuncInterface *ConnInitBle(const ConnectCallback *callback)
|
||||
.onPostBytesFinished = onPostBytesFinished,
|
||||
};
|
||||
status = ConnBleInitTransModule(&transEventListener);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(
|
||||
status == SOFTBUS_OK, NULL, CONN_INIT, "conn init ble failed: init ble trans mudule failed, err=%{public}d",
|
||||
status);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(status == SOFTBUS_OK, NULL, CONN_INIT,
|
||||
"conn init ble failed: init ble trans mudule failed, err=%{public}d", status);
|
||||
status = InitBleManager(callback);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(
|
||||
status == SOFTBUS_OK, NULL, CONN_INIT, "conn init ble failed: init ble manager failed, err=%{public}d",
|
||||
status);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(status == SOFTBUS_OK, NULL, CONN_INIT,
|
||||
"conn init ble failed: init ble manager failed, err=%{public}d", status);
|
||||
|
||||
static ConnectFuncInterface bleFuncInterface = {
|
||||
.ConnectDevice = BleConnectDevice,
|
||||
|
@ -88,7 +88,7 @@ int32_t ConnBleEnqueueNonBlock(const void *msg)
|
||||
return SOFTBUS_LOCK_ERR;
|
||||
}
|
||||
bool isListEmpty = true;
|
||||
int32_t ret = SOFTBUS_ERR;
|
||||
int32_t ret = SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
if (queueNode->pid == 0) {
|
||||
ret = WaitQueueLength(g_innerQueue->queue[priority], GetQueueLimit(priority), WAIT_QUEUE_BUFFER_PERIOD_LEN,
|
||||
&g_sendWaitCond, &g_bleQueueLock);
|
||||
@ -133,7 +133,7 @@ END:
|
||||
int32_t ConnBleDequeueBlock(void **msg)
|
||||
{
|
||||
bool isFull = false;
|
||||
int32_t status = SOFTBUS_ERR;
|
||||
int32_t status = SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
ConnectionQueue *item = NULL;
|
||||
ConnectionQueue *next = NULL;
|
||||
SoftBusSysTime waitTime = {0};
|
||||
@ -191,17 +191,17 @@ int32_t ConnBleInitSendQueue(void)
|
||||
{
|
||||
if (SoftBusMutexInit(&g_bleQueueLock, NULL) != 0) {
|
||||
CONN_LOGE(CONN_INIT, "Mutex Init failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
if (SoftBusCondInit(&g_sendWaitCond) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_INIT, "cond Init failed");
|
||||
(void)SoftBusMutexDestroy(&g_bleQueueLock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
if (SoftBusCondInit(&g_sendCond) != SOFTBUS_OK) {
|
||||
(void)SoftBusMutexDestroy(&g_bleQueueLock);
|
||||
(void)SoftBusCondDestroy(&g_sendWaitCond);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
g_innerQueue = CreateBleQueue(0);
|
||||
if (g_innerQueue == NULL) {
|
||||
@ -209,7 +209,7 @@ int32_t ConnBleInitSendQueue(void)
|
||||
(void)SoftBusMutexDestroy(&g_bleQueueLock);
|
||||
(void)SoftBusCondDestroy(&g_sendWaitCond);
|
||||
(void)SoftBusCondDestroy(&g_sendCond);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ int32_t ConnGattServerConnect(ConnBleConnection *connection)
|
||||
if (underlayerHandle == INVALID_UNDERLAY_HANDLE) {
|
||||
CONN_LOGE(CONN_BLE, "ble server connect failed, underlay handle is invalid. connId=%{public}u",
|
||||
connection->connectionId);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
SoftBusBtAddr binaryAddr = { 0 };
|
||||
status = ConvertBtMacToBinary(connection->addr, BT_MAC_LEN, binaryAddr.addr, BT_ADDR_LEN);
|
||||
|
@ -40,7 +40,7 @@ static StartBleSendLPInfo g_startBleSendLPInfo = { 0 };
|
||||
static int32_t UnpackTransHeader(uint8_t *data, uint32_t dataLen, BleTransHeader *header)
|
||||
{
|
||||
if (dataLen < BLE_TRANS_HEADER_SIZE) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
BleTransHeader *tmp = (BleTransHeader *)data;
|
||||
header->seq = ntohl(tmp->seq);
|
||||
@ -52,7 +52,7 @@ static int32_t UnpackTransHeader(uint8_t *data, uint32_t dataLen, BleTransHeader
|
||||
CONN_LOGW(CONN_BLE,
|
||||
"unpack ble trans header failed, dataLen=%{public}u, total=%{public}u, currentPacketSize=%{public}u",
|
||||
dataLen, header->total, header->size);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BLE_INTERNAL_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -659,8 +659,8 @@ int32_t ConnBleInitTransModule(ConnBleTransEventListener *listener)
|
||||
"init ble trans failed: invalid param, listener onPostByteFinshed is null");
|
||||
|
||||
struct ConnSlideWindowController *controller = ConnSlideWindowControllerNew();
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(
|
||||
controller, SOFTBUS_ERR, CONN_INIT, "init br trans module failed: init flow controller failed");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(controller, SOFTBUS_CONN_BLE_INTERNAL_ERR, CONN_INIT,
|
||||
"init br trans module failed: init flow controller failed");
|
||||
|
||||
int32_t status = ConnBleInitSendQueue();
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(
|
||||
|
@ -696,7 +696,7 @@ static void *ListenTask(void *arg)
|
||||
(void)SoftBusMutexUnlock(&serverState->mutex);
|
||||
while (true) {
|
||||
int32_t socketHandle = g_sppDriver->Accept(serverId);
|
||||
if (socketHandle == SOFTBUS_ERR) {
|
||||
if (socketHandle == SOFTBUS_CONN_BR_SPP_SERVER_ERR) {
|
||||
CONN_LOGE(CONN_BR, "accept failed, traceId=%{public}u, serverId=%{public}d", serverState->traceId,
|
||||
serverId);
|
||||
break;
|
||||
@ -888,19 +888,19 @@ static int32_t InitProperty()
|
||||
if (SoftbusGetConfig(SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH, (unsigned char *)&capacity, sizeof(capacity)) !=
|
||||
SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_INIT, "get br buffer capacity config fail");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
if (capacity <= 0 || capacity > MAX_BR_READ_BUFFER_CAPACITY) {
|
||||
CONN_LOGE(CONN_INIT, "br buffer capacity is invalid, capacity=%{public}d", capacity);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
if (SoftbusGetConfig(SOFTBUS_INT_CONN_RFCOM_SEND_MAX_LEN, (unsigned char *)&mtu, sizeof(mtu)) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_INIT, "get br mtu config fail");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
if (mtu <= 0 || mtu > MAX_BR_MTU_SIZE) {
|
||||
CONN_LOGE(CONN_INIT, "br mtu is invalid, mtu=%{public}d", mtu);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
CONN_LOGD(CONN_INIT, "init br config success, read buffer capacity=%{public}d, mtu=%{public}d", capacity, mtu);
|
||||
g_readBufferCapacity = capacity;
|
||||
|
@ -1642,7 +1642,7 @@ static int32_t BrInitLooper(void)
|
||||
{
|
||||
g_brManagerAsyncHandler.handler.looper = GetLooper(LOOP_TYPE_CONN);
|
||||
if (g_brManagerAsyncHandler.handler.looper == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_LOOPER_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -1703,7 +1703,8 @@ static int32_t InitBrManager()
|
||||
SoftBusList *connections = CreateSoftBusList();
|
||||
SoftBusList *pendings = CreateSoftBusList();
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(
|
||||
connections != NULL && pendings != NULL, SOFTBUS_ERR, CONN_INIT, "InitBrManager: create list failed");
|
||||
connections != NULL && pendings != NULL, SOFTBUS_CREATE_LIST_ERR,
|
||||
CONN_INIT, "InitBrManager: create list failed");
|
||||
g_brManager.connections = connections;
|
||||
g_brManager.pendings = pendings;
|
||||
ListInit(&g_brManager.waitings);
|
||||
@ -1715,7 +1716,7 @@ static int32_t InitBrManager()
|
||||
.OnBtStateChanged = OnBtStateChanged,
|
||||
};
|
||||
int32_t listenerId = SoftBusAddBtStateListener(&listener);
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(listenerId >= 0, SOFTBUS_ERR, CONN_INIT,
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(listenerId >= 0, SOFTBUS_CONN_BR_INTERNAL_ERR, CONN_INIT,
|
||||
"InitBrManager: add bt state change listener failed, invalid listenerId=%{public}d", listenerId);
|
||||
TransitionToState(BR_STATE_AVAILABLE);
|
||||
return SOFTBUS_OK;
|
||||
|
@ -81,7 +81,7 @@ int32_t ConnBrCreateBrPendingPacket(uint32_t id, int64_t seq)
|
||||
if (SoftBusCondInit(&pending->cond) != SOFTBUS_OK) {
|
||||
SoftBusMutexDestroy(&pending->lock);
|
||||
SoftBusFree(pending);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
ListTailInsert(&g_pendingList, &(pending->node));
|
||||
(void)SoftBusMutexUnlock(&g_pendingLock);
|
||||
@ -111,7 +111,8 @@ int32_t ConnBrGetBrPendingPacket(uint32_t id, int64_t seq, uint32_t waitMillis,
|
||||
{
|
||||
#define USECTONSEC 1000LL
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(data != NULL, SOFTBUS_INVALID_PARAM, CONN_BR, "invalid param");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(SoftBusMutexLock(&g_pendingLock) == SOFTBUS_OK, SOFTBUS_LOCK_ERR, CONN_BR, "lock failed");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(SoftBusMutexLock(&g_pendingLock) == SOFTBUS_OK, SOFTBUS_LOCK_ERR,
|
||||
CONN_BR, "lock failed");
|
||||
PendingPacket *pending = NULL;
|
||||
PendingPacket *item = NULL;
|
||||
LIST_FOR_EACH_ENTRY(item, &g_pendingList, PendingPacket, node) {
|
||||
@ -177,7 +178,7 @@ int32_t ConnBrSetBrPendingPacket(uint32_t id, int64_t seq, void *data)
|
||||
}
|
||||
}
|
||||
SoftBusMutexUnlock(&g_pendingLock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BR_SET_PENDING_PACKET_ERR;
|
||||
}
|
||||
|
||||
int32_t ConnBrOnAckRequest(ConnBrConnection *connection, const cJSON *json)
|
||||
|
@ -102,7 +102,7 @@ int32_t ConnBrEnqueueNonBlock(const void *msg)
|
||||
if (SoftBusMutexLock(&g_brQueueLock) != SOFTBUS_OK) {
|
||||
return SOFTBUS_LOCK_ERR;
|
||||
}
|
||||
int32_t ret = SOFTBUS_ERR;
|
||||
int32_t ret = SOFTBUS_CONN_BR_INTERNAL_ERR;
|
||||
bool isListEmpty = true;
|
||||
if (queueNode->pid == 0 && queueNode->isInner) {
|
||||
ret = WaitQueueLength(g_innerQueue->queue[priority], GetQueueLimit(priority), WAIT_QUEUE_BUFFER_PERIOD_LEN,
|
||||
@ -153,7 +153,7 @@ END:
|
||||
int32_t ConnBrDequeueBlock(void **msg)
|
||||
{
|
||||
bool isFull = false;
|
||||
int32_t status = SOFTBUS_ERR;
|
||||
int32_t status = SOFTBUS_CONN_BR_INTERNAL_ERR;
|
||||
ConnectionQueue *item = NULL;
|
||||
ConnectionQueue *next = NULL;
|
||||
SoftBusSysTime waitTime = {0};
|
||||
@ -214,12 +214,12 @@ int32_t ConnBrInnerQueueInit(void)
|
||||
}
|
||||
if (SoftBusCondInit(&g_sendWaitCond) != SOFTBUS_OK) {
|
||||
(void)SoftBusMutexDestroy(&g_brQueueLock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
if (SoftBusCondInit(&g_sendCond) != SOFTBUS_OK) {
|
||||
(void)SoftBusMutexDestroy(&g_brQueueLock);
|
||||
(void)SoftBusCondDestroy(&g_sendWaitCond);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
g_innerQueue = CreateBrQueue(0);
|
||||
if (g_innerQueue == NULL) {
|
||||
@ -227,7 +227,7 @@ int32_t ConnBrInnerQueueInit(void)
|
||||
(void)SoftBusMutexDestroy(&g_brQueueLock);
|
||||
(void)SoftBusCondDestroy(&g_sendWaitCond);
|
||||
(void)SoftBusCondDestroy(&g_sendCond);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_BR_CREATE_QUEUE_FAIL;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -551,8 +551,8 @@ int32_t ConnBrTransMuduleInit(SppSocketDriver *sppDriver, ConnBrTransEventListen
|
||||
"init br trans module failed: init br send queue failed, error=%{public}d", status);
|
||||
|
||||
struct ConnSlideWindowController *controller = ConnSlideWindowControllerNew();
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(
|
||||
controller, SOFTBUS_ERR, CONN_INIT, "init br trans module failed: init flow controller failed");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGW(controller, SOFTBUS_CONN_BR_INTERNAL_ERR, CONN_INIT,
|
||||
"init br trans module failed: init flow controller failed");
|
||||
|
||||
g_sppDriver = sppDriver;
|
||||
g_transEventListener = *listener;
|
||||
|
@ -328,7 +328,7 @@ int32_t StartBaseClient(ListenerModule module, const SoftbusBaseListener *listen
|
||||
if (node->info.status != LISTENER_IDLE) {
|
||||
CONN_LOGE(CONN_COMMON, "listener is not idle status, module=%{public}d, status=%{public}d",
|
||||
module, node->info.status);
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_CONN_LISTENER_NOT_IDLE;
|
||||
break;
|
||||
}
|
||||
node->listener.onConnectEvent = listener->onConnectEvent;
|
||||
@ -458,7 +458,7 @@ int32_t StartBaseListener(const LocalListenerInfo *info, const SoftbusBaseListen
|
||||
if (node->info.status != LISTENER_IDLE) {
|
||||
CONN_LOGE(CONN_COMMON, "listener is not idle status, module=%{public}d, status=%{public}d",
|
||||
module, node->info.status);
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_CONN_LISTENER_NOT_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -473,7 +473,7 @@ int32_t StartBaseListener(const LocalListenerInfo *info, const SoftbusBaseListen
|
||||
if (listenPort <= 0) {
|
||||
CONN_LOGE(CONN_COMMON, "start server failed, module=%{public}d, listenPort=%{public}d",
|
||||
module, listenPort);
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_CONN_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ int32_t AddTrigger(ListenerModule module, int32_t fd, TriggerType trigger)
|
||||
if (node->info.status != LISTENER_RUNNING) {
|
||||
CONN_LOGE(CONN_COMMON, "module is not running, module=%{public}d, fd=%{public}d, trigger=%{public}d",
|
||||
module, fd, trigger);
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_CONN_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -618,7 +618,7 @@ int32_t AddTrigger(ListenerModule module, int32_t fd, TriggerType trigger)
|
||||
"can not trigger more, fd exceed more than MAX_LISTEN_EVENTS, MAX_LISTEN_EVENTS=%{public}d, "
|
||||
"module=%{public}d, fd=%{public}d, trigger=%{public}d, waitEventFdsLen=%{public}d",
|
||||
MAX_LISTEN_EVENTS, module, fd, trigger, node->info.waitEventFdsLen);
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_CONN_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1186,7 +1186,7 @@ static int32_t StartSelectThread(void)
|
||||
|
||||
SelectThreadState *state = SoftBusCalloc(sizeof(SelectThreadState));
|
||||
if (state == NULL) {
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_MALLOC_ERR;
|
||||
break;
|
||||
}
|
||||
state->traceId = ++selectThreadTraceIdGenerator;
|
||||
@ -1198,7 +1198,7 @@ static int32_t StartSelectThread(void)
|
||||
if (rc != 0) {
|
||||
CONN_LOGE(CONN_COMMON, "create ctrl pipe failed, error=%{public}s", strerror(errno));
|
||||
SoftBusFree(state);
|
||||
status = SOFTBUS_ERR;
|
||||
status = SOFTBUS_INVALID_NUM;
|
||||
break;
|
||||
}
|
||||
state->ctrlRfd = fds[0];
|
||||
|
@ -214,7 +214,7 @@ static int32_t ConnectSoftBusCondWait(SoftBusCond *cond, SoftBusMutex *mutex, ui
|
||||
SoftBusSysTime now;
|
||||
if (SoftBusGetTime(&now) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_COMMON, "BrSoftBusCondWait SoftBusGetTime failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_GET_TIME_FAIL;
|
||||
}
|
||||
now.sec += (now.usec + ((int32_t)timeMillis * USECTONSEC)) / MICROSECONDS;
|
||||
now.usec = (now.usec + ((int32_t)timeMillis * USECTONSEC)) % MICROSECONDS;
|
||||
@ -239,7 +239,7 @@ int32_t WaitQueueLength(
|
||||
int32_t status = ConnectSoftBusCondWait(cond, mutex, WAIT_QUEUE_DELAY);
|
||||
if (status != SOFTBUS_OK && status != SOFTBUS_TIMOUT) {
|
||||
CONN_LOGE(CONN_COMMON, "wait queue length cond wait fail");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_COND_WAIT_FAIL;
|
||||
}
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
@ -263,7 +263,7 @@ int32_t GetMsg(ConnectionQueue *queue, void **msg, bool *isFull, QueuePriority l
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_GET_MSG_FAIL;
|
||||
}
|
||||
|
||||
uint32_t GetQueueLimit(int32_t index)
|
||||
|
@ -38,7 +38,7 @@ int32_t RegistSocketProtocol(const SocketInterface *interface)
|
||||
if (interface == NULL || interface->GetSockPort == NULL || interface->OpenClientSocket == NULL ||
|
||||
interface->OpenServerSocket == NULL || interface->AcceptClient == NULL) {
|
||||
CONN_LOGW(CONN_COMMON, "Bad socket interface!");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
int ret = SoftBusMutexLock(&g_socketsMutex);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
@ -46,7 +46,7 @@ int32_t RegistSocketProtocol(const SocketInterface *interface)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = SOFTBUS_ERR;
|
||||
ret = SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
for (uint8_t i = 0; i < MAX_SOCKET_TYPE; i++) {
|
||||
if (g_socketInterfaces[i] == NULL) {
|
||||
g_socketInterfaces[i] = interface;
|
||||
@ -122,12 +122,12 @@ void ConnDeinitSockets(void)
|
||||
int32_t ConnOpenClientSocket(const ConnectOption *option, const char *bindAddr, bool isNonBlock)
|
||||
{
|
||||
if (option == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
const SocketInterface *socketInterface = GetSocketInterface(option->socketOption.protocol);
|
||||
if (socketInterface == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "protocol not supported! protocol=%{public}d", option->socketOption.protocol);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_GET_INTERFACE_ERR;
|
||||
}
|
||||
return socketInterface->OpenClientSocket(option, bindAddr, isNonBlock);
|
||||
}
|
||||
@ -183,7 +183,7 @@ int32_t ConnToggleNonBlockMode(int32_t fd, bool isNonBlock)
|
||||
int32_t flags = fcntl(fd, F_GETFL, 0);
|
||||
if (flags < 0) {
|
||||
CONN_LOGE(CONN_COMMON, "fcntl get flag failed, fd=%{public}d, errno=%{public}d", fd, errno);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_FCNTL_ERR;
|
||||
}
|
||||
if (isNonBlock && ((uint32_t)flags & O_NONBLOCK) == 0) {
|
||||
flags = (int32_t)((uint32_t)flags | O_NONBLOCK);
|
||||
@ -306,7 +306,7 @@ int32_t ConnGetLocalSocketPort(int32_t fd)
|
||||
const SocketInterface *socketInterface = GetSocketInterface(LNN_PROTOCOL_IP);
|
||||
if (socketInterface == NULL) {
|
||||
CONN_LOGW(CONN_COMMON, "LNN_PROTOCOL_IP not supported!");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_GET_INTERFACE_ERR;
|
||||
}
|
||||
return socketInterface->GetSockPort(fd);
|
||||
}
|
||||
|
@ -56,18 +56,18 @@ static int32_t AddConnTimeNode(const ConnectionInfo *info, ConnTimeNode *timeNod
|
||||
{
|
||||
if (g_connTimeList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "g_connTimeList is null");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
SoftBusSysTime now = { 0 };
|
||||
SoftBusGetTime(&now);
|
||||
timeNode->startTime = (uint32_t)now.sec * SEC_TIME + (uint32_t)now.usec / SEC_TIME;
|
||||
if (memcpy_s(&(timeNode->info), sizeof(ConnectionInfo), info, sizeof(ConnectionInfo)) != EOK) {
|
||||
CONN_LOGE(CONN_COMMON, "AddConnTimeNode:memcpy timenode failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
if (SoftBusMutexLock(&g_connTimeList->lock) != 0) {
|
||||
CONN_LOGE(CONN_COMMON, "AddConnTimeNode:lock mutex failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_LOCK_ERR;
|
||||
}
|
||||
ListAdd(&(g_connTimeList->list), &(timeNode->node));
|
||||
(void)SoftBusMutexUnlock(&g_connTimeList->lock);
|
||||
@ -77,26 +77,26 @@ static int32_t AddConnTimeNode(const ConnectionInfo *info, ConnTimeNode *timeNod
|
||||
static int32_t CompareConnectInfo(const ConnectionInfo *src, const ConnectionInfo *dst)
|
||||
{
|
||||
if (src->type != dst->type) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
switch (src->type) {
|
||||
case CONNECT_BLE:
|
||||
if (strcasecmp(src->bleInfo.bleMac, dst->bleInfo.bleMac) != 0) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_STRCMP_ERR;
|
||||
}
|
||||
break;
|
||||
case CONNECT_BR:
|
||||
if (strcasecmp(src->brInfo.brMac, dst->brInfo.brMac) != 0) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_STRCMP_ERR;
|
||||
}
|
||||
break;
|
||||
case CONNECT_TCP:
|
||||
if (strcasecmp(src->socketInfo.addr, dst->socketInfo.addr) != 0) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_STRCMP_ERR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_INTERNAL_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -164,7 +164,7 @@ static int32_t ModuleCheck(ConnModule moduleId)
|
||||
}
|
||||
}
|
||||
CONN_LOGW(CONN_COMMON, "check module fail. moduleId=%{public}d", moduleId);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
static int32_t ConnTypeCheck(ConnectType type)
|
||||
@ -223,24 +223,24 @@ static int32_t GetListenerByModuleId(ConnModule moduleId, ConnListenerNode *node
|
||||
|
||||
if (g_listenerList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "listener list is null");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
int ret = SOFTBUS_OK;
|
||||
if (SoftBusMutexLock(&g_listenerList->lock) != 0) {
|
||||
CONN_LOGE(CONN_COMMON, "lock mutex failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_LOCK_ERR;
|
||||
}
|
||||
LIST_FOR_EACH_ENTRY(listenerNode, &g_listenerList->list, ConnListenerNode, node) {
|
||||
if (listenerNode->moduleId == moduleId) {
|
||||
if (memcpy_s(node, sizeof(ConnListenerNode), listenerNode, sizeof(ConnListenerNode)) != EOK) {
|
||||
ret = SOFTBUS_ERR;
|
||||
ret = SOFTBUS_MEM_ERR;
|
||||
}
|
||||
(void)SoftBusMutexUnlock(&g_listenerList->lock);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
(void)SoftBusMutexUnlock(&g_listenerList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
static int32_t AddListener(ConnModule moduleId, const ConnectCallback *callback)
|
||||
@ -250,23 +250,23 @@ static int32_t AddListener(ConnModule moduleId, const ConnectCallback *callback)
|
||||
|
||||
if (g_listenerList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "listener list is null");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (SoftBusMutexLock(&g_listenerList->lock) != 0) {
|
||||
CONN_LOGE(CONN_COMMON, "lock mutex failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_LOCK_ERR;
|
||||
}
|
||||
LIST_FOR_EACH_ENTRY(listNode, &g_listenerList->list, ConnListenerNode, node) {
|
||||
if (listNode->moduleId == moduleId) {
|
||||
(void)SoftBusMutexUnlock(&g_listenerList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_INTERNAL_ERR;
|
||||
}
|
||||
}
|
||||
item = (ConnListenerNode *)SoftBusCalloc(sizeof(ConnListenerNode));
|
||||
if (item == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "malloc failed");
|
||||
(void)SoftBusMutexUnlock(&g_listenerList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MALLOC_ERR;
|
||||
}
|
||||
item->moduleId = moduleId;
|
||||
item->callback = *callback;
|
||||
@ -405,7 +405,7 @@ static int32_t InitTimeNodeList()
|
||||
g_connTimeList = CreateSoftBusList();
|
||||
if (g_connTimeList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "create list failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CREATE_LIST_ERR;
|
||||
}
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
@ -666,7 +666,7 @@ ConnectCallback g_connManagerCb = { 0 };
|
||||
static int32_t ConnSocketsAndBaseListenerInit(void)
|
||||
{
|
||||
if (g_isInited) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
int32_t ret = ConnInitSockets();
|
||||
@ -718,12 +718,12 @@ int32_t ConnServerInit(void)
|
||||
g_listenerList = CreateSoftBusList();
|
||||
if (g_listenerList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "create list failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CREATE_LIST_ERR;
|
||||
}
|
||||
}
|
||||
InitTimeNodeList();
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexInit(&g_ReqLock, NULL) == SOFTBUS_OK, SOFTBUS_ERR, CONN_COMMON,
|
||||
"g_ReqLock init lock failed.");
|
||||
CONN_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexInit(&g_ReqLock, NULL) == SOFTBUS_OK,
|
||||
SOFTBUS_CONN_INTERNAL_ERR, CONN_COMMON, "g_ReqLock init lock failed.");
|
||||
|
||||
g_isInited = true;
|
||||
CONN_LOGI(CONN_COMMON, "connect manager init success.");
|
||||
|
@ -134,14 +134,14 @@ int32_t AddTcpConnInfo(TcpConnInfoNode *item)
|
||||
if ((int32_t)g_tcpConnInfoList->cnt >= g_tcpMaxConnNum) {
|
||||
CONN_LOGE(CONN_COMMON, "Tcp out of max conn num.");
|
||||
(void)SoftBusMutexUnlock(&g_tcpConnInfoList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
LIST_FOR_EACH_ENTRY(temp, &g_tcpConnInfoList->list, TcpConnInfoNode, node) {
|
||||
if (temp->connectionId == item->connectionId) {
|
||||
CONN_LOGE(CONN_COMMON,
|
||||
"ConnectionId ready in ConnectionInfoList. ConnectionId=%{public}08x", item->connectionId);
|
||||
(void)SoftBusMutexUnlock(&g_tcpConnInfoList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
}
|
||||
ListInit(&item->node);
|
||||
@ -240,7 +240,7 @@ static int32_t TcpOnConnectEvent(ListenerModule module, int32_t cfd, const Conne
|
||||
cfd, AUTH_P2P_KEEP_ALIVE_TIME, AUTH_P2P_KEEP_ALIVE_INTERVAL, AUTH_P2P_KEEP_ALIVE_COUNT) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_COMMON, "set keepalive fail");
|
||||
ConnShutdownSocket(cfd);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ EXIT:
|
||||
SoftBusFree(tcpConnInfoNode);
|
||||
(void)DelTrigger(module, cfd, READ_TRIGGER);
|
||||
ConnShutdownSocket(cfd);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
static char *RecvData(const ConnPktHead *head, int32_t fd, uint32_t len)
|
||||
@ -314,11 +314,11 @@ EXIT:
|
||||
static int32_t GetTcpInfoByFd(int32_t fd, TcpConnInfoNode *tcpInfo)
|
||||
{
|
||||
if (g_tcpConnInfoList == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
if (SoftBusMutexLock(&g_tcpConnInfoList->lock) != 0) {
|
||||
CONN_LOGE(CONN_COMMON, "lock failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_LOCK_ERR;
|
||||
}
|
||||
TcpConnInfoNode *item = NULL;
|
||||
TcpConnInfoNode *next = NULL;
|
||||
@ -327,14 +327,14 @@ static int32_t GetTcpInfoByFd(int32_t fd, TcpConnInfoNode *tcpInfo)
|
||||
if (memcpy_s(tcpInfo, sizeof(TcpConnInfoNode), item, sizeof(TcpConnInfoNode)) != EOK) {
|
||||
CONN_LOGE(CONN_COMMON, "GetTcpInfoByFd:memcpy_s failed");
|
||||
(void)SoftBusMutexUnlock(&g_tcpConnInfoList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
(void)SoftBusMutexUnlock(&g_tcpConnInfoList->lock);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
}
|
||||
(void)SoftBusMutexUnlock(&g_tcpConnInfoList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
static int32_t TcpOnDataEventOut(ListenerModule module, int32_t fd)
|
||||
@ -348,7 +348,7 @@ static int32_t TcpOnDataEventOut(ListenerModule module, int32_t fd)
|
||||
(void)DelTrigger((ListenerModule)(tcpInfo.info.socketInfo.moduleId), fd, WRITE_TRIGGER);
|
||||
ConnShutdownSocket(fd);
|
||||
CONN_LOGI(CONN_COMMON, "TcpOnDataEventSocketOut fail. fd=%{public}d", fd);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
int32_t ret = ConnGetSocketError(fd);
|
||||
if (ret != 0) {
|
||||
@ -384,12 +384,12 @@ static int32_t TcpOnDataEventIn(ListenerModule module, int32_t fd)
|
||||
return SOFTBUS_OK;
|
||||
} else if (bytes != (ssize_t)headSize) {
|
||||
CONN_LOGE(CONN_COMMON, "Recv Head failed.");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
char *data = RecvData(&head, fd, head.len);
|
||||
if (data == NULL) {
|
||||
DelTcpConnInfo(connectionId, module, fd);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
g_tcpConnCallback->OnDataReceived(connectionId, (ConnModule)(head.module),
|
||||
head.seq, data, (int32_t)(headSize + head.len));
|
||||
@ -411,7 +411,7 @@ int32_t TcpOnDataEvent(ListenerModule module, int32_t events, int32_t fd)
|
||||
CONN_LOGI(CONN_COMMON, "recv tcp invalid events=%{public}d, fd=%{public}d", events, fd);
|
||||
uint32_t connectionId = CalTcpConnectionId(fd);
|
||||
DelTcpConnInfo(connectionId, module, fd);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
static void DelAllConnInfo(ListenerModule moduleId)
|
||||
{
|
||||
@ -455,12 +455,12 @@ int32_t TcpConnectDeviceCheckArg(const ConnectOption *option, uint32_t requestId
|
||||
(result->OnConnectFailed == NULL) ||
|
||||
(result->OnConnectSuccessed == NULL)) {
|
||||
CONN_LOGW(CONN_COMMON, "result or result member is null");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if ((option == NULL) || (option->type != CONNECT_TCP)) {
|
||||
CONN_LOGW(CONN_COMMON, "option is null or type is mismatched");
|
||||
result->OnConnectFailed(requestId, SOFTBUS_INVALID_PARAM);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -479,7 +479,7 @@ static int32_t WrapperAddTcpConnInfo(const ConnectOption *option, const ConnectR
|
||||
memcpy_s(&tcpConnInfoNode->result, sizeof(ConnectResult), result, sizeof(ConnectResult)) != EOK) {
|
||||
CONN_LOGE(CONN_COMMON, "copy TcpConnInfoNode failed");
|
||||
SoftBusFree(tcpConnInfoNode);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
|
||||
tcpConnInfoNode->requestId = requestId;
|
||||
@ -495,7 +495,7 @@ static int32_t WrapperAddTcpConnInfo(const ConnectOption *option, const ConnectR
|
||||
if (AddTcpConnInfo(tcpConnInfoNode) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_COMMON, "AddTcpConnInfo failed");
|
||||
SoftBusFree(tcpConnInfoNode);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
return SOFTBUS_OK;
|
||||
@ -520,7 +520,7 @@ static int32_t TcpOpenClientSocketErr(const ConnectOption *option, uint32_t requ
|
||||
|
||||
int32_t TcpConnectDevice(const ConnectOption *option, uint32_t requestId, const ConnectResult *result)
|
||||
{
|
||||
if (TcpConnectDeviceCheckArg(option, requestId, result) == SOFTBUS_ERR) {
|
||||
if (TcpConnectDeviceCheckArg(option, requestId, result) != SOFTBUS_OK) {
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
ConnectStatistics *statistics = (ConnectStatistics *)SoftBusCalloc(sizeof(ConnectStatistics));
|
||||
@ -545,10 +545,10 @@ int32_t TcpConnectDevice(const ConnectOption *option, uint32_t requestId, const
|
||||
fd, AUTH_P2P_KEEP_ALIVE_TIME, AUTH_P2P_KEEP_ALIVE_INTERVAL, AUTH_P2P_KEEP_ALIVE_COUNT) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_COMMON, "set keepalive fail, fd=%{public}d", fd);
|
||||
ConnShutdownSocket(fd);
|
||||
result->OnConnectFailed(requestId, SOFTBUS_ERR);
|
||||
result->OnConnectFailed(requestId, SOFTBUS_CONN_SOCKET_INTERNAL_ERR);
|
||||
DfxRecordTcpConnectFail(DEFAULT_PID, (ConnectOption *)option, NULL, statistics, error);
|
||||
SoftBusFree(statistics);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
CONN_LOGI(CONN_COMMON, "set keepalive successfully, fd=%{public}d", fd);
|
||||
}
|
||||
@ -568,7 +568,7 @@ ERR_FAIL:
|
||||
result->OnConnectFailed(requestId, SOFTBUS_ERR);
|
||||
DfxRecordTcpConnectFail(DEFAULT_PID, (ConnectOption *)option, NULL, statistics, error);
|
||||
SoftBusFree(statistics);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
int32_t TcpDisconnectDevice(uint32_t connectionId)
|
||||
@ -576,7 +576,7 @@ int32_t TcpDisconnectDevice(uint32_t connectionId)
|
||||
ConnectionInfo info;
|
||||
if (TcpGetConnectionInfo(connectionId, &info) != SOFTBUS_OK) {
|
||||
CONN_LOGE(CONN_COMMON, "tcp get connection info failed");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
DelTcpConnInfo(connectionId, UNUSE_BUTT, -1);
|
||||
return SOFTBUS_OK;
|
||||
@ -586,7 +586,7 @@ int32_t TcpDisconnectDeviceNow(const ConnectOption *option)
|
||||
{
|
||||
if (g_tcpConnInfoList == NULL || option == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "tcp connection info list is null or option is null");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (SoftBusMutexLock(&g_tcpConnInfoList->lock) != 0) {
|
||||
CONN_LOGE(CONN_COMMON, "lock failed");
|
||||
@ -627,7 +627,7 @@ int32_t TcpPostBytes(
|
||||
if (g_tcpConnInfoList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "tcp connection list is null");
|
||||
SoftBusFree((void*)data);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
int32_t fd = -1;
|
||||
if (SoftBusMutexLock(&g_tcpConnInfoList->lock) != 0) {
|
||||
@ -645,7 +645,7 @@ int32_t TcpPostBytes(
|
||||
if (fd == -1) {
|
||||
SoftBusFree((void*)data);
|
||||
CONN_LOGE(CONN_COMMON, "TcpPostBytes failed, connectionId not found. connectionId=%{public}08x", connectionId);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_CONN_SOCKET_INTERNAL_ERR;
|
||||
}
|
||||
ssize_t bytes = ConnSendSocketData(fd, (const char *)data, len, flag);
|
||||
SoftBusFree(data);
|
||||
@ -660,7 +660,7 @@ int32_t TcpGetConnectionInfo(uint32_t connectionId, ConnectionInfo *info)
|
||||
{
|
||||
if (g_tcpConnInfoList == NULL) {
|
||||
CONN_LOGE(CONN_COMMON, "tcp connection list is null");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_TCPCONNECTION_SOCKET_ERR;
|
||||
}
|
||||
if (info == NULL) {
|
||||
CONN_LOGW(CONN_COMMON, "info is NULL.");
|
||||
@ -685,7 +685,7 @@ int32_t TcpGetConnectionInfo(uint32_t connectionId, ConnectionInfo *info)
|
||||
info->isAvailable = false;
|
||||
(void)SoftBusMutexUnlock(&g_tcpConnInfoList->lock);
|
||||
CONN_LOGE(CONN_COMMON, "ConnectionId is not exists. connectionId=%{public}08x", connectionId);
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_TCPCONNECTION_SOCKET_ERR;
|
||||
}
|
||||
|
||||
int32_t TcpStartListening(const LocalListenerInfo *info)
|
||||
@ -739,7 +739,7 @@ static int32_t InitProperty(void)
|
||||
CONN_LOGI(CONN_INIT, "g_tcpTimeOut=%{public}d", g_tcpTimeOut);
|
||||
if (g_tcpMaxConnNum == INVALID_DATA || g_tcpTimeOut == INVALID_DATA || g_tcpMaxLen == 0) {
|
||||
CONN_LOGE(CONN_INIT, "Cannot get brBuffSize");
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_TCPCONNECTION_SOCKET_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -144,6 +144,9 @@ enum SoftBusErrNo {
|
||||
SOFTBUS_NOT_NEED_UPDATE, // not need update
|
||||
SOFTBUS_NO_RESOURCE_ERR, // no available resource
|
||||
SOFTBUS_INVALID_APPTYPE,
|
||||
SOFTBUS_CREATE_LIST_ERR,
|
||||
SOFTBUS_LIST_EMPTY,
|
||||
SOFTBUS_STRCMP_ERR,
|
||||
|
||||
/* errno begin: -((203 << 21) | (5 << 16) | 0xFFFF) */
|
||||
SOFTBUS_TRANS_ERR_BASE = SOFTBUS_ERRNO(TRANS_SUB_MODULE_CODE),
|
||||
@ -459,147 +462,202 @@ enum SoftBusErrNo {
|
||||
|
||||
/* errno begin: -((203 << 21) | (2 << 16) | 0xFFFF) */
|
||||
SOFTBUS_CONN_ERR_BASE = SOFTBUS_ERRNO(CONN_SUB_MODULE_CODE),
|
||||
SOFTBUS_CONN_FAIL,
|
||||
SOFTBUS_CONN_MANAGER_TYPE_NOT_SUPPORT,
|
||||
SOFTBUS_CONN_MANAGER_OP_NOT_SUPPORT,
|
||||
SOFTBUS_CONN_MANAGER_PKT_LEN_INVALID,
|
||||
SOFTBUS_CONN_MANAGER_LIST_NOT_INIT,
|
||||
SOFTBUS_CONN_INVALID_CONN_TYPE,
|
||||
SOFTBUS_CONNECTION_BASE,
|
||||
SOFTBUS_CONNECTION_ERR_CLOSED,
|
||||
SOFTBUS_CONNECTION_ERR_DRIVER_CONGEST,
|
||||
SOFTBUS_CONNECTION_ERR_SOFTBUS_CONGEST,
|
||||
SOFTBUS_CONNECTION_ERR_CONNID_INVALID,
|
||||
SOFTBUS_CONNECTION_ERR_SENDQUEUE_FULL,
|
||||
SOFTBUS_CONN_SERVER_INIT_FAILED,
|
||||
SOFTBUS_CONN_FAIL = SOFTBUS_CONN_ERR_BASE + 1,
|
||||
SOFTBUS_CONN_MANAGER_TYPE_NOT_SUPPORT = SOFTBUS_CONN_ERR_BASE + 2,
|
||||
SOFTBUS_CONN_MANAGER_OP_NOT_SUPPORT = SOFTBUS_CONN_ERR_BASE + 3,
|
||||
SOFTBUS_CONN_MANAGER_PKT_LEN_INVALID = SOFTBUS_CONN_ERR_BASE + 4,
|
||||
SOFTBUS_CONN_MANAGER_LIST_NOT_INIT = SOFTBUS_CONN_ERR_BASE + 5,
|
||||
SOFTBUS_CONN_INVALID_CONN_TYPE = SOFTBUS_CONN_ERR_BASE + 6,
|
||||
SOFTBUS_CONNECTION_BASE = SOFTBUS_CONN_ERR_BASE + 7,
|
||||
SOFTBUS_CONNECTION_ERR_CLOSED = SOFTBUS_CONN_ERR_BASE + 8,
|
||||
SOFTBUS_CONNECTION_ERR_DRIVER_CONGEST = SOFTBUS_CONN_ERR_BASE + 9,
|
||||
SOFTBUS_CONNECTION_ERR_SOFTBUS_CONGEST = SOFTBUS_CONN_ERR_BASE + 10,
|
||||
SOFTBUS_CONNECTION_ERR_CONNID_INVALID = SOFTBUS_CONN_ERR_BASE + 11,
|
||||
SOFTBUS_CONNECTION_ERR_SENDQUEUE_FULL = SOFTBUS_CONN_ERR_BASE + 12,
|
||||
SOFTBUS_CONN_SERVER_INIT_FAILED = SOFTBUS_CONN_ERR_BASE + 13,
|
||||
|
||||
/* common error for bluetooth medium */
|
||||
SOFTBUS_CONN_BLUETOOTH_OFF,
|
||||
SOFTBUS_CONN_BLUETOOTH_OFF = SOFTBUS_CONN_ERR_BASE + 14,
|
||||
|
||||
SOFTBUS_CONN_BR_STATE_TURN_OFF,
|
||||
SOFTBUS_CONN_BR_INTERNAL_ERR,
|
||||
SOFTBUS_CONN_BR_INVALID_ADDRESS_ERR,
|
||||
SOFTBUS_CONN_BR_CONNECT_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BR_CONNECTION_NOT_EXIST_ERR,
|
||||
SOFTBUS_CONN_BR_CONNECTION_NOT_READY_ERR,
|
||||
SOFTBUS_CONN_BR_CONNECTION_INVALID_SOCKET,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_CONNECT_FAIL,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_WRITE_FAIL,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_SOCKET_CLOSED,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_READ_FAIL,
|
||||
SOFTBUS_CONN_BR_STATE_TURN_OFF = SOFTBUS_CONN_ERR_BASE + 15,
|
||||
SOFTBUS_CONN_BR_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 16,
|
||||
SOFTBUS_CONN_BR_INVALID_ADDRESS_ERR = SOFTBUS_CONN_ERR_BASE + 17,
|
||||
SOFTBUS_CONN_BR_CONNECT_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 18,
|
||||
SOFTBUS_CONN_BR_CONNECTION_NOT_EXIST_ERR = SOFTBUS_CONN_ERR_BASE + 19,
|
||||
SOFTBUS_CONN_BR_CONNECTION_NOT_READY_ERR = SOFTBUS_CONN_ERR_BASE + 20,
|
||||
SOFTBUS_CONN_BR_CONNECTION_INVALID_SOCKET = SOFTBUS_CONN_ERR_BASE + 21,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_CONNECT_FAIL = SOFTBUS_CONN_ERR_BASE + 22,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_WRITE_FAIL = SOFTBUS_CONN_ERR_BASE + 23,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_SOCKET_CLOSED = SOFTBUS_CONN_ERR_BASE + 24,
|
||||
SOFTBUS_CONN_BR_UNDERLAY_READ_FAIL = SOFTBUS_CONN_ERR_BASE + 25,
|
||||
|
||||
SOFTBUS_CONN_BLE_INTERNAL_ERR,
|
||||
SOFTBUS_CONN_BLE_CONNECT_PREVENTED_ERR,
|
||||
SOFTBUS_CONN_BLE_DISCONNECT_DIRECTLY_ERR,
|
||||
SOFTBUS_CONN_BLE_DISCONNECT_WAIT_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_CONNECT_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_EXCHANGE_BASIC_INFO_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_CONNECTION_NOT_EXIST_ERR,
|
||||
SOFTBUS_CONN_BLE_CONNECTION_NOT_READY_ERR,
|
||||
SOFTBUS_CONN_BLE_CLIENT_STATE_UNEXPECTED_ERR,
|
||||
SOFTBUS_CONN_BLE_SERVER_STATE_UNEXPECTED_ERR,
|
||||
SOFTBUS_CONN_BLE_SERVER_START_SERVER_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_SERVER_STOP_SERVER_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DISCONNECT_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_REGISTER_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONNECT_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONNECT_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_DISCONNECT_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_DISCONNECT_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SEARCH_SERVICE_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SEARCH_SERVICE_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_GET_SERVICE_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_REGISTER_NOTIFICATION_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_REGISTER_NOTIFICATION_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONFIGURE_MTU_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONFIGURE_MTU_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_WRITE_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_REGISTER_CALLBACK_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_ADD_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_ADD_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_ADD_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_ADD_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_START_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_START_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_DELETE_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_DELETE_FAIL,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_UNKNOWN_SERVICE_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_UNKNOWN_CHARACTERISTIC_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_UNKNOWN_DESCRIPTOR_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_HANDLE_MISMATCH_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_HANDLE_MISMATCH_ERR,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_HANDLE_MISMATCH_ERR,
|
||||
SOFTBUS_CONN_BLE_RECV_MSG_ERROR,
|
||||
SOFTBUS_CONN_BLE_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 26,
|
||||
SOFTBUS_CONN_BLE_CONNECT_PREVENTED_ERR = SOFTBUS_CONN_ERR_BASE + 27,
|
||||
SOFTBUS_CONN_BLE_DISCONNECT_DIRECTLY_ERR = SOFTBUS_CONN_ERR_BASE + 28,
|
||||
SOFTBUS_CONN_BLE_DISCONNECT_WAIT_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 29,
|
||||
SOFTBUS_CONN_BLE_CONNECT_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 30,
|
||||
SOFTBUS_CONN_BLE_EXCHANGE_BASIC_INFO_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 31,
|
||||
SOFTBUS_CONN_BLE_CONNECTION_NOT_EXIST_ERR = SOFTBUS_CONN_ERR_BASE + 32,
|
||||
SOFTBUS_CONN_BLE_CONNECTION_NOT_READY_ERR = SOFTBUS_CONN_ERR_BASE + 33,
|
||||
SOFTBUS_CONN_BLE_CLIENT_STATE_UNEXPECTED_ERR = SOFTBUS_CONN_ERR_BASE + 34,
|
||||
SOFTBUS_CONN_BLE_SERVER_STATE_UNEXPECTED_ERR = SOFTBUS_CONN_ERR_BASE + 35,
|
||||
SOFTBUS_CONN_BLE_SERVER_START_SERVER_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 36,
|
||||
SOFTBUS_CONN_BLE_SERVER_STOP_SERVER_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 37,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DISCONNECT_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 38,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_REGISTER_ERR = SOFTBUS_CONN_ERR_BASE + 39,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONNECT_ERR = SOFTBUS_CONN_ERR_BASE + 40,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONNECT_FAIL = SOFTBUS_CONN_ERR_BASE + 41,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_DISCONNECT_ERR = SOFTBUS_CONN_ERR_BASE + 42,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_DISCONNECT_FAIL = SOFTBUS_CONN_ERR_BASE + 43,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SEARCH_SERVICE_ERR = SOFTBUS_CONN_ERR_BASE + 44,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SEARCH_SERVICE_FAIL = SOFTBUS_CONN_ERR_BASE + 45,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_GET_SERVICE_ERR = SOFTBUS_CONN_ERR_BASE + 46,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_REGISTER_NOTIFICATION_ERR = SOFTBUS_CONN_ERR_BASE + 47,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_REGISTER_NOTIFICATION_FAIL = SOFTBUS_CONN_ERR_BASE + 48,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONFIGURE_MTU_ERR = SOFTBUS_CONN_ERR_BASE + 49,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_CONFIGURE_MTU_FAIL = SOFTBUS_CONN_ERR_BASE + 50,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_WRITE_ERR = SOFTBUS_CONN_ERR_BASE + 51,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_REGISTER_CALLBACK_ERR = SOFTBUS_CONN_ERR_BASE + 52,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_ERR = SOFTBUS_CONN_ERR_BASE + 53,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_FAIL = SOFTBUS_CONN_ERR_BASE + 54,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_ADD_ERR = SOFTBUS_CONN_ERR_BASE + 55,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_ADD_FAIL = SOFTBUS_CONN_ERR_BASE + 56,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_ADD_ERR = SOFTBUS_CONN_ERR_BASE + 57,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_ADD_FAIL = SOFTBUS_CONN_ERR_BASE + 58,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_START_ERR = SOFTBUS_CONN_ERR_BASE + 59,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_START_FAIL = SOFTBUS_CONN_ERR_BASE + 60,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_ERR = SOFTBUS_CONN_ERR_BASE + 61,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_FAIL = SOFTBUS_CONN_ERR_BASE + 62,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_DELETE_ERR = SOFTBUS_CONN_ERR_BASE + 63,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_DELETE_FAIL = SOFTBUS_CONN_ERR_BASE + 64,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_UNKNOWN_SERVICE_ERR = SOFTBUS_CONN_ERR_BASE + 65,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_UNKNOWN_CHARACTERISTIC_ERR = SOFTBUS_CONN_ERR_BASE + 66,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_UNKNOWN_DESCRIPTOR_ERR = SOFTBUS_CONN_ERR_BASE + 67,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_HANDLE_MISMATCH_ERR = SOFTBUS_CONN_ERR_BASE + 68,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_HANDLE_MISMATCH_ERR = SOFTBUS_CONN_ERR_BASE + 69,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_HANDLE_MISMATCH_ERR = SOFTBUS_CONN_ERR_BASE + 70,
|
||||
SOFTBUS_CONN_BLE_RECV_MSG_ERROR = SOFTBUS_CONN_ERR_BASE + 71,
|
||||
|
||||
SOFTBUS_CONN_BLE_COC_INTERNAL_ERR,
|
||||
SOFTBUS_CONN_BLE_COC_INVALID_ADDRESS_ERR,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECT_TIMEOUT_ERR,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECTION_NOT_EXIST_ERR,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECTION_NOT_READY_ERR,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECTION_INVALID_SOCKET,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_CONNECT_FAIL,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_WRITE_FAIL,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_SOCKET_CLOSED,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_READ_FAIL,
|
||||
SOFTBUS_CONN_BLE_COC_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 72,
|
||||
SOFTBUS_CONN_BLE_COC_INVALID_ADDRESS_ERR = SOFTBUS_CONN_ERR_BASE + 73,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECT_TIMEOUT_ERR = SOFTBUS_CONN_ERR_BASE + 74,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECTION_NOT_EXIST_ERR = SOFTBUS_CONN_ERR_BASE + 75,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECTION_NOT_READY_ERR = SOFTBUS_CONN_ERR_BASE + 76,
|
||||
SOFTBUS_CONN_BLE_COC_CONNECTION_INVALID_SOCKET = SOFTBUS_CONN_ERR_BASE + 77,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_CONNECT_FAIL = SOFTBUS_CONN_ERR_BASE + 78,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_WRITE_FAIL = SOFTBUS_CONN_ERR_BASE + 79,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_SOCKET_CLOSED = SOFTBUS_CONN_ERR_BASE + 80,
|
||||
SOFTBUS_CONN_BLE_COC_UNDERLAY_READ_FAIL = SOFTBUS_CONN_ERR_BASE + 81,
|
||||
|
||||
SOFTBUS_CONN_LINK_BROADCAST_START_ADV_FAIL,
|
||||
SOFTBUS_CONN_LINK_BROADCAST_QUERY_RPA_FAIL,
|
||||
SOFTBUS_CONN_LINK_BROADCAST_START_ADV_FAIL = SOFTBUS_CONN_ERR_BASE + 82,
|
||||
SOFTBUS_CONN_LINK_BROADCAST_QUERY_RPA_FAIL = SOFTBUS_CONN_ERR_BASE + 83,
|
||||
|
||||
SOFTBUS_BLECONNECTION_REG_GATTS_CALLBACK_FAIL,
|
||||
SOFTBUS_GATTC_INTERFACE_FAILED,
|
||||
SOFTBUS_BLECONNECTION_REG_GATTS_CALLBACK_FAIL = SOFTBUS_CONN_ERR_BASE + 84,
|
||||
SOFTBUS_GATTC_INTERFACE_FAILED = SOFTBUS_CONN_ERR_BASE + 85,
|
||||
|
||||
SOFTBUS_TCPCONNECTION_SOCKET_ERR,
|
||||
SOFTBUS_TCPFD_NOT_IN_TRIGGER,
|
||||
SOFTBUS_CONN_BLE_DIRECT_INIT_FAILED,
|
||||
SOFTBUS_SOCKET_ADDR_ERR,
|
||||
SOFTBUS_SOCKET_BIND_ERR,
|
||||
SOFTBUS_CONN_BLE_REUSE_FAILED,
|
||||
SOFTBUS_TCPCONNECTION_SOCKET_ERR = SOFTBUS_CONN_ERR_BASE + 86,
|
||||
SOFTBUS_TCPFD_NOT_IN_TRIGGER = SOFTBUS_CONN_ERR_BASE + 87,
|
||||
SOFTBUS_CONN_BLE_DIRECT_INIT_FAILED = SOFTBUS_CONN_ERR_BASE + 88,
|
||||
SOFTBUS_SOCKET_ADDR_ERR = SOFTBUS_CONN_ERR_BASE + 89,
|
||||
SOFTBUS_SOCKET_BIND_ERR = SOFTBUS_CONN_ERR_BASE + 90,
|
||||
SOFTBUS_CONN_BLE_REUSE_FAILED = SOFTBUS_CONN_ERR_BASE + 91,
|
||||
|
||||
SOFTBUS_CONN_PV1_WAIT_CONNECT_RESPONSE_TIMEOUT,
|
||||
SOFTBUS_CONN_PV2_WAIT_CONNECT_RESPONSE_TIMEOUT,
|
||||
SOFTBUS_CONN_HV1_WAIT_CONNECT_RESPONSE_TIMEOUT,
|
||||
SOFTBUS_CONN_HV2_WAIT_CONNECT_RESPONSE_TIMEOUT,
|
||||
SOFTBUS_CONN_PV1_WAIT_CONNECT_RESPONSE_TIMEOUT = SOFTBUS_CONN_ERR_BASE + 92,
|
||||
SOFTBUS_CONN_PV2_WAIT_CONNECT_RESPONSE_TIMEOUT = SOFTBUS_CONN_ERR_BASE + 93,
|
||||
SOFTBUS_CONN_HV1_WAIT_CONNECT_RESPONSE_TIMEOUT = SOFTBUS_CONN_ERR_BASE + 94,
|
||||
SOFTBUS_CONN_HV2_WAIT_CONNECT_RESPONSE_TIMEOUT = SOFTBUS_CONN_ERR_BASE + 95,
|
||||
|
||||
SOFTBUS_CONN_COND_WAIT_FAIL,
|
||||
SOFTBUS_CONN_COND_WAIT_FAIL = SOFTBUS_CONN_ERR_BASE + 96,
|
||||
SOFTBUS_CONN_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 97,
|
||||
SOFTBUS_CONN_LISTENER_NOT_IDLE = SOFTBUS_CONN_ERR_BASE + 98,
|
||||
SOFTBUS_CONN_GET_TIME_FAIL = SOFTBUS_CONN_ERR_BASE + 99,
|
||||
SOFTBUS_CONN_GET_MSG_FAIL = SOFTBUS_CONN_ERR_BASE + 100,
|
||||
SOFTBUS_COMM_BLE_ENABLE_ERR = SOFTBUS_CONN_ERR_BASE + 101,
|
||||
SOFTBUS_COMM_BLE_DISABLE_ERR = SOFTBUS_CONN_ERR_BASE + 102,
|
||||
SOFTBUS_COMM_BLUETOOTH_ADD_STATE_LISTENER_ERR = SOFTBUS_CONN_ERR_BASE + 103,
|
||||
SOFTBUS_COMM_BLUETOOTH_UNDERLAY_GET_ADDR_ERR = SOFTBUS_CONN_ERR_BASE + 104,
|
||||
SOFTBUS_COMM_BLUETOOTH_UNDERLAY_SET_NAME_ERR = SOFTBUS_CONN_ERR_BASE + 105,
|
||||
SOFTBUS_COMM_BLUETOOTH_UNDERLAY_REGISTER_CB_ERR = SOFTBUS_CONN_ERR_BASE + 106,
|
||||
SOFTBUS_COMM_BLUETOOTH_SWITCH_STATE_ERR = SOFTBUS_CONN_ERR_BASE + 107,
|
||||
SOFTBUS_COMM_BLUETOOTH_ACL_SWITCH_STATE_ERR = SOFTBUS_CONN_ERR_BASE + 108,
|
||||
SOFTBUS_CONN_BR_SOCKET_CONNECT_ERR = SOFTBUS_CONN_ERR_BASE + 109,
|
||||
SOFTBUS_CONN_BR_SPP_SERVER_ERR = SOFTBUS_CONN_ERR_BASE + 110,
|
||||
SOFTBUS_CONN_BR_CREATE_QUEUE_FAIL = SOFTBUS_CONN_ERR_BASE + 111,
|
||||
SOFTBUS_CONN_BR_SET_PENDING_PACKET_ERR = SOFTBUS_CONN_ERR_BASE + 112,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SET_FASTEST_ERR = SOFTBUS_CONN_ERR_BASE + 113,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SET_PRIORITY_ERR = SOFTBUS_CONN_ERR_BASE + 114,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_CONNECT_ERR = SOFTBUS_CONN_ERR_BASE + 115,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_DISCONNECT_ERR = SOFTBUS_CONN_ERR_BASE + 116,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_SEND_RESPONSE_ERR = SOFTBUS_CONN_ERR_BASE + 117,
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_SERVER_SEND_INDICATION_ERR = SOFTBUS_CONN_ERR_BASE + 118,
|
||||
SOFTBUS_CONN_BLE_CHECK_STATUS_ERR = SOFTBUS_CONN_ERR_BASE + 119,
|
||||
SOFTBUS_CONN_SOCKET_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 120,
|
||||
SOFTBUS_CONN_SOCKET_GET_INTERFACE_ERR = SOFTBUS_CONN_ERR_BASE + 121,
|
||||
SOFTBUS_CONN_SOCKET_FCNTL_ERR = SOFTBUS_CONN_ERR_BASE + 122,
|
||||
SOFTBUS_CONN_BYTES_TO_HEX_STR_ERR = SOFTBUS_CONN_ERR_BASE + 123,
|
||||
SOFTBUS_CONN_HEX_STR_TO_BYTES_ERR = SOFTBUS_CONN_ERR_BASE + 124,
|
||||
|
||||
SOFTBUS_CONN_COAP_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 125,
|
||||
SOFTBUS_CONN_COAP_DMSG_CONNET_ERR = SOFTBUS_CONN_ERR_BASE + 126,
|
||||
SOFTBUS_CONN_COAP_DMSG_CLOSE_ERR = SOFTBUS_CONN_ERR_BASE + 127,
|
||||
SOFTBUS_CONN_COAP_DMSG_SEND_ERR = SOFTBUS_CONN_ERR_BASE + 128,
|
||||
SOFTBUS_CONN_COAP_DMSG_REGISTE_LOG_ERR = SOFTBUS_CONN_ERR_BASE + 129,
|
||||
|
||||
SOFTBUS_CONN_LEGACY_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 130,
|
||||
SOFTBUS_CONN_LEGACY_GET_CHANNEL_FAIL = SOFTBUS_CONN_ERR_BASE + 131,
|
||||
SOFTBUS_CONN_LEGACY_BLE_GET_CONNECTION_FAIL = SOFTBUS_CONN_ERR_BASE + 132,
|
||||
SOFTBUS_CONN_LEGACY_BR_GET_CONNECTION_FAIL = SOFTBUS_CONN_ERR_BASE + 133,
|
||||
SOFTBUS_CONN_LEGACY_HML_DEVICEID_ERR = SOFTBUS_CONN_ERR_BASE + 134,
|
||||
SOFTBUS_CONN_LEGACY_HML_CONNECT_FAIL = SOFTBUS_CONN_ERR_BASE + 135,
|
||||
SOFTBUS_CONN_LEGACY_HML_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 136,
|
||||
SOFTBUS_CONN_LEGACY_P2P_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 137,
|
||||
SOFTBUS_CONN_LEGACY_CREAT_LISTENER_MODULE_ERR = SOFTBUS_CONN_ERR_BASE + 138,
|
||||
SOFTBUS_CONN_LEGACY_TCP_INTERNAL_ERR = SOFTBUS_CONN_ERR_BASE + 139,
|
||||
SOFTBUS_CONN_LEGACY_TCP_SEND_SIZE_ERR = SOFTBUS_CONN_ERR_BASE + 140,
|
||||
SOFTBUS_CONN_LEGACY_ADD_TRIGGER_FAIL = SOFTBUS_CONN_ERR_BASE + 141,
|
||||
SOFTBUS_CONN_LEGACY_HANDLE_OPEN_REQ_FAIL = SOFTBUS_CONN_ERR_BASE + 142,
|
||||
SOFTBUS_CONN_LEGACY_POST_TIME_OUT_FAIL = SOFTBUS_CONN_ERR_BASE + 143,
|
||||
SOFTBUS_CONN_LEGACY_POST_MSG_TO_LOOPER_FAIL = SOFTBUS_CONN_ERR_BASE + 144,
|
||||
SOFTBUS_CONN_LEGACY_GET_CHANNEL_MANAGER_FAIL = SOFTBUS_CONN_ERR_BASE + 145,
|
||||
SOFTBUS_CONN_LEGACY_SEND_MESSAGE_FAIL = SOFTBUS_CONN_ERR_BASE + 146,
|
||||
SOFTBUS_CONN_LEGACY_SEND_MESSAGE_DELAYED_FAIL = SOFTBUS_CONN_ERR_BASE + 147,
|
||||
SOFTBUS_CONN_LEGACY_GET_P2P_ABILITY_FAIL = SOFTBUS_CONN_ERR_BASE + 148,
|
||||
SOFTBUS_CONN_LEGACY_GET_GROUP_INFO_FAIL = SOFTBUS_CONN_ERR_BASE + 149,
|
||||
|
||||
/* soft bus connection mapping short range conflict error code */
|
||||
SOFTBUS_CONN_SHORT_RANGE_BASE = SOFTBUS_ERRNO(CONN_SUB_MODULE_CODE) + 1000,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_NO_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_NO_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_ERROR,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_ERROR,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_STA_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_P2P_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_P2P_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_HML_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_HML_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_STA_HML_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_HML_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_STA_P2P_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_P2P_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_P2P_HML_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_P2P_HML_CHIP_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_55_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_55_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_225_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_225_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_255_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_255_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_525_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_525_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_555_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_555_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_P2P_GO_GC_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_P2P_GO_GC_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_P2P_NUM_LIMITED_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_P2P_NUM_LIMITED_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_HML_NUM_LIMITED_CONFLICT,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_HML_NUM_LIMITED_CONFLICT,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_NO_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1001,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_NO_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1002,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_ERROR = SOFTBUS_CONN_ERR_BASE + 1003,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_ERROR = SOFTBUS_CONN_ERR_BASE + 1004,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_STA_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1005,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1006,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_P2P_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1007,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_P2P_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1008,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_HML_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1009,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_HML_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1010,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_STA_HML_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1011,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_HML_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1012,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_STA_P2P_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1013,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_STA_P2P_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1014,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_AP_P2P_HML_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1015,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_AP_P2P_HML_CHIP_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1016,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_55_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1017,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_55_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1018,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_225_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1019,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_225_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1020,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_255_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1021,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_255_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1022,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_525_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1023,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_525_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1024,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_STA_P2P_HML_555_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1025,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_STA_P2P_HML_555_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1026,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_P2P_GO_GC_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1027,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_P2P_GO_GC_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1028,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_P2P_NUM_LIMITED_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1029,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_P2P_NUM_LIMITED_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1030,
|
||||
SOFTBUS_CONN_ACTIVE_TYPE_HML_NUM_LIMITED_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1031,
|
||||
SOFTBUS_CONN_PASSIVE_TYPE_HML_NUM_LIMITED_CONFLICT = SOFTBUS_CONN_ERR_BASE + 1032,
|
||||
|
||||
/* errno begin: -((203 << 21) | (1 << 16) | 0xFFFF) */
|
||||
SOFTBUS_DISCOVER_ERR_BASE = SOFTBUS_ERRNO(DISC_SUB_MODULE_CODE),
|
||||
|
@ -425,7 +425,7 @@ HWTEST_F(AdapterBleGattClientTest, EnableFastestConn, TestSize.Level3)
|
||||
.Times(2)
|
||||
.WillOnce(Return(OHOS_BT_STATUS_FAIL))
|
||||
.WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftbusGattcSetFastestConn(1), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftbusGattcSetFastestConn(1), SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SET_FASTEST_ERR);
|
||||
ASSERT_EQ(SoftbusGattcSetFastestConn(1), SOFTBUS_OK);
|
||||
}
|
||||
|
||||
@ -450,7 +450,8 @@ HWTEST_F(AdapterBleGattClientTest, SetBleConnectionPriority, TestSize.Level3)
|
||||
.Times(2)
|
||||
.WillOnce(Return(OHOS_BT_STATUS_FAIL))
|
||||
.WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftbusGattcSetPriority(1, &addr, SOFTBUS_GATT_PRIORITY_BALANCED), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftbusGattcSetPriority(1, &addr, SOFTBUS_GATT_PRIORITY_BALANCED),
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CLIENT_SET_PRIORITY_ERR);
|
||||
ASSERT_EQ(SoftbusGattcSetPriority(1, &addr, SOFTBUS_GATT_PRIORITY_BALANCED), SOFTBUS_OK);
|
||||
}
|
||||
|
||||
|
@ -189,12 +189,12 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsAddService, TestSize.Level3)
|
||||
.uuidLen = 0,
|
||||
.uuid = nullptr,
|
||||
};
|
||||
ASSERT_EQ(SoftBusGattsAddService(service, true, 1), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsAddService(service, true, 1), SOFTBUS_INVALID_PARAM);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsAddService).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
service.uuid = (char *)serviceUuid;
|
||||
service.uuidLen = strlen(serviceUuid);
|
||||
ASSERT_EQ(SoftBusGattsAddService(service, true, 1), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsAddService(service, true, 1), SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsAddService).WillRepeatedly(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsAddService(service, true, 1), SOFTBUS_OK);
|
||||
@ -227,14 +227,16 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsAddCharacteristic, TestSize.Level
|
||||
SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_INDICATE;
|
||||
int permissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
|
||||
ASSERT_EQ(
|
||||
SoftBusGattsAddCharacteristic(MOCK_GATT_SERVICE_HANDLE, characteristic, properties, permissions), SOFTBUS_ERR);
|
||||
SoftBusGattsAddCharacteristic(MOCK_GATT_SERVICE_HANDLE, characteristic, properties, permissions),
|
||||
SOFTBUS_INVALID_PARAM);
|
||||
|
||||
const char *netCharacteristic = "00002B00-0000-1000-8000-00805F9B34FB";
|
||||
characteristic.uuid = (char *)netCharacteristic;
|
||||
characteristic.uuidLen = strlen(netCharacteristic);
|
||||
EXPECT_CALL(mocker, BleGattsAddCharacteristic).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(
|
||||
SoftBusGattsAddCharacteristic(MOCK_GATT_SERVICE_HANDLE, characteristic, properties, permissions), SOFTBUS_ERR);
|
||||
SoftBusGattsAddCharacteristic(MOCK_GATT_SERVICE_HANDLE, characteristic, properties, permissions),
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_CHARACTERISTIC_ADD_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsAddCharacteristic).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(
|
||||
@ -264,14 +266,15 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsAddDescriptor, TestSize.Level3)
|
||||
.uuid = nullptr,
|
||||
};
|
||||
int permissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
|
||||
ASSERT_EQ(SoftBusGattsAddDescriptor(MOCK_GATT_SERVICE_HANDLE, desciptor, permissions), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsAddDescriptor(MOCK_GATT_SERVICE_HANDLE, desciptor, permissions), SOFTBUS_INVALID_PARAM);
|
||||
|
||||
const char *connDesciptor = "00002902-0000-1000-8000-00805F9B34FB";
|
||||
desciptor.uuid = (char *)connDesciptor;
|
||||
desciptor.uuidLen = strlen(connDesciptor);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsAddDescriptor).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsAddDescriptor(MOCK_GATT_SERVICE_HANDLE, desciptor, permissions), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsAddDescriptor(MOCK_GATT_SERVICE_HANDLE, desciptor, permissions),
|
||||
SOFTBUS_CONN_BLE_UNDERLAY_DESCRIPTOR_ADD_ERR);
|
||||
EXPECT_CALL(mocker, BleGattsAddDescriptor).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsAddDescriptor(MOCK_GATT_SERVICE_HANDLE, desciptor, permissions), SOFTBUS_OK);
|
||||
}
|
||||
@ -295,7 +298,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsStartService, TestSize.Level3)
|
||||
ASSERT_EQ(SoftBusRegisterGattsCallbacks(GetStubGattsCallback(), service, expectedMtu), SOFTBUS_OK);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsStartService).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsStartService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsStartService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_START_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsStartService).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsStartService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_OK);
|
||||
@ -320,7 +323,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsStopService, TestSize.Level3)
|
||||
ASSERT_EQ(SoftBusRegisterGattsCallbacks(GetStubGattsCallback(), service, expectedMtu), SOFTBUS_OK);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsStopService).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsStopService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsStopService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsStopService).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsStopService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_OK);
|
||||
@ -345,7 +348,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsDeleteService, TestSize.Level3)
|
||||
ASSERT_EQ(SoftBusRegisterGattsCallbacks(GetStubGattsCallback(), service, expectedMtu), SOFTBUS_OK);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsDeleteService).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsDeleteService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsDeleteService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_DELETE_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsDeleteService).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsDeleteService(MOCK_GATT_SERVICE_HANDLE), SOFTBUS_OK);
|
||||
@ -374,7 +377,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsDisconnect, TestSize.Level3)
|
||||
.addr = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66},
|
||||
};
|
||||
EXPECT_CALL(mocker, BleGattsDisconnect).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsDisconnect(addr, connId), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsDisconnect(addr, connId), SOFTBUS_CONN_BLE_UNDERLAY_SERVER_DISCONNECT_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsDisconnect).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsDisconnect(addr, connId), SOFTBUS_OK);
|
||||
@ -400,7 +403,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsSendResponse, TestSize.Level3)
|
||||
|
||||
SoftBusGattsResponse resp = {0};
|
||||
EXPECT_CALL(mocker, BleGattsSendResponse).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsSendResponse(&resp), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsSendResponse(&resp), SOFTBUS_CONN_BLE_UNDERLAY_SERVER_SEND_RESPONSE_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsSendResponse).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsSendResponse(&resp), SOFTBUS_OK);
|
||||
@ -426,7 +429,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsSendNotify, TestSize.Level3)
|
||||
|
||||
SoftBusGattsNotify notify = {0};
|
||||
EXPECT_CALL(mocker, BleGattsSendIndication).Times(1).WillOnce(Return(OHOS_BT_STATUS_FAIL));
|
||||
ASSERT_EQ(SoftBusGattsSendNotify(¬ify), SOFTBUS_ERR);
|
||||
ASSERT_EQ(SoftBusGattsSendNotify(¬ify), SOFTBUS_CONN_BLE_UNDERLAY_SERVER_SEND_INDICATION_ERR);
|
||||
|
||||
EXPECT_CALL(mocker, BleGattsSendIndication).Times(1).WillOnce(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
ASSERT_EQ(SoftBusGattsSendNotify(¬ify), SOFTBUS_OK);
|
||||
|
@ -46,7 +46,7 @@ HWTEST(AdapterBtCommonTest, SoftBusEnableBt, TestSize.Level3)
|
||||
MockBluetooth mocker;
|
||||
EXPECT_CALL(mocker, EnableBle()).Times(2).WillOnce(Return(true)).WillOnce(Return(false));
|
||||
EXPECT_EQ(SoftBusEnableBt(), SOFTBUS_OK);
|
||||
EXPECT_EQ(SoftBusEnableBt(), SOFTBUS_ERR);
|
||||
EXPECT_EQ(SoftBusEnableBt(), SOFTBUS_COMM_BLE_ENABLE_ERR);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ HWTEST(AdapterBtCommonTest, SoftBusDisableBt, TestSize.Level3)
|
||||
MockBluetooth mocker;
|
||||
EXPECT_CALL(mocker, DisableBle()).Times(2).WillOnce(Return(true)).WillOnce(Return(false));
|
||||
EXPECT_EQ(SoftBusDisableBt(), SOFTBUS_OK);
|
||||
EXPECT_EQ(SoftBusDisableBt(), SOFTBUS_ERR);
|
||||
EXPECT_EQ(SoftBusDisableBt(), SOFTBUS_COMM_BLE_DISABLE_ERR);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,12 +85,12 @@ HWTEST(AdapterBtCommonTest, SoftBusGetBtState, TestSize.Level3)
|
||||
*/
|
||||
HWTEST(AdapterBtCommonTest, SoftBusGetBtMacAddr, TestSize.Level3)
|
||||
{
|
||||
EXPECT_EQ(SoftBusGetBtMacAddr(NULL), SOFTBUS_ERR);
|
||||
EXPECT_EQ(SoftBusGetBtMacAddr(NULL), SOFTBUS_INVALID_PARAM);
|
||||
MockBluetooth mocker;
|
||||
SoftBusBtAddr mac = {0};
|
||||
EXPECT_CALL(mocker, GetLocalAddr(mac.addr, BT_ADDR_LEN)).Times(2).WillOnce(Return(true)).WillOnce(Return(false));
|
||||
EXPECT_EQ(SoftBusGetBtMacAddr(&mac), SOFTBUS_OK);
|
||||
EXPECT_EQ(SoftBusGetBtMacAddr(&mac), SOFTBUS_ERR);
|
||||
EXPECT_EQ(SoftBusGetBtMacAddr(&mac), SOFTBUS_COMM_BLUETOOTH_UNDERLAY_GET_ADDR_ERR);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,14 +108,14 @@ HWTEST(AdapterBtCommonTest, SoftBusSetBtName, TestSize.Level3)
|
||||
.WillOnce(Return(true))
|
||||
.WillOnce(Return(false));
|
||||
EXPECT_EQ(SoftBusSetBtName(name), SOFTBUS_OK);
|
||||
EXPECT_EQ(SoftBusSetBtName(name), SOFTBUS_ERR);
|
||||
EXPECT_EQ(SoftBusSetBtName(name), SOFTBUS_COMM_BLUETOOTH_UNDERLAY_SET_NAME_ERR);
|
||||
}
|
||||
|
||||
static testing::AssertionResult PrepareBtStateListener(MockBluetooth &mocker, int *outlistenerId)
|
||||
{
|
||||
EXPECT_CALL(mocker, BleStopScan).WillRepeatedly(Return(OHOS_BT_STATUS_SUCCESS));
|
||||
auto listenerId = SoftBusAddBtStateListener(GetMockBtStateListener());
|
||||
if (listenerId == SOFTBUS_ERR) {
|
||||
if (listenerId < 0) {
|
||||
return testing::AssertionFailure() << "SoftBusAddBtStateListener failed";
|
||||
}
|
||||
if (MockBluetooth::btGapCallback == nullptr) {
|
||||
|
@ -80,7 +80,7 @@ HWTEST_F(ServiceConnectionTest, ServiceConnection001, TestSize.Level1)
|
||||
{
|
||||
int32_t ret;
|
||||
NiceMock<ConnectionBleInterfaceMock> bleMock;
|
||||
EXPECT_CALL(bleMock, SoftBusGattsAddService(_, _, _)).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(bleMock, SoftBusGattsAddService(_, _, _)).WillRepeatedly(Return(SOFTBUS_INVALID_PARAM));
|
||||
ret = ConnGattServerStartService();
|
||||
EXPECT_EQ(SOFTBUS_CONN_BLE_UNDERLAY_SERVER_ADD_SERVICE_ERR, ret);
|
||||
}
|
||||
@ -97,7 +97,7 @@ HWTEST_F(ServiceConnectionTest, ServiceConnection002, TestSize.Level1)
|
||||
{
|
||||
int32_t ret;
|
||||
NiceMock<ConnectionBleInterfaceMock> bleMock;
|
||||
EXPECT_CALL(bleMock, SoftBusGattsStopService).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(bleMock, SoftBusGattsStopService).WillRepeatedly(Return(SOFTBUS_CONN_BLE_UNDERLAY_SERVICE_STOP_ERR));
|
||||
ret = ConnGattServerStopService();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
}
|
||||
@ -128,13 +128,13 @@ HWTEST_F(ServiceConnectionTest, ServiceConnection003, TestSize.Level1)
|
||||
connection.underlayerHandle = 1;
|
||||
connection.connectionId = 1;
|
||||
SoftBusMutexInit(&connection.lock, nullptr);
|
||||
EXPECT_CALL(bleMock, ConvertBtMacToBinary).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(bleMock, ConvertBtMacToBinary).WillRepeatedly(Return(SOFTBUS_INVALID_PARAM));
|
||||
ret = ConnGattServerDisconnect(&connection);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
|
||||
SoftBusMutexInit(&connection.lock, nullptr);
|
||||
EXPECT_CALL(bleMock, ConvertBtMacToBinary).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(bleMock, SoftBusGattsDisconnect).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(bleMock, SoftBusGattsDisconnect).WillRepeatedly(Return(SOFTBUS_MEM_ERR));
|
||||
ret = ConnGattServerDisconnect(&connection);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
|
||||
@ -176,7 +176,7 @@ HWTEST_F(ServiceConnectionTest, ServiceConnection004, TestSize.Level1)
|
||||
g_callback->RequestWriteCallback(writeCbPara);
|
||||
connection.underlayerHandle = INVALID_UNDERLAY_HANDLE;
|
||||
ret = ConnGattServerConnect(&connection);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_CONN_BLE_INTERNAL_ERR, ret);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -277,12 +277,12 @@ HWTEST_F(ServiceConnectionTest, ClientConnection003, TestSize.Level1)
|
||||
connection.state = BLE_CONNECTION_STATE_CONNECTING;
|
||||
SoftBusMutexInit(&connection.lock, nullptr);
|
||||
ret = ConnGattClientUpdatePriority(&connection, priority);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_CONN_BLE_INTERNAL_ERR, ret);
|
||||
|
||||
connection.state = BLE_CONNECTION_STATE_SERVICE_SEARCHING;
|
||||
EXPECT_CALL(bleMock, ConvertBtMacToBinary).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(bleMock, ConvertBtMacToBinary).WillRepeatedly(Return(SOFTBUS_INVALID_PARAM));
|
||||
SoftBusMutexInit(&connection.lock, nullptr);
|
||||
ret = ConnGattClientUpdatePriority(&connection, priority);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ int32_t ConnBleInitTransModule(ConnBleTransEventListener *listener)
|
||||
int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
|
||||
{
|
||||
if (listener == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
g_btListener = *listener;
|
||||
if (g_listenerId > MAX_SIZE) {
|
||||
|
@ -486,7 +486,7 @@ HWTEST_F(ConnectionBleSwitchTest, testConnmanger008, TestSize.Level1)
|
||||
ret = ConnSetConnectCallback(MODULE_TRUST_ENGINE, &connCb);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
ret = ConnSetConnectCallback(MODULE_TRUST_ENGINE, &connCb);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_CONN_INTERNAL_ERR, ret);
|
||||
info.type = CONNECT_BLE;
|
||||
(void)memcpy_s(info.bleOption.bleMac, BT_MAC_LEN, TEST_BLE_MAC, BT_MAC_LEN);
|
||||
printf("brMac: %s\n", info.bleOption.bleMac);
|
||||
@ -546,7 +546,7 @@ HWTEST_F(ConnectionBleSwitchTest, testConnmanger009, TestSize.Level1)
|
||||
ret = ConnSetConnectCallback(MODULE_TRUST_ENGINE, &connCb);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
ret = ConnSetConnectCallback(MODULE_TRUST_ENGINE, &connCb);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_CONN_INTERNAL_ERR, ret);
|
||||
optionInfo.type = CONNECT_BLE;
|
||||
(void)memcpy_s(optionInfo.bleOption.bleMac, BT_MAC_LEN, TEST_BLE_MAC, BT_MAC_LEN);
|
||||
connRet.OnConnectFailed = ConnectFailedCB;
|
||||
|
@ -236,7 +236,7 @@ HWTEST_F(ConnectionBrConnectionTest, BrManagerTest002, TestSize.Level1)
|
||||
EXPECT_CALL(brMock, SoftbusGetConfig)
|
||||
.WillOnce(ConnectionBrInterfaceMock::ActionOfSoftbusGetConfig1)
|
||||
.WillOnce(ConnectionBrInterfaceMock::ActionOfSoftbusGetConfig2);
|
||||
EXPECT_CALL(brMock, ConnBrInnerQueueInit).WillOnce(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(brMock, ConnBrInnerQueueInit).WillOnce(Return(SOFTBUS_NO_INIT));
|
||||
ConnectFuncInterface *ret = ConnInitBr(&callback);
|
||||
EXPECT_EQ(NULL, ret);
|
||||
|
||||
@ -247,7 +247,7 @@ HWTEST_F(ConnectionBrConnectionTest, BrManagerTest002, TestSize.Level1)
|
||||
EXPECT_CALL(brMock, ConnBrInnerQueueInit).WillOnce(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(brMock, SoftBusThreadCreate)
|
||||
.WillOnce(Return(SOFTBUS_OK))
|
||||
.WillOnce(Return(SOFTBUS_ERR));
|
||||
.WillOnce(Return(SOFTBUS_INVALID_PARAM));
|
||||
ret = ConnInitBr(&callback);
|
||||
EXPECT_EQ(NULL, ret);
|
||||
}
|
||||
|
@ -421,14 +421,14 @@ HWTEST_F(ConnectionBrConnectionTest, testBrConnection013, TestSize.Level1)
|
||||
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len = 0;
|
||||
ret = InitProperty();
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_TCPCONNECTION_SOCKET_ERR, ret);
|
||||
|
||||
val = MAX_BR_READ_BUFFER_CAPACITY + 1;
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len = 4;
|
||||
memcpy_s((void *)(g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].val),
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len, (void *)(&val), sizeof(int));
|
||||
ret = InitProperty();
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_TCPCONNECTION_SOCKET_ERR, ret);
|
||||
|
||||
val = MAX_BR_READ_BUFFER_CAPACITY;
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len = 4;
|
||||
@ -436,7 +436,7 @@ HWTEST_F(ConnectionBrConnectionTest, testBrConnection013, TestSize.Level1)
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len, (void *)(&val), sizeof(int));
|
||||
g_configItems[SOFTBUS_INT_CONN_RFCOM_SEND_MAX_LEN].len = 0;
|
||||
ret = InitProperty();
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_TCPCONNECTION_SOCKET_ERR, ret);
|
||||
|
||||
val = MAX_BR_READ_BUFFER_CAPACITY;
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len = 4;
|
||||
@ -447,7 +447,7 @@ HWTEST_F(ConnectionBrConnectionTest, testBrConnection013, TestSize.Level1)
|
||||
memcpy_s((void *)(g_configItems[SOFTBUS_INT_CONN_RFCOM_SEND_MAX_LEN].val),
|
||||
g_configItems[SOFTBUS_INT_CONN_RFCOM_SEND_MAX_LEN].len, (void *)(&mtu), sizeof(int));
|
||||
ret = InitProperty();
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_TCPCONNECTION_SOCKET_ERR, ret);
|
||||
|
||||
val = MAX_BR_READ_BUFFER_CAPACITY;
|
||||
g_configItems[SOFTBUS_INT_CONN_BR_MAX_DATA_LENGTH].len = 4;
|
||||
@ -1202,7 +1202,7 @@ HWTEST_F(ConnectionBrConnectionTest, testBrManager038, TestSize.Level1)
|
||||
{
|
||||
NiceMock<ConnectionBrInterfaceMock> brMock;
|
||||
|
||||
EXPECT_CALL(brMock, SoftBusGetBtMacAddr).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(brMock, SoftBusGetBtMacAddr).WillRepeatedly(Return(SOFTBUS_INVALID_PARAM));
|
||||
DumpLocalBtMac();
|
||||
|
||||
EXPECT_CALL(brMock, SoftBusGetBtMacAddr).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
@ -1215,7 +1215,7 @@ HWTEST_F(ConnectionBrConnectionTest, testBrManager039, TestSize.Level1)
|
||||
int state = SOFTBUS_BR_STATE_TURN_ON;
|
||||
NiceMock<ConnectionBrInterfaceMock> brMock;
|
||||
|
||||
EXPECT_CALL(brMock, SoftBusGetBtMacAddr).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
EXPECT_CALL(brMock, SoftBusGetBtMacAddr).WillRepeatedly(Return(SOFTBUS_INVALID_PARAM));
|
||||
OnBtStateChanged(listenerId, state);
|
||||
|
||||
state = SOFTBUS_BR_STATE_TURN_OFF;
|
||||
|
@ -657,7 +657,7 @@ HWTEST_F(ConnectionBrTest, testBrPendingPacket006, TestSize.Level1)
|
||||
|
||||
ConnBrDelBrPendingPacket(id, seq);
|
||||
ret = ConnBrSetBrPendingPacket(id, seq, data);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_CONN_BR_SET_PENDING_PACKET_ERR, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(ConnectionBrTest, testBrPendingPacket007, TestSize.Level1)
|
||||
|
@ -303,7 +303,7 @@ HWTEST_F(SoftbusConnCommonTest, testBaseListener021, TestSize.Level1)
|
||||
int i;
|
||||
for (i = PROXY; i < LISTENER_MODULE_DYNAMIC_START; i++) {
|
||||
info.socketOption.moduleId = static_cast<ListenerModule>(i);
|
||||
EXPECT_EQ(SOFTBUS_ERR, StartBaseListener(&info, listener));
|
||||
EXPECT_EQ(SOFTBUS_CONN_LISTENER_NOT_IDLE, StartBaseListener(&info, listener));
|
||||
}
|
||||
free(listener);
|
||||
};
|
||||
|
@ -366,7 +366,7 @@ HWTEST_F(ConnectionManagerTest, testConnmanger005, TestSize.Level1)
|
||||
ret = ConnSetConnectCallback(MODULE_AUTH_SDK, &connCb);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
ret = ConnSetConnectCallback(MODULE_AUTH_SDK, &connCb);
|
||||
EXPECT_EQ(SOFTBUS_ERR, ret);
|
||||
EXPECT_EQ(SOFTBUS_CONN_INTERNAL_ERR, ret);
|
||||
|
||||
ConnUnSetConnectCallback(MODULE_TRUST_ENGINE);
|
||||
ConnUnSetConnectCallback(MODULE_AUTH_SDK);
|
||||
|
@ -220,7 +220,7 @@ HWTEST_F(TcpManagerTest, testTcpManager002, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(TcpManagerTest, testTcpManager003, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(SOFTBUS_ERR, TcpDisconnectDevice(g_connectionId));
|
||||
EXPECT_EQ(SOFTBUS_CONN_SOCKET_INTERNAL_ERR, TcpDisconnectDevice(g_connectionId));
|
||||
};
|
||||
|
||||
/*
|
||||
@ -233,7 +233,7 @@ HWTEST_F(TcpManagerTest, testTcpManager004, TestSize.Level1)
|
||||
{
|
||||
ConnectionInfo info = {};
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, TcpGetConnectionInfo(g_connectionId, nullptr));
|
||||
EXPECT_EQ(SOFTBUS_ERR, TcpGetConnectionInfo(g_connectionId, &info));
|
||||
EXPECT_EQ(SOFTBUS_TCPCONNECTION_SOCKET_ERR, TcpGetConnectionInfo(g_connectionId, &info));
|
||||
EXPECT_EQ(false, info.isAvailable);
|
||||
};
|
||||
|
||||
@ -1771,6 +1771,6 @@ HWTEST_F(TcpManagerTest, testTcpManager052, TestSize.Level1)
|
||||
HWTEST_F(TcpManagerTest, testTcpDisconnectDeviceNow001, TestSize.Level1)
|
||||
{
|
||||
int ret = TcpDisconnectDeviceNow(nullptr);
|
||||
EXPECT_EQ(ret, SOFTBUS_ERR);
|
||||
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user