mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-26 18:30:47 +00:00
commit
f9bfa5c8cb
@ -343,7 +343,6 @@ int32_t SoftBusGetChannelListFor5G(int32_t *channelList, int32_t num)
|
|||||||
SoftBusBand SoftBusGetLinkBand(void)
|
SoftBusBand SoftBusGetLinkBand(void)
|
||||||
{
|
{
|
||||||
WifiLinkedInfo result;
|
WifiLinkedInfo result;
|
||||||
GetLinkedInfo(&result);
|
|
||||||
if (GetLinkedInfo(&result) != WIFI_SUCCESS) {
|
if (GetLinkedInfo(&result) != WIFI_SUCCESS) {
|
||||||
LNN_LOGE(LNN_STATE, "get SoftBusGetLinkBand failed");
|
LNN_LOGE(LNN_STATE, "get SoftBusGetLinkBand failed");
|
||||||
return BAND_UNKNOWN;
|
return BAND_UNKNOWN;
|
||||||
@ -467,4 +466,4 @@ bool SoftBusIsWifiP2pEnabled(void)
|
|||||||
LNN_LOGI(LNN_STATE, "P2pState=%{public}d", state);
|
LNN_LOGI(LNN_STATE, "P2pState=%{public}d", state);
|
||||||
|
|
||||||
return state == P2P_STATE_STARTED;
|
return state == P2P_STATE_STARTED;
|
||||||
}
|
}
|
||||||
|
@ -1334,22 +1334,6 @@ static int32_t LaneLinkOfP2pReuse(uint32_t reqId, const LinkRequest *reqInfo, co
|
|||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t GetWlanLinkedAttribute(int32_t *channel, bool *is5GBand, bool *isConnected)
|
|
||||||
{
|
|
||||||
LnnWlanLinkedInfo info;
|
|
||||||
int32_t ret = LnnGetWlanLinkedInfo(&info);
|
|
||||||
if (ret != SOFTBUS_OK) {
|
|
||||||
LNN_LOGE(LNN_LANE, "LnnGetWlanLinkedInfo fail, ret=%{public}d", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*isConnected = info.isConnected;
|
|
||||||
*is5GBand = (info.band != 1);
|
|
||||||
|
|
||||||
*channel = SoftBusFrequencyToChannel(info.frequency);
|
|
||||||
LNN_LOGI(LNN_LANE, "wlan current channel=%{public}d", *channel);
|
|
||||||
return SOFTBUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SelectProtocolReq {
|
struct SelectProtocolReq {
|
||||||
LnnNetIfType localIfType;
|
LnnNetIfType localIfType;
|
||||||
ProtocolType selectedProtocol;
|
ProtocolType selectedProtocol;
|
||||||
@ -1429,18 +1413,9 @@ static int32_t FillWlanLinkInfo(ProtocolType protocol, const LinkRequest *reqInf
|
|||||||
if (ret != SOFTBUS_OK) {
|
if (ret != SOFTBUS_OK) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int32_t channel = -1;
|
|
||||||
bool is5GBand = false;
|
|
||||||
bool isConnected = false;
|
|
||||||
if (GetWlanLinkedAttribute(&channel, &is5GBand, &isConnected) != SOFTBUS_OK) {
|
|
||||||
LNN_LOGE(LNN_LANE, "get wlan attr info fail");
|
|
||||||
}
|
|
||||||
if (!isConnected) {
|
|
||||||
LNN_LOGE(LNN_LANE, "wlan is disconnected");
|
|
||||||
}
|
|
||||||
linkInfo->type = reqInfo->linkType;
|
linkInfo->type = reqInfo->linkType;
|
||||||
WlanLinkInfo *wlan = &(linkInfo->linkInfo.wlan);
|
WlanLinkInfo *wlan = &(linkInfo->linkInfo.wlan);
|
||||||
wlan->channel = channel;
|
wlan->channel = -1;
|
||||||
wlan->bw = LANE_BW_RANDOM;
|
wlan->bw = LANE_BW_RANDOM;
|
||||||
wlan->connInfo.protocol = protocol;
|
wlan->connInfo.protocol = protocol;
|
||||||
wlan->connInfo.port = port;
|
wlan->connInfo.port = port;
|
||||||
|
@ -359,15 +359,7 @@ static int32_t GetHmlScore(const char *networkId, uint32_t expectedBw)
|
|||||||
|
|
||||||
static int32_t GetLinkedChannelScore(void)
|
static int32_t GetLinkedChannelScore(void)
|
||||||
{
|
{
|
||||||
int32_t frequency = GetWlanLinkedFrequency();
|
int32_t channel = 0;
|
||||||
if (frequency <= 0) {
|
|
||||||
return LNN_LINK_DEFAULT_SCORE;
|
|
||||||
}
|
|
||||||
int32_t channel = SoftBusFrequencyToChannel(frequency);
|
|
||||||
if (channel < 0) {
|
|
||||||
LNN_LOGE(LNN_LANE, "get curr channel fail");
|
|
||||||
return LNN_LINK_DEFAULT_SCORE;
|
|
||||||
}
|
|
||||||
int32_t score = LnnGetCurrChannelScore(channel);
|
int32_t score = LnnGetCurrChannelScore(channel);
|
||||||
LNN_LOGI(LNN_LANE, "current channel=%{public}d, score=%{public}d", channel, score);
|
LNN_LOGI(LNN_LANE, "current channel=%{public}d, score=%{public}d", channel, score);
|
||||||
if (score <= 0) {
|
if (score <= 0) {
|
||||||
@ -529,8 +521,8 @@ static void DecideRetryLinks(const char *networkId, const LaneSelectParam *reque
|
|||||||
if (g_retryLaneList[bandWidthType][i] == LANE_LINK_TYPE_BUTT) {
|
if (g_retryLaneList[bandWidthType][i] == LANE_LINK_TYPE_BUTT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((CheckLaneValid(networkId, g_retryLaneList[bandWidthType][i], request->transType) == SOFTBUS_OK) &&
|
if (!IsLaneExist(linkList, g_retryLaneList[bandWidthType][i]) &&
|
||||||
!IsLaneExist(linkList, g_retryLaneList[bandWidthType][i])) {
|
(CheckLaneValid(networkId, g_retryLaneList[bandWidthType][i], request->transType) == SOFTBUS_OK)) {
|
||||||
linkList[(*linksNum)++] = g_retryLaneList[bandWidthType][i];
|
linkList[(*linksNum)++] = g_retryLaneList[bandWidthType][i];
|
||||||
LNN_LOGI(LNN_LANE, "decide retry linkType=%{public}d", g_retryLaneList[bandWidthType][i]);
|
LNN_LOGI(LNN_LANE, "decide retry linkType=%{public}d", g_retryLaneList[bandWidthType][i]);
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,6 @@ static void TransAsyncOpenChannelProc(uint32_t laneHandle, SessionParam *param,
|
|||||||
extra->osType = (appInfo->osType < 0) ? UNKNOW_OS_TYPE : appInfo->osType;
|
extra->osType = (appInfo->osType < 0) ? UNKNOW_OS_TYPE : appInfo->osType;
|
||||||
appInfo->connectType = connOpt.type;
|
appInfo->connectType = connOpt.type;
|
||||||
extra->linkType = connOpt.type;
|
extra->linkType = connOpt.type;
|
||||||
extra->deviceState = TransGetDeviceState(param->peerDeviceId);
|
|
||||||
FillAppInfo(appInfo, param, &transInfo, connInnerInfo);
|
FillAppInfo(appInfo, param, &transInfo, connInnerInfo);
|
||||||
TransOpenChannelSetModule(transInfo.channelType, &connOpt);
|
TransOpenChannelSetModule(transInfo.channelType, &connOpt);
|
||||||
TRANS_LOGI(TRANS_SVC, "laneHandle=%{public}u, channelType=%{public}u", laneHandle, transInfo.channelType);
|
TRANS_LOGI(TRANS_SVC, "laneHandle=%{public}u, channelType=%{public}u", laneHandle, transInfo.channelType);
|
||||||
|
Loading…
Reference in New Issue
Block a user