blob: 2815430f9d79b529d0255444c9d78f6dceb2b0e8 [file] [log] [blame]
San Mehat3c5a6f02009-05-22 15:36:13 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <stdio.h>
18
19#define LOG_TAG "SupplicantState"
20#include <cutils/log.h>
21
22#include "SupplicantState.h"
23
24char *SupplicantState::toString(int val, char *buffer, int max) {
25 if (val == SupplicantState::UNKNOWN)
San Mehatc4a895b2009-06-23 21:10:57 -070026 strncpy(buffer, "UNKNOWN", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070027 else if (val == SupplicantState::DISCONNECTED)
San Mehatc4a895b2009-06-23 21:10:57 -070028 strncpy(buffer, "DISCONNECTED", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070029 else if (val == SupplicantState::INACTIVE)
San Mehatc4a895b2009-06-23 21:10:57 -070030 strncpy(buffer, "INACTIVE", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070031 else if (val == SupplicantState::SCANNING)
San Mehatc4a895b2009-06-23 21:10:57 -070032 strncpy(buffer, "SCANNING", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070033 else if (val == SupplicantState::ASSOCIATING)
San Mehatc4a895b2009-06-23 21:10:57 -070034 strncpy(buffer, "ASSOCIATING", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070035 else if (val == SupplicantState::ASSOCIATED)
San Mehatc4a895b2009-06-23 21:10:57 -070036 strncpy(buffer, "ASSOCIATED", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070037 else if (val == SupplicantState::FOURWAY_HANDSHAKE)
San Mehatc4a895b2009-06-23 21:10:57 -070038 strncpy(buffer, "FOURWAY_HANDSHAKE", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070039 else if (val == SupplicantState::GROUP_HANDSHAKE)
San Mehatc4a895b2009-06-23 21:10:57 -070040 strncpy(buffer, "GROUP_HANDSHAKE", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070041 else if (val == SupplicantState::COMPLETED)
San Mehatc4a895b2009-06-23 21:10:57 -070042 strncpy(buffer, "COMPLETED", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070043 else if (val == SupplicantState::IDLE)
San Mehatc4a895b2009-06-23 21:10:57 -070044 strncpy(buffer, "IDLE", max);
San Mehat3c5a6f02009-05-22 15:36:13 -070045 else
46 strncpy(buffer, "(internal error)", max);
47
48 return buffer;
49}