Wrap all APIs to wifi-manager API
[platform/core/api/wifi.git] / src / net_wifi_private.c
1 /*
2  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd All Rights Reserved
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 "net_wifi_private.h"
18
19 wifi_error_e convert_to_wifi_error(wifi_manager_error_e error)
20 {
21         switch (error) {
22         case WIFI_MANAGER_ERROR_NONE:
23                 return WIFI_ERROR_NONE;
24         case WIFI_MANAGER_ERROR_INVALID_PARAMETER:
25                 return WIFI_ERROR_INVALID_PARAMETER;
26         case WIFI_MANAGER_ERROR_OUT_OF_MEMORY:
27                 return WIFI_ERROR_OUT_OF_MEMORY;
28         case WIFI_MANAGER_ERROR_INVALID_OPERATION:
29                 return WIFI_ERROR_INVALID_OPERATION;
30         case WIFI_MANAGER_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
31                 return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
32         case WIFI_MANAGER_ERROR_OPERATION_FAILED:
33                 return WIFI_ERROR_OPERATION_FAILED;
34         case WIFI_MANAGER_ERROR_NO_CONNECTION:
35                 return WIFI_ERROR_NO_CONNECTION;
36         case WIFI_MANAGER_ERROR_NOW_IN_PROGRESS:
37                 return WIFI_ERROR_NOW_IN_PROGRESS;
38         case WIFI_MANAGER_ERROR_ALREADY_EXISTS:
39                 return WIFI_ERROR_ALREADY_EXISTS;
40         case WIFI_MANAGER_ERROR_OPERATION_ABORTED:
41                 return WIFI_ERROR_OPERATION_ABORTED;
42         case WIFI_MANAGER_ERROR_DHCP_FAILED:
43                 return WIFI_ERROR_DHCP_FAILED;
44         case WIFI_MANAGER_ERROR_INVALID_KEY:
45                 return WIFI_ERROR_INVALID_KEY;
46         case WIFI_MANAGER_ERROR_NO_REPLY:
47                 return WIFI_ERROR_NO_REPLY;
48         case WIFI_MANAGER_ERROR_SECURITY_RESTRICTED:
49                 return WIFI_ERROR_SECURITY_RESTRICTED;
50         case WIFI_MANAGER_ERROR_PERMISSION_DENIED:
51                 return WIFI_ERROR_PERMISSION_DENIED;
52         case WIFI_MANAGER_ERROR_NOT_SUPPORTED:
53                 return WIFI_ERROR_NOT_SUPPORTED;
54         default:
55                 return WIFI_ERROR_OPERATION_FAILED;
56         }
57 }
58
59 wifi_security_type_e convert_to_wifi_security_type(wifi_manager_security_type_e type)
60 {
61         switch (type) {
62         case WIFI_MANAGER_SECURITY_TYPE_NONE:
63                 return WIFI_SECURITY_TYPE_NONE;
64         case WIFI_MANAGER_SECURITY_TYPE_WEP:
65                 return WIFI_SECURITY_TYPE_WEP;
66         case WIFI_MANAGER_SECURITY_TYPE_WPA_PSK:
67                 return WIFI_SECURITY_TYPE_WPA_PSK;
68         case WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK:
69                 return WIFI_SECURITY_TYPE_WPA2_PSK;
70         case WIFI_MANAGER_SECURITY_TYPE_EAP:
71                 return WIFI_SECURITY_TYPE_EAP;
72         default:
73                 return WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK;
74         }
75 }
76
77 wifi_eap_type_e convert_to_wifi_eap_type(wifi_manager_eap_type_e type)
78 {
79         switch (type) {
80         case WIFI_MANAGER_EAP_TYPE_PEAP:
81                 return WIFI_EAP_TYPE_PEAP;
82         case WIFI_MANAGER_EAP_TYPE_TLS:
83                 return WIFI_EAP_TYPE_TLS;
84         case WIFI_MANAGER_EAP_TYPE_TTLS:
85                 return WIFI_EAP_TYPE_TTLS;
86         case WIFI_MANAGER_EAP_TYPE_SIM:
87                 return WIFI_EAP_TYPE_SIM;
88         case WIFI_MANAGER_EAP_TYPE_AKA:
89         case WIFI_MANAGER_EAP_TYPE_AKA_PRIME:
90                 return WIFI_EAP_TYPE_AKA;
91         default:
92                 return WIFI_MANAGER_EAP_TYPE_PEAP;
93         }
94 }