2 * Network Client Library
4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.1 (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.
20 #ifndef __NETWORK_WIFI_INTF_H__
21 #define __NETWORK_WIFI_INTF_H__
25 #include "network-cm-intf.h"
32 * @file network-wifi-intf.h
33 * @brief This file defines the Wi-Fi specific interface with the application/Connection Manager.
37 * \addtogroup wifi_specific
41 /*****************************************************************************
43 *****************************************************************************/
46 /*****************************************************************************
48 *****************************************************************************/
51 * @enum net_wifi_state_t
52 * This enum indicates wifi state
55 WIFI_UNKNOWN = 0x00, /** Unknown state */
56 WIFI_OFF = 0x01, /** Wi-Fi is Off */
57 WIFI_ON = 0x02, /** Wi-Fi is On(idle/failure) */
58 WIFI_ASSOCIATION = 0x03, /** Trying association */
59 WIFI_CONFIGURATION = 0x04, /** Trying configuration */
60 WIFI_CONNECTED = 0x05, /** Wi-Fi is connected */
61 WIFI_DISCONNECTING = 0x06, /** Trying to disconnect */
65 *@enum net_wifi_background_scan_mode_t
66 * This enum indicates background scanning mode.
69 /** scan cycle : 4, 8, 16, ...128s */
70 WIFI_BGSCAN_MODE_EXPONENTIAL = 0x00,
71 /** scan cycle : 10s */
72 WIFI_BGSCAN_MODE_PERIODIC,
73 } net_wifi_background_scan_mode_t;
76 *@enum net_wifi_wps_type_t
77 * This enum indicates WPS type.
81 /** WPS type is PBC */
83 /** WPS type is PIN */
85 } net_wifi_wps_type_t;
87 /*****************************************************************************
89 *****************************************************************************/
91 * This is the structure to connect with WPS network.
95 net_wifi_wps_type_t type;
97 /** Optional. This pin is needed when the user input PIN code */
98 char pin[NET_WLAN_MAX_WPSPIN_LEN + 1];
99 } net_wifi_wps_info_t;
102 * This is the profile structure to connect hidden WiFi network.
106 char essid[NET_WLAN_ESSID_LEN + 1];
108 /** Infrastructure / ad-hoc / auto mode */
109 wlan_connection_mode_type_t wlan_mode;
111 /** Security mode and authentication info */
112 wlan_security_info_t security_info;
114 /** Hidden network */
116 } net_wifi_connection_info_t;
118 struct ssid_scan_bss_info_t {
119 char ssid[NET_WLAN_ESSID_LEN + 1];
120 wlan_security_mode_type_t security;
124 struct wps_scan_bss_info_t {
125 unsigned char ssid[NET_WLAN_ESSID_LEN + 1];
126 char bssid[NET_WLAN_BSSID_LEN + 1];
131 /*****************************************************************************
133 *****************************************************************************/
136 /*****************************************************************************
138 *****************************************************************************/
141 /*****************************************************************************
142 * ConnMan Wi-Fi Client Interface Synchronous API Declaration
143 *****************************************************************************/
146 * @fn int net_get_wifi_state(net_wifi_state_t *current_state)
148 * This function requests current state of wifi.
150 * \par Sync (or) Async:
151 * These is a Synchronous API.
154 * @param[out] current_state Current wifi state
155 * @param[out] profile_name Profile name of current Wi-Fi state\n
156 * (valid for WIFI_ASSOCIATION, WIFI_CONFIGURATION,\n
157 * WIFI_CONNECTED, WIFI_DISCONNECTING state only)
158 * @return NET_ERR_NONE on success, negative values for errors
161 int net_get_wifi_state(net_wifi_state_t *current_state);
164 * @fn int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode)
166 * This function sends set background scan mode request to ConnMan daemon,
167 * with background scan mode - default/periodic/exponential
168 * Background scan trigger is restarted if the same mode is set again.
170 * \par Sync (or) Async:
171 * These is a Synchronous API.
173 * @param[in] scan_mode default/periodic/exponential
176 * @return NET_ERR_NONE on success, negative values for errors
179 int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode);
182 * @fn int net_specific_scan_wifi(const char *ssid)
184 * This function sends specific scan request to NetConfig daemon,
185 * with ssid - any AP name
187 * \par Sync (or) Async:
188 * This is Asynchronous API.
190 * @param[in] ssid Wi-Fi AP name
193 * @return NET_ERR_NONE on success, negative values for errors
196 int net_specific_scan_wifi(const char *ssid);
199 * @fn int net_get_wps_pin(void)
201 * This function get wps pin
203 * \par Sync (or) Async:
204 * This is an Synchronous API.
206 * @param[out] wps pin
208 * @return NET_ERR_NONE on success, negative values for errors
210 int net_get_wps_pin(char **wps_pin);
213 * @fn int net_wps_scan_wifi(void)
215 * This function sends scan request to NetConfig daemon,
217 * \par Sync (or) Async:
218 * This is Asynchronous API.
222 * @return NET_ERR_NONE on success, negative values for errors
225 int net_wps_scan_wifi(void);
228 * @fn int net_wifi_get_passpoint(int *enable)
230 * This function requests current passpoint on/off state to NetConfig daemon,
232 * \par Sync (or) Sync:
233 * This is Synchronous API.
236 * @param[out] enabled passpoint on(1)/off(0)
238 * @return NET_ERR_NONE on success, negative values for errors
241 int net_wifi_get_passpoint(int *enable);
244 * @fn int net_wifi_set_passpoint(int enable)
246 * This function sends passpoint on/off request to NetConfig daemon,
248 * \par Sync (or) Async:
249 * This is Asynchronous API.
251 * @param[in] enable passpoint on(1)/off(0)
254 * @return NET_ERR_NONE on success, negative values for errors
257 int net_wifi_set_passpoint(int enable);
261 * @fn int net_wifi_cancel_wps(void)
263 * This function stops ongoing WPS Provisioning / disconnects
264 * connected access point.
266 * \par Sync (or) Async:
267 * This is an Sync API.
272 * @return NET_ERR_NONE on success, negative values for errors
275 int net_wifi_cancel_wps(void);
278 /*****************************************************************************
279 * ConnMan Wi-Fi Client Interface Asynchronous Function Declaration
280 *****************************************************************************/
283 * @fn int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_info)
285 * This function requests Wi-Fi open connection. This should be used only for opening
286 * connection with hidden ap
288 * \par Sync (or) Async:
289 * This is an Asynchronous API.
291 * @param[in] wifi_info Pointer to connection information structure
294 * \par Async Response Message:
295 * NET_EVENT_OPEN_RSP: Connection Establishment response will be sent asynchronously to the App in the callback function registered.\n
296 * refer to net_event_cb_t()
298 * @return NET_ERR_NONE on success, negative values for errors
301 int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_info);
304 * @fn int net_scan_wifi(void)
306 * This function sends scan request to ConnMan daemon.\n
307 * You can receive scan completion response(NET_EVENT_WIFI_SCAN_RSP) via the callback function registered,\n
308 * and then get scan result by using net_get_profile_list().
310 *\par Sync (or) Async:
311 * This is an Asynchronous API.
316 * \par Async Response Message:
317 * NET_EVENT_WIFI_SCAN_RSP: Scan completion response will be sent asynchronously to the App in the callback function registered.\n
318 * refer to net_event_cb_t()
320 * @return NET_ERR_NONE on success, negative values for errors
323 int net_scan_wifi(void);
326 * @fn int net_wifi_power_on(gboolean wifi_picker_test)
328 * This function requests wifi power on.
330 * \par Sync (or) Async:
331 * This is an Asynchronous API.
333 * @param[in] wifi_picker_test whether wifi list popup(picker) display or not
336 * \par Async Response Message:
337 * NET_EVENT_WIFI_POWER_RSP: Wi-Fi Power on response will be sent asynchronously to the App in the callback function registered.\n
338 * refer to net_event_cb_t()
340 * @return NET_ERR_NONE on success, negative values for errors
343 int net_wifi_power_on(gboolean wifi_picker_test);
346 * @fn int net_wifi_power_off(void)
348 * This function requests wifi power off.
350 * \par Sync (or) Async:
351 * This is an Asynchronous API.
356 * \par Async Response Message:
357 * NET_EVENT_WIFI_POWER_RSP: Wi-Fi Power off response will be sent asynchronously to the App in the callback function registered.\n
358 * refer to net_event_cb_t()
360 * @return NET_ERR_NONE on success, negative values for errors
363 int net_wifi_power_off(void);
366 * @fn int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info)
368 * This function sends enroll wps request to ConnMan daemon,
369 * with profile name and wps information.
371 * \par Sync (or) Async:
372 * This is an Asynchronous API.
374 * @param[in] profile_name Profile Name to be connected
375 * @param[in] wps_info wps type and pin code for WPS PIN(optional)
378 * \par Async Response Message:
379 * NET_EVENT_WIFI_WPS_RSP : enroll wps response will be sent asynchronously to the App in the callback function registered.\n
380 * refer to net_event_cb_t()
382 * @return NET_ERR_NONE on success, negative values for errors
385 int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info);
388 * @fn int net_check_get_privilege()
390 * This function checks get privilege (dummy function).
392 * \par Sync (or) Async:
393 * This is an Synchronous API.
398 * @return NET_ERR_NONE on success, negative values for errors
401 int net_check_get_privilege(void);
404 * @fn int net_check_profile_privilege()
406 * This function checks get privilege (dummy function).
408 * \par Sync (or) Async:
409 * This is an Synchronous API.
414 * @return NET_ERR_NONE on success, negative values for errors
417 int net_check_profile_privilege(void);
421 * @fn int net_wifi_enroll_wps_without_ssid()
423 * This function sends enroll wps request to NetConfig daemon,
424 * with wps information.
426 * \par Sync (or) Async:
427 * This is an Asynchronous API.
429 * @param[in] wps_info wps type
432 * \par Async Response Message:
433 * NET_EVENT_WIFI_WPS_RSP : enroll wps response will be sent asynchronously to the App in the callback function registered.\n
434 * refer to net_event_cb_t()
436 * @return NET_ERR_NONE on success, negative values for errors
438 int net_wifi_enroll_wps_without_ssid(net_wifi_wps_info_t *wps_info);
442 int net_wifi_tdls_disconnect(const char* peer_mac_addr);
443 int net_wifi_tdls_connected_peer(char** peer_mac_addr);
445 int net_get_device_policy_wifi(void);
446 int net_get_device_policy_wifi_profile(void);
456 #endif /** __NETWORK_WIFI_INTF_H__ */