diff options
author | Mike Lockwood <lockwood@android.com> | 2009-06-09 20:45:25 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2009-06-09 21:12:53 -0400 |
commit | 56c59da434354e1efaebbd0e5c135814605f9842 (patch) | |
tree | 67ce45e5f0c89e057ff60566bb744bb242268fe8 /wifi/java/android/net | |
parent | dfe482c9b5b16fca375b30c47185fc415c71d4e8 (diff) | |
download | frameworks_base-56c59da434354e1efaebbd0e5c135814605f9842.zip frameworks_base-56c59da434354e1efaebbd0e5c135814605f9842.tar.gz frameworks_base-56c59da434354e1efaebbd0e5c135814605f9842.tar.bz2 |
WifiStateTracker: Add support for positive RSSI values.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index 7e95f79..f84bccc 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -1333,9 +1333,12 @@ public class WifiStateTracker extends NetworkStateTracker { */ private synchronized void requestPolledInfo(WifiInfo info, boolean polling) { - int newRssi = (polling ? WifiNative.getRssiApproxCommand(): - WifiNative.getRssiCommand()); - if (newRssi != -1 && -200 < newRssi && newRssi < 100) { // screen out invalid values + int newRssi = WifiNative.getRssiCommand(); + if (newRssi != -1 && -200 < newRssi && newRssi < 256) { // screen out invalid values + /* some implementations avoid negative values by adding 256 + * so we need to adjust for that here. + */ + if (newRssi > 0) newRssi -= 256; info.setRssi(newRssi); /* * Rather then sending the raw RSSI out every time it |