nexus: Fix SupplicantStatus decoding
Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
parent
052403ebbe
commit
d0290eadc5
1 changed files with 26 additions and 7 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define LOG_TAG "SupplicantState"
|
#define LOG_TAG "SupplicantStatus"
|
||||||
#include <cutils/log.h>
|
#include <cutils/log.h>
|
||||||
|
|
||||||
#include "SupplicantStatus.h"
|
#include "SupplicantStatus.h"
|
||||||
|
|
@ -52,18 +52,37 @@ SupplicantStatus *SupplicantStatus::createStatus(char *data, int len) {
|
||||||
char *next = data;
|
char *next = data;
|
||||||
char *line;
|
char *line;
|
||||||
while((line = strsep(&next, "\n"))) {
|
while((line = strsep(&next, "\n"))) {
|
||||||
char *token = strsep(&next, "=");
|
char *line_next = line;
|
||||||
char *value = strsep(&next, "=");
|
char *token = strsep(&line_next, "=");
|
||||||
|
char *value = strsep(&line_next, "=");
|
||||||
if (!strcmp(token, "bssid"))
|
if (!strcmp(token, "bssid"))
|
||||||
bssid = strdup(value);
|
bssid = strdup(value);
|
||||||
else if (!strcmp(token, "ssid"))
|
else if (!strcmp(token, "ssid"))
|
||||||
ssid = strdup(value);
|
ssid = strdup(value);
|
||||||
else if (!strcmp(token, "id"))
|
else if (!strcmp(token, "id"))
|
||||||
id = atoi(value);
|
id = atoi(value);
|
||||||
else if (!strcmp(token, "wpa_state"))
|
else if (!strcmp(token, "wpa_state")) {
|
||||||
state = atoi(value);
|
if (!strcmp(value, "DISCONNECTED"))
|
||||||
else
|
state = SupplicantState::DISCONNECTED;
|
||||||
|
else if (!strcmp(value, "INACTIVE"))
|
||||||
|
state = SupplicantState::INACTIVE;
|
||||||
|
else if (!strcmp(value, "SCANNING"))
|
||||||
|
state = SupplicantState::SCANNING;
|
||||||
|
else if (!strcmp(value, "ASSOCIATING"))
|
||||||
|
state = SupplicantState::ASSOCIATING;
|
||||||
|
else if (!strcmp(value, "ASSOCIATED"))
|
||||||
|
state = SupplicantState::ASSOCIATED;
|
||||||
|
else if (!strcmp(value, "FOURWAY_HANDSHAKE"))
|
||||||
|
state = SupplicantState::FOURWAY_HANDSHAKE;
|
||||||
|
else if (!strcmp(value, "GROUP_HANDSHAKE"))
|
||||||
|
state = SupplicantState::GROUP_HANDSHAKE;
|
||||||
|
else if (!strcmp(value, "COMPLETED"))
|
||||||
|
state = SupplicantState::COMPLETED;
|
||||||
|
else if (!strcmp(value, "IDLE"))
|
||||||
|
state = SupplicantState::IDLE;
|
||||||
|
else
|
||||||
|
LOGE("Unknown supplicant state '%s'", value);
|
||||||
|
} else
|
||||||
LOGD("Ignoring unsupported status token '%s'", token);
|
LOGD("Ignoring unsupported status token '%s'", token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue