b6c2e30b9d2fabdcb21cc6c1d3dc041497167dd4
[platform/core/connectivity/libwifi-direct.git] / src / wifi-direct-utils.c
1 /*
2  * libwifi-direct
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com> 
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdbool.h>
25 #include <errno.h>
26 #include <sys/time.h>
27
28 #define _GNU_SOURCE
29 #include <unistd.h>
30 #include <sys/syscall.h>
31
32 #include "wifi-direct.h"
33 #include "wifi-direct-client-proxy.h"
34 #include "wifi-direct-internal.h"
35
36
37 char *wfd_print_state(wifi_direct_state_e s)
38 {
39         switch (s)
40         {
41         case WIFI_DIRECT_STATE_DEACTIVATED:
42                 return "DEACTIVATED";
43                 break;
44
45         case WIFI_DIRECT_STATE_DEACTIVATING:
46                 return "DEACTIVATING";
47                 break;
48         case WIFI_DIRECT_STATE_ACTIVATING:
49                 return "ACTIVATING";
50                 break;
51         case WIFI_DIRECT_STATE_ACTIVATED:
52                 return "ACTIVATED";
53                 break;
54         case WIFI_DIRECT_STATE_DISCOVERING:
55                 return "DISCOVERING";
56                 break;
57         case WIFI_DIRECT_STATE_CONNECTING:
58                 return "CONNECTING";
59                 break;
60         case WIFI_DIRECT_STATE_DISCONNECTING:
61                 return "DISCONNECTING";
62                 break;
63         case WIFI_DIRECT_STATE_CONNECTED:
64                 return "CONNECTED";
65                 break;
66         case WIFI_DIRECT_STATE_GROUP_OWNER:
67                 return "GROUP OWNER";
68                 break;
69         default:
70                 return "Unknown";
71         }
72 }