加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – DetailedState.VERIFYING_POOR_LINK代表什么

发布时间:2020-12-15 03:11:30 所属栏目:Java 来源:网络整理
导读:在Juice中,枚举DetailedState添加了一个名为的新状态 /** Link has poor connectivity. */ VERIFYING_POOR_LINK 但这个州的立场是什么? 搜索完整个项目后,我发现了这个: WifiStateMachine.java中的子类VerifyingLinkState class VerifyingLinkState extend
在Juice中,枚举DetailedState添加了一个名为的新状态
/** Link has poor connectivity. */
        VERIFYING_POOR_LINK

但这个州的立场是什么?

搜索完整个项目后,我发现了这个:

WifiStateMachine.java中的子类VerifyingLinkState

class VerifyingLinkState extends State {
    @Override
    public void enter() {
        if (DBG) log(getName() + "n");
        EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED,getName());
        setNetworkDetailedState(DetailedState.VERIFYING_POOR_LINK);
        mWifiConfigStore.updateStatus(mLastNetworkId,DetailedState.VERIFYING_POOR_LINK);
        sendNetworkStateChangeBroadcast(mLastBssid);
    }
    @Override
    public boolean processMessage(Message message) {
        switch (message.what) {
            case WifiWatchdogStateMachine.POOR_LINK_DETECTED:
                //stay here
                break;
            case WifiWatchdogStateMachine.GOOD_LINK_DETECTED:
                try {
                    mNwService.enableIpv6(mInterfaceName);
                } catch (RemoteException re) {
                    loge("Failed to enable IPv6: " + re);
                } catch (IllegalStateException e) {
                    loge("Failed to enable IPv6: " + e);
                }

                setNetworkDetailedState(DetailedState.CONNECTED);
                mWifiConfigStore.updateStatus(mLastNetworkId,DetailedState.CONNECTED);
                sendNetworkStateChangeBroadcast(mLastBssid);
                transitionTo(mConnectedState);
                break;
            default:
                return NOT_HANDLED;
        }
        return HANDLED;
    }
}

在验证链接状态时,在enter()函数中,它将DetailedState设置为

DetailedState.VERIFYING_POOR_LINK

当连接真的很好时,这将导致用户对如下图所示的状态消息感到困惑.

虽然此消息只停留一段时间,然后迅速替换为“已连接”.但这个州的目标是什么?如果我没有在enter()函数中将DetailedState设置为VERIFYING_POOR_LINK,会有什么风险.

解决方法

验证某些三星设备的VERIFYING_POOR_LINK是Wi-Fi智能网络交换机的一部分,如果出现状况不佳,可以允许移动数据通过Wi-Fi保持连接.对于三星设备,当您看到详细状态时,请从CONNECTED转到VERIFYING_POOR_LINK.

大多数逻辑可以在:http://androidxref.com/4.3_r2.1/xref/frameworks/base/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java中找到

WifiWatchdogStateMachine monitors the connection to a WiFi network. When WiFi
connects at L2 layer,the beacons from access point reach the device and it
can maintain a connection,but the application connectivity can be flaky (due
to bigger packet size exchange).

We now monitor the quality of the last hop on WiFi using packet loss ratio as
an indicator to decide if the link is good enough to switch to Wi-Fi as the uplink.

When WiFi is connected,the WiFi watchdog keeps sampling the RSSI and the
instant packet loss,and record it as per-AP loss-to-rssi statistics. When
the instant packet loss is higher than a threshold,the WiFi watchdog sends a
poor link notification to avoid WiFi connection temporarily.

While WiFi is being avoided,the WiFi watchdog keep watching the RSSI to
bring the WiFi connection back. Once the RSSI is high enough to achieve a
lower packet loss,a good link detection is sent such that the WiFi
connection become available again.

BSSID roaming has been taken into account. When user is moving across
multiple APs,the WiFi watchdog will detect that and keep watching the
currently connected AP.

Power impact should be minimal since much of the measurement relies on passive statistics already being tracked at the driver and the polling is done when screen is turned on and the RSSI is in a certain range.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读