blob: a16d3709ece259301fd3bf1aa22938e4cc719e04 [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)
26 strncpy(buffer, "Unknown", max);
27 else if (val == SupplicantState::DISCONNECTED)
28 strncpy(buffer, "Disconnected", max);
29 else if (val == SupplicantState::INACTIVE)
30 strncpy(buffer, "Inactive", max);
31 else if (val == SupplicantState::SCANNING)
32 strncpy(buffer, "Scanning", max);
33 else if (val == SupplicantState::ASSOCIATING)
34 strncpy(buffer, "Associating", max);
35 else if (val == SupplicantState::ASSOCIATED)
36 strncpy(buffer, "Associated", max);
37 else if (val == SupplicantState::FOURWAY_HANDSHAKE)
38 strncpy(buffer, "Fourway Handshake", max);
39 else if (val == SupplicantState::GROUP_HANDSHAKE)
40 strncpy(buffer, "Group Handshake", max);
41 else if (val == SupplicantState::COMPLETED)
42 strncpy(buffer, "Completed", max);
43 else if (val == SupplicantState::IDLE)
44 strncpy(buffer, "Idle", max);
45 else
46 strncpy(buffer, "(internal error)", max);
47
48 return buffer;
49}