2 * Network Client Library
4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #ifndef __NETWORK_WIFI_INTF_H_
22 #define __NETWORK_WIFI_INTF_H_
29 * @file network-wifi-intf.h
30 * @brief This file defines the Wi-Fi specific interface with the application/Connection Manager.
34 * \addtogroup wifi_specific
37 /*****************************************************************************
39 *****************************************************************************/
41 /*****************************************************************************
43 *****************************************************************************/
45 #include "network-pm-wlan.h"
46 #include "network-cm-intf.h"
48 /*****************************************************************************
50 *****************************************************************************/
53 /*****************************************************************************
55 *****************************************************************************/
58 * @enum net_wifi_state_t
59 * This enum indicates wifi state
66 /** Wi-Fi is On(idle/failure) */
68 /** Trying to connect(association/configuration) */
70 /** Wi-Fi is connected to an AP(ready/online) */
72 /** Trying to disconnect(connected, but disconnecting process is on going) */
77 *@enum net_wifi_background_scan_mode_t
78 * This enum indicates background scanning mode.
81 /** scan cycle : 4, 8, 16, ...128s */
82 WIFI_BGSCAN_MODE_EXPONENTIAL = 0x00,
83 /** scan cycle : 10s */
84 WIFI_BGSCAN_MODE_PERIODIC,
85 } net_wifi_background_scan_mode_t;
88 *@enum net_wifi_wps_type_t
89 * This enum indicates WPS type.
93 /** WPS type is PBC */
95 /** WPS type is PIN */
97 } net_wifi_wps_type_t;
99 /*****************************************************************************
101 *****************************************************************************/
104 * This is the structure to connect with WPS network.
108 net_wifi_wps_type_t type;
110 /** Optional. This pin is needed when the user input PIN code */
111 char pin[NET_WLAN_MAX_WPSPIN_LEN + 1];
112 } net_wifi_wps_info_t;
115 * This is the profile structure to connect hidden WiFi network.
119 char essid[NET_WLAN_ESSID_LEN + 1];
121 /** Infrastructure / ad-hoc / auto mode */
122 wlan_connection_mode_type_t wlan_mode;
124 /** Security mode and authentication info */
125 wlan_security_info_t security_info;
126 } net_wifi_connection_info_t;
128 /*****************************************************************************
130 *****************************************************************************/
133 /*****************************************************************************
135 *****************************************************************************/
138 /*****************************************************************************
139 * ConnMan Wi-Fi Client Interface Synchronous API Declaration
140 *****************************************************************************/
144 * @fn int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_name_t *profile_name)
146 * This function requests current state of wifi.
148 * \par Sync (or) Async:
149 * These is a Synchronous API.
152 * @param[out] current_state Current wifi state
153 * @param[out] profile_name Profile name of current Wi-Fi state\n
154 * (valid for WIFI_CONNECTING, WIFI_CONNECTED, WIFI_DISCONNECTING state only)
156 * @return NET_ERR_NONE on success, negative values for errors
159 int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_name_t *profile_name);
163 * @fn int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode)
165 * This function sends set background scan mode request to ConnMan daemon,
166 * with background scan mode - default/periodic/exponential
167 * Background scan trigger is restarted if the same mode is set again.
169 * \par Sync (or) Async:
170 * These is a Synchronous API.
172 * @param[in] scan_mode default/periodic/exponential
175 * @return NET_ERR_NONE on success, negative values for errors
178 int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode);
181 * @fn int net_specific_scan_wifi(const char *ssid)
183 * This function sends specific scan request to NetConfig daemon,
184 * with ssid - any AP name
186 * \par Sync (or) Async:
187 * This is Asynchronous API.
189 * @param[in] ssid Wi-Fi AP name
192 * @return NET_ERR_NONE on success, negative values for errors
195 int net_specific_scan_wifi(const char *ssid);
197 /*****************************************************************************
198 * ConnMan Wi-Fi Client Interface Asynchronous Function Declaration
199 *****************************************************************************/
202 * @fn int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_info)
204 * This function requests Wi-Fi open connection. This should be used only for opening
205 * connection with hidden ap
207 * \par Sync (or) Async:
208 * This is an Asynchronous API.
210 * @param[in] wifi_info Pointer to connection information structure
213 * \par Async Response Message:
214 * NET_EVENT_OPEN_RSP: Connection Establishment response will be sent asynchronously to the App in the callback function registered.\n
215 * refer to net_event_cb_t()
217 * @return NET_ERR_NONE on success, negative values for errors
220 int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_info);
224 * @fn int net_scan_wifi(void)
226 * This function sends scan request to ConnMan daemon.\n
227 * You can receive scan completion response(NET_EVENT_WIFI_SCAN_RSP) via the callback function registered,\n
228 * and then get scan result by using net_get_profile_list().
230 *\par Sync (or) Async:
231 * This is an Asynchronous API.
236 * \par Async Response Message:
237 * NET_EVENT_WIFI_SCAN_RSP: Scan completion response will be sent asynchronously to the App in the callback function registered.\n
238 * refer to net_event_cb_t()
240 * @return NET_ERR_NONE on success, negative values for errors
243 int net_scan_wifi(void);
247 * @fn int net_wifi_power_on(void)
249 * This function requests wifi power on.
251 * \par Sync (or) Async:
252 * This is an Asynchronous API.
257 * \par Async Response Message:
258 * NET_EVENT_WIFI_POWER_RSP: Wi-Fi Power on response will be sent asynchronously to the App in the callback function registered.\n
259 * refer to net_event_cb_t()
261 * @return NET_ERR_NONE on success, negative values for errors
264 int net_wifi_power_on(void);
268 * @fn int net_wifi_power_off(void)
270 * This function requests wifi power off.
272 * \par Sync (or) Async:
273 * This is an Asynchronous API.
278 * \par Async Response Message:
279 * NET_EVENT_WIFI_POWER_RSP: Wi-Fi Power off response will be sent asynchronously to the App in the callback function registered.\n
280 * refer to net_event_cb_t()
282 * @return NET_ERR_NONE on success, negative values for errors
285 int net_wifi_power_off(void);
289 * @fn int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info)
291 * This function sends enroll wps request to ConnMan daemon,
292 * with profile name and wps information.
294 * \par Sync (or) Async:
295 * This is an Asynchronous API.
297 * @param[in] profile_name Profile Name to be connected
298 * @param[in] wps_info wps type and pin code for WPS PIN(optional)
301 * \par Async Response Message:
302 * NET_EVENT_WIFI_WPS_RSP : enroll wps response will be sent asynchronously to the App in the callback function registered.\n
303 * refer to net_event_cb_t()
305 * @return NET_ERR_NONE on success, negative values for errors
308 int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info);
319 #endif /** __NETWORK_WIFI_INTF_H_ */