tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Systeminfo / SystemInfoUtil.cpp
1 #include <system_settings.h>
2 #include <system_info.h>
3 #include <net_connection.h>
4
5 #ifdef FEATURE_OPTIONAL_WI_FI
6 #include <wifi.h>
7 #endif
8
9 #include <tapi_common.h>
10
11 #include "SystemInfoUtil.h"
12
13 namespace DeviceAPI {
14 namespace SystemInfo {
15
16 std::string SystemInfoUtil::getSystemInfoErrorMessage(const int errorCode)
17 {
18     switch (errorCode) {
19         case SYSTEM_INFO_ERROR_NONE:
20             return "";
21         case SYSTEM_INFO_ERROR_INVALID_PARAMETER:
22             return "Invalid parameter";
23         case SYSTEM_INFO_ERROR_OUT_OF_MEMORY:
24             return "Out of memory";
25         case SYSTEM_INFO_ERROR_IO_ERROR:
26             return "IO error";
27         case SYSTEM_INFO_ERROR_PERMISSION_DENIED:
28             return "Permission denied";
29         default:
30             return "Unknown Error";
31     }
32 }
33
34 std::string SystemInfoUtil::getConnectionErrorMessage(const int errorCode)
35 {
36     switch (errorCode) {
37         case CONNECTION_ERROR_INVALID_PARAMETER:
38             return "Invalid parameter";
39         case CONNECTION_ERROR_OUT_OF_MEMORY:
40             return "Out of memory";
41         case CONNECTION_ERROR_INVALID_OPERATION:
42             return "Invaild operation";
43         case CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
44             return "Address family not supported";
45         case CONNECTION_ERROR_OPERATION_FAILED:
46             return "Operation failed";
47         case CONNECTION_ERROR_ITERATOR_END:
48             return "Iterator end";
49         case CONNECTION_ERROR_NO_CONNECTION:
50             return "No connection";
51         case CONNECTION_ERROR_ALREADY_EXISTS:
52             return "Already exists";
53         case CONNECTION_ERROR_OPERATION_ABORTED:
54             return "Operation aborted";
55         case CONNECTION_ERROR_DHCP_FAILED:
56             return "DHCP failed";
57         case CONNECTION_ERROR_INVALID_KEY:
58             return "Invalid key";
59         case CONNECTION_ERROR_NO_REPLY:
60             return "No reply";
61         case CONNECTION_ERROR_PERMISSION_DENIED:
62             return "Permission denied";
63         case CONNECTION_ERROR_NOT_SUPPORTED:
64             return "Not supported";
65         default:
66             return "Unknown Error";
67     }
68 }
69
70 std::string SystemInfoUtil::getTapiErrorMessage(const int errorCode)
71 {
72     switch (errorCode) {
73         case TAPI_API_INVALID_INPUT:
74             return "Invaild input";
75         case TAPI_API_INVALID_PTR:
76             return "Invalid pointer";
77         case TAPI_API_NOT_SUPPORTED:
78             return "Not supported";
79         case TAPI_API_DEPRICATED:
80             return "Depricated";
81         case TAPI_API_SYSTEM_OUT_OF_MEM:
82             return "Out of memory";
83         case TAPI_API_SYSTEM_RPC_LINK_DOWN:
84             return "RPC link down";
85         case TAPI_API_SERVICE_NOT_READY:
86             return "Service not ready";
87         case TAPI_API_SERVER_FAILURE:
88             return "Service failure";
89         case TAPI_API_OEM_PLUGIN_FAILURE:
90             return "Plug-in layer failure";
91         case TAPI_API_TRANSPORT_LAYER_FAILURE:
92             return "Trasport layer failure";
93         case TAPI_API_INVALID_DATA_LEN:
94             return "Invalid data length";
95         case TAPI_API_REQUEST_MAX_IN_PROGRESS:
96             return "Maximum number of requests in progress";
97         case TAPI_API_OFFLINE_MODE_ERROR:
98             return "Offline mode error";
99         case TAPI_EVENT_CLASS_UNKNOWN:
100             return "Unknown event class";
101         case TAPI_EVENT_UNKNOWN:
102             return "Unknown event";
103         case TAPI_REGISTRATION_OP_FAILED:
104             return "Callback registration failed";
105         case TAPI_API_OPERATION_FAILED:
106             return "Operation failed";
107         case TAPI_API_INVALID_OPERATION:
108             return "Invalid operation";
109         case TAPI_API_ACCESS_DENIED:
110             return "Access denied";
111         case TAPI_API_SYSTEM_RPC_LINK_NOT_EST:
112             return "RPC link down";
113         case TAPI_API_API_NOT_SUPPORTED:
114             return "API not supported";
115         case TAPI_API_SERVER_LAYER_FAILURE:
116             return "Server layer failure";
117         case TAPI_API_INVALID_CALL_ID:
118             return "Invalid call id";
119         case TAPI_API_CALL_CTXT_OVERFLOW:
120             return "Call context overflow";
121         case TAPI_API_COULD_NOT_GET_CALL_CTXT:
122             return "Could not get the call context";
123         case TAPI_API_CTXT_SEARCH_RET_NON_CALL_CTXT:
124             return "Context search returned the non-call context ";
125         case TAPI_API_COULD_NOT_DESTROY_CTXT:
126             return "Could not destroy the context ";
127         case TAPI_API_INVALID_LINE_ID:
128             return "Invalid line ID";
129         case TAPI_API_INVALID_CALL_HANDLE:
130             return "Invalid call handle";
131         case TAPI_API_INVALID_CALL_STATE:
132             return "Invalid call state";
133         case TAPI_API_CALL_PRE_COND_FAILED:
134             return "Pre condition like MO call cannot be established now ";
135         case TAPI_API_CALL_SAME_REQ_PENDING:
136             return "Cannot accept the same request multiple times ";
137         case TAPI_API_MODEM_POWERED_OFF:
138             return "Modem is powered off ";
139         case TAPI_API_MODEM_ALREADY_ON:
140             return "Modem is already on ";
141         case TAPI_API_MODEM_ALREADY_OFF:
142             return "Modem is already off ";
143         case TAPI_API_NETTEXT_DEVICE_NOT_READY:
144             return "Nettext device is not ready ";
145         case TAPI_API_NETTEXT_SCADDR_NOT_SET:
146             return "Nettext SCA address is not set ";
147         case TAPI_API_NETTEXT_INVALID_DATA_LEN:
148             return "Nettext Invalid data length ";
149         case TAPI_NETTEXT_SCADDRESS_NOT_SET:
150             return "Nettext SCA address is not set ";
151         case TAPI_API_SIM_CARD_ERROR:
152             return "SIM general error";
153         case TAPI_API_SIM_NOT_FOUND:
154             return "SIM is not present";
155         case TAPI_API_SIM_NOT_INITIALIZED:
156             return "SIM has not initialized yet";
157         case TAPI_API_SIM_LOCKED:
158             return "PIN/PUK/NCK/NSCK/SPCK/CCK required state";
159         case TAPI_API_SIM_PERM_BLOCKED:
160             return "SIM Permanently blocked state";
161         case TAPI_API_SIM_SERVICE_IS_DISABLED:
162             return "Service is disabled in EF-SST due to a given operation";
163         case TAPI_API_SAT_INVALID_COMMAND_ID:
164             return "Command Number Invalid";
165         case TAPI_API_SAT_COMMAND_TYPE_MISMATCH:
166             return "Command Type Mismatch";
167         case TAPI_API_SAT_EVENT_NOT_REQUIRED_BY_USIM:
168             return "Event Not Requested by the USIM";
169         case TAPI_API_NETWORK_INVALID_CTXT:
170             return "Network invalid context";
171         case TAPI_API_NETWORK_ROAMING_NOT_ALLOWED:
172             return "3GPP Attache reject cause 11";
173         case TAPI_API_MISC_RETURN_NULL:
174             return "3GPP Attache reject cause 13 MISC return NULL";
175         case TAPI_API_MISC_VALIDITY_ERROR:
176             return "MISC validity error";
177         case TAPI_API_MISC_INPUTPARM_ERROR:
178             return "MISC input parameter error";
179         case TAPI_API_MISC_OUTPARAM_NULL:
180             return "MISC output parameter NULL";
181         default:
182             return "Unknown Error";
183     }
184 }
185
186 std::string SystemInfoUtil::getSettingErrorMessage(const int errorCode)
187 {
188     switch (errorCode) {
189         case SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER:
190             return "Invalid parameter";
191         case SYSTEM_SETTINGS_ERROR_OUT_OF_MEMORY:
192             return "Out of memory";
193         case SYSTEM_SETTINGS_ERROR_IO_ERROR:
194             return "IO error";
195         case SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED:
196             return "Permission denied";
197         case SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE:
198             return "Current lock screen app set password type";
199         default:
200             return "Unknown Error";
201     }
202 }
203
204 #ifdef FEATURE_OPTIONAL_WI_FI
205 std::string SystemInfoUtil::getWIFIErrorMessage(const int errorCode)
206 {
207     switch (errorCode) {
208         case WIFI_ERROR_INVALID_PARAMETER:
209             return "Invalid parameter";
210         case WIFI_ERROR_OUT_OF_MEMORY:
211             return "Out of memory";
212         case WIFI_ERROR_INVALID_OPERATION:
213             return "Invalid operation";
214         case WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
215             return "Address family not supported";
216         case WIFI_ERROR_OPERATION_FAILED:
217             return "Operation failed";
218         case WIFI_ERROR_NO_CONNECTION:
219             return "No connection";
220         case WIFI_ERROR_NOW_IN_PROGRESS:
221             return "Now in progress";
222         case WIFI_ERROR_ALREADY_EXISTS:
223             return "Already exists";
224         case WIFI_ERROR_OPERATION_ABORTED:
225             return "Operation aborted";
226         case WIFI_ERROR_DHCP_FAILED:
227             return "DHCP failed";
228         case WIFI_ERROR_INVALID_KEY:
229             return "Invalid key";
230         case WIFI_ERROR_NO_REPLY:
231             return "No reply";
232         case WIFI_ERROR_SECURITY_RESTRICTED:
233             return "Security restricted";
234         case WIFI_ERROR_PERMISSION_DENIED:
235             return "Permission denied";
236         default:
237             return "Unknown Error";
238     }
239 }
240 #endif
241
242 }
243 //SystemInfo
244 }//DeviceAPI