Apply coding rule
[platform/core/api/wifi.git] / include / net_wifi_private.h
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 #ifndef __NET_CONNECTION_PRIVATE_H__
18 #define __NET_CONNECTION_PRIVATE_H__
19
20 #include <dlog.h>
21 #include <network-cm-intf.h>
22 #include <network-wifi-intf.h>
23 #include <system_info.h>
24
25 #include "wifi.h"
26 #include "wifi_dbus_private.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 #undef LOG_TAG
33 #define LOG_TAG "CAPI_NETWORK_WIFI"
34
35 #define WIFI_INFO       1
36 #define WIFI_ERROR      2
37 #define WIFI_WARN       3
38
39 #define WIFI_FEATURE    "http://tizen.org/feature/network.wifi"
40
41 #define CHECK_FEATURE_SUPPORTED(feature_name) \
42         do { \
43                 int rv = _wifi_check_feature_supported(feature_name); \
44                 if( rv != WIFI_ERROR_NONE ) \
45                         return rv; \
46         } while(0)
47
48 #define WIFI_LOG(log_level, format, args...) \
49         do { \
50                 switch (log_level) { \
51                 case WIFI_ERROR: \
52                         LOGE(format, ## args); \
53                         break; \
54                 case WIFI_WARN: \
55                         LOGW(format, ## args); \
56                         break; \
57                 default: \
58                         LOGI(format, ## args); \
59                 } \
60         } while(0)
61
62 #define SECURE_WIFI_LOG(log_level, format, args...) \
63         do { \
64                 switch (log_level) { \
65                 case WIFI_ERROR: \
66                         SECURE_LOGE(format, ## args); \
67                         break; \
68                 case WIFI_WARN: \
69                         SECURE_LOGW(format, ## args); \
70                         break; \
71                 default: \
72                         SECURE_LOGI(format, ## args); \
73                 } \
74         } while(0)
75
76 bool _wifi_is_init(void);
77
78 int _wifi_libnet_init(void);
79 bool _wifi_libnet_deinit(void);
80 int _wifi_activate(wifi_activated_cb callback, gboolean wifi_picker_test, void *user_data);
81 int _wifi_deactivate(wifi_deactivated_cb callback, void *user_data);
82
83 bool _wifi_libnet_check_ap_validity(wifi_ap_h ap_h);
84 void _wifi_libnet_add_to_ap_list(wifi_ap_h ap_h);
85 void _wifi_libnet_remove_from_ap_list(wifi_ap_h ap_h);
86 bool _wifi_libnet_check_profile_name_validity(const char *profile_name);
87
88 int _wifi_libnet_get_wifi_device_state(wifi_device_state_e *device_state);
89 int _wifi_libnet_get_wifi_state(wifi_connection_state_e* connection_state);
90 int _wifi_libnet_get_intf_name(char** name);
91 int _wifi_libnet_scan_request(wifi_scan_finished_cb callback, void *user_data);
92 int _wifi_libnet_scan_specific_ap(const char *essid, wifi_scan_finished_cb callback, void *user_data);
93 int _wifi_libnet_get_connected_profile(wifi_ap_h *ap);
94 int _wifi_libnet_foreach_found_aps(wifi_found_ap_cb callback, void *user_data);
95 int _wifi_libnet_foreach_found_specific_aps(wifi_found_ap_cb callback, void *user_data);
96
97 int _wifi_libnet_open_profile(wifi_ap_h ap_h, wifi_connected_cb callback, void *user_data);
98 int _wifi_libnet_close_profile(wifi_ap_h ap_h, wifi_disconnected_cb callback, void *user_data);
99 int _wifi_libnet_connect_with_wps_pbc(wifi_ap_h ap,
100                 wifi_connected_cb callback, void *user_data);
101 int _wifi_libnet_connect_with_wps_pin(wifi_ap_h ap, const char *pin,
102                 wifi_connected_cb callback, void *user_data);
103 int _wifi_libnet_forget_ap(wifi_ap_h ap);
104
105 int _wifi_set_power_on_off_cb(wifi_device_state_changed_cb callback, void *user_data);
106 int _wifi_unset_power_on_off_cb(void);
107 int _wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void *user_data);
108 int _wifi_unset_background_scan_cb(void);
109 int _wifi_set_connection_state_cb(wifi_connection_state_changed_cb callback, void *user_data);
110 int _wifi_unset_connection_state_cb();
111
112 int _wifi_update_ap_info(net_profile_info_t *ap_info);
113 wifi_connection_state_e _wifi_convert_to_ap_state(net_state_type_t state);
114
115 guint _wifi_callback_add(GSourceFunc func, gpointer user_data);
116 void _wifi_callback_cleanup(void);
117
118 int _wifi_check_feature_supported(const char *feature_name);
119
120 int        _wifi_dbus_init(void);
121 int        _wifi_dbus_deinit(void);
122 wifi_dbus *_wifi_get_dbus_handle(void);
123
124 #ifdef __cplusplus
125 }
126 #endif /* __cplusplus */
127
128 #endif