am 8fc5a63d: Merge change 2431 into donut

Merge commit '8fc5a63d422fd32258dc18fe0e635b4f1486fd61'

* commit '8fc5a63d422fd32258dc18fe0e635b4f1486fd61':
  wifi: Fix problem parsing RSSI when the AP name contains a space.
This commit is contained in:
Android (Google) Code Review
2009-05-26 10:11:36 -07:00
committed by The Android Open Source Project

View File

@@ -317,8 +317,13 @@ static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz)
}
// reply comes back in the form "<SSID> rssi XX" where XX is the
// number we're interested in. if we're associating, it returns "OK".
// beware - <SSID> can contain spaces.
if (strcmp(reply, "OK") != 0) {
sscanf(reply, "%*s %*s %d", &rssi);
char* lastSpace = strrchr(reply, ' ');
// lastSpace should be preceded by "rssi" and followed by the value
if (lastSpace && !strncmp(lastSpace - 4, "rssi", 4)) {
sscanf(lastSpace + 1, "%d", &rssi);
}
}
return (jint)rssi;
}