2009-05-23 06:36:13 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define LOG_TAG "SupplicantState"
|
|
|
|
#include <cutils/log.h>
|
|
|
|
|
|
|
|
#include "SupplicantState.h"
|
|
|
|
|
|
|
|
char *SupplicantState::toString(int val, char *buffer, int max) {
|
|
|
|
if (val == SupplicantState::UNKNOWN)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "UNKNOWN", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::DISCONNECTED)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "DISCONNECTED", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::INACTIVE)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "INACTIVE", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::SCANNING)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "SCANNING", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::ASSOCIATING)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "ASSOCIATING", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::ASSOCIATED)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "ASSOCIATED", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::FOURWAY_HANDSHAKE)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "FOURWAY_HANDSHAKE", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::GROUP_HANDSHAKE)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "GROUP_HANDSHAKE", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::COMPLETED)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "COMPLETED", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else if (val == SupplicantState::IDLE)
|
2009-06-24 12:10:57 +08:00
|
|
|
strncpy(buffer, "IDLE", max);
|
2009-05-23 06:36:13 +08:00
|
|
|
else
|
|
|
|
strncpy(buffer, "(internal error)", max);
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|