5

We are developing a small App for Android to smoothly switch between two different wireless access points in the same network (same SSID and same network configuration but different physical locations), with the goal of not dropping existing connections after the handover is performed. I've been reading several posts here explaining how to control the wifi programmatically, and now we have a half working solution.

The way we implemented it, the service is scanning for the AP matching our criteria with best signal, and if it's different than the one the system is currently connected to, it will switch to the new AP. The relevant part of the code:

...
// Some initializations and bestOne is the ScanResult with the best signal
conf.BSSID = bestOne.BSSID;
actualNid = mWifiManager.updateNetwork(conf);
mWifiManager.enableNetwork(actualNid, false);
mWifiManager.saveConfiguration();
conf = getWifiConfiguration(mWifiManager, conf);
if(conf == null) {
    return;
}
if(!mWifiManager.enableNetwork(conf.networkId, true)) {
    return;
}
if (mWifiManager.reconnect()) {
    // Great
} else {
    // Error
}

The problem is that all the execution goes through the expected code path. However the handover is not really performed, the logs show as the reconnect is executed, and true is returned. Moreover there are no events received from any SUPPLICANT_CONNECTION_CHANGE_ACTION, or SUPPLICANT_STATE_CHANGED_ACTION, so it seems that the handover is not even triggered.

Another fact is that if we insert a mWifiManager.disconnect() before enabling the network the handover is actually performed. Nevertheless, this is not an option as the running apps lose connectivity, thus dropping the session, which is precisely what we want to avoid.

Any suggestion is more than welcome.

4

1 に答える 1

1

これは、ソフトウェア関連の問題だけではない可能性があります。通常、ネットワーク アダプター (wifi) は、信号レベルを追跡し、いつローミングするか、どこにローミングするかを決定します。これらのアルゴリズムはベンダー固有であり、それらに影響を与える方法がない場合があります。ローミングは、クライアントから 802.11 再関連付けフレーム (要求) を送信することによって行われ、ローミング プロセスは L2 レベルで行われます (シナリオでは)。しかし、そのプロセスはそれほど単純ではないかもしれません。両方の AP は、クライアントがローミングしたかどうかを認識する必要があり、これらの AP にフレームを送信するスイッチの CAM テーブルにその更新が含まれている必要があります。クライアントのローミング元の AP は、クライアント宛てのすべてのフレームをバッファリングし、クライアントが再関連付けされたときに新しい AP に送信することができ、データの損失は発生しません。これは 802 では要求されていないためです。

これはおそらく問題の解決に役立たないかもしれませんが、これは実際にはアプリケーション レベルではなく、下位レベル (物理、データ リンク、またはトランスポート) で実行する必要があることを指摘しようとしました。ローミングが事実上シームレスになるかどうかは、使用されるハードウェア (両側) とネットワークの構成の多くに依存し、それを変更するためにできることはあまりありません。心に浮かぶ唯一のことは、802.11 プローブ要求を送信して、クライアントがおそらくより強い信号を持つ他の AP を認識できるようにすることです。これは既にコードで行っており、ネットワーク アダプターにローミングするという決定を残しています。

于 2013-07-29T18:56:27.663 に答える