• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Révisiond0290eadc563f5a34fc1969f91621860d8756eff (tree)
l'heure2009-06-17 04:01:50
AuteurSan Mehat <san@goog...>
CommiterSan Mehat

Message de Log

nexus: Fix SupplicantStatus decoding

Signed-off-by: San Mehat <san@google.com>

Change Summary

Modification

--- a/nexus/SupplicantStatus.cpp
+++ b/nexus/SupplicantStatus.cpp
@@ -17,7 +17,7 @@
1717 #include <stdlib.h>
1818 #include <string.h>
1919
20-#define LOG_TAG "SupplicantState"
20+#define LOG_TAG "SupplicantStatus"
2121 #include <cutils/log.h>
2222
2323 #include "SupplicantStatus.h"
@@ -52,18 +52,37 @@ SupplicantStatus *SupplicantStatus::createStatus(char *data, int len) {
5252 char *next = data;
5353 char *line;
5454 while((line = strsep(&next, "\n"))) {
55- char *token = strsep(&next, "=");
56- char *value = strsep(&next, "=");
57-
55+ char *line_next = line;
56+ char *token = strsep(&line_next, "=");
57+ char *value = strsep(&line_next, "=");
5858 if (!strcmp(token, "bssid"))
5959 bssid = strdup(value);
6060 else if (!strcmp(token, "ssid"))
6161 ssid = strdup(value);
6262 else if (!strcmp(token, "id"))
6363 id = atoi(value);
64- else if (!strcmp(token, "wpa_state"))
65- state = atoi(value);
66- else
64+ else if (!strcmp(token, "wpa_state")) {
65+ if (!strcmp(value, "DISCONNECTED"))
66+ state = SupplicantState::DISCONNECTED;
67+ else if (!strcmp(value, "INACTIVE"))
68+ state = SupplicantState::INACTIVE;
69+ else if (!strcmp(value, "SCANNING"))
70+ state = SupplicantState::SCANNING;
71+ else if (!strcmp(value, "ASSOCIATING"))
72+ state = SupplicantState::ASSOCIATING;
73+ else if (!strcmp(value, "ASSOCIATED"))
74+ state = SupplicantState::ASSOCIATED;
75+ else if (!strcmp(value, "FOURWAY_HANDSHAKE"))
76+ state = SupplicantState::FOURWAY_HANDSHAKE;
77+ else if (!strcmp(value, "GROUP_HANDSHAKE"))
78+ state = SupplicantState::GROUP_HANDSHAKE;
79+ else if (!strcmp(value, "COMPLETED"))
80+ state = SupplicantState::COMPLETED;
81+ else if (!strcmp(value, "IDLE"))
82+ state = SupplicantState::IDLE;
83+ else
84+ LOGE("Unknown supplicant state '%s'", value);
85+ } else
6786 LOGD("Ignoring unsupported status token '%s'", token);
6887 }
6988