2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_NETWORK_TETHERING_H__
18 #define __TIZEN_NETWORK_TETHERING_H__
32 * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
37 * @brief The tethering handle.
40 typedef void * tethering_h;
43 * @brief Enumeration for the tethering.
47 TETHERING_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
48 TETHERING_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */
49 TETHERING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
50 TETHERING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
51 TETHERING_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Resource busy */
52 TETHERING_ERROR_NOT_ENABLED = TIZEN_ERROR_TETHERING | 0x0501, /**< Not enabled */
53 TETHERING_ERROR_OPERATION_FAILED = TIZEN_ERROR_TETHERING | 0x0502, /**< Operation failed */
54 TETHERING_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
55 TETHERING_ERROR_NOT_SUPPORT_API = TIZEN_ERROR_NOT_SUPPORTED, /**< API is not supported */
56 TETHERING_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
60 * @brief Enumeration for the type of tethering.
64 TETHERING_TYPE_ALL = 0, /**< All type except for TETHERING_TYPE_RESERVED */
65 TETHERING_TYPE_USB, /**< USB type */
66 TETHERING_TYPE_WIFI, /**< Wi-Fi type */
67 TETHERING_TYPE_BT, /**< BT type */
68 TETHERING_TYPE_RESERVED, /**< Reserved type */
72 * @brief Enumeration for the cause of disabling the tethering.
77 TETHERING_DISABLED_BY_USB_DISCONNECTION = 0, /**< Disabled due to usb disconnection */
78 TETHERING_DISABLED_BY_FLIGHT_MODE, /**< Disabled due to flight mode */
79 TETHERING_DISABLED_BY_LOW_BATTERY, /**< Disabled due to low battery */
80 TETHERING_DISABLED_BY_NETWORK_CLOSE, /**< Disabled due to pdp network close */
81 TETHERING_DISABLED_BY_TIMEOUT, /**< Disabled due to timeout */
82 TETHERING_DISABLED_BY_OTHERS, /**< Disabled by other apps */
83 TETHERING_DISABLED_BY_REQUEST, /**< Disabled by your request */
84 TETHERING_DISABLED_BY_WIFI_ON, /**< Disabled due to Wi-Fi on */
85 TETHERING_DISABLED_BY_BT_OFF, /**< Disabled due to Bluetooth off */
86 } tethering_disabled_cause_e;
94 * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
99 * @brief Enumeration for the Wi-Fi security.
103 TETHERING_WIFI_SECURITY_TYPE_NONE = 0, /**< No Security type */
104 TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK, /**< WPA2_PSK */
105 } tethering_wifi_security_type_e;
113 * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
118 * @brief The tethering client handle.
121 typedef void * tethering_client_h;
124 * @brief Enumeration for address family.
128 TETHERING_ADDRESS_FAMILY_IPV4 = 0, /**< IPV4 Address type */
129 } tethering_address_family_e;
137 * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
142 * @brief Called when the tethering is enabled.
144 * @param[in] result The result of enabling the tethering
145 * @param[in] type The tethering type
146 * @param[in] is_requested Indicates whether this change is requested
147 * @param[in] user_data The user data passed from tethering_set_enabled_cb()
148 * @pre If you register callback function using tethering_set_enabled_cb(), this will be invoked when the tethering is enabled.
149 * @see tethering_enable()
150 * @see tethering_unset_enabled_cb()
152 typedef void (*tethering_enabled_cb)(tethering_error_e result, tethering_type_e type, bool is_requested, void *user_data);
155 * @brief Called when the tethering is disabled.
157 * @param[in] result The result of disabling the tethering
158 * @param[in] type The tethering type
159 * @param[in] cause The cause of disabling
160 * @param[in] user_data The user data passed from tethering_set_disabled_cb()
161 * @pre If you register callback function using tethering_set_disabled_cb(), this will be invoked when the tethering is disabled.
162 * @see tethering_set_disabled_cb()
163 * @see tethering_unset_disabled_cb()
165 typedef void (*tethering_disabled_cb)(tethering_error_e result, tethering_type_e type, tethering_disabled_cause_e cause, void *user_data);
168 * @brief Called when the connection state is changed.
170 * @remarks @a client is valid only in this function. In order to use it outside this function, a user must copy the client with tethering_client_clone().
171 * @param[in] client The client of which connection state is changed
172 * @param[in] opened @c true when connection is opened, otherwise false
173 * @param[in] user_data The user data passed from tethering_set_connection_state_changed_cb()
174 * @pre If you register callback function using tethering_set_connection_state_changed_cb(), this will be invoked when the connection state is changed.
175 * @see tethering_set_connection_state_changed_cb()
176 * @see tethering_unset_connection_state_changed_cb()
178 typedef void (*tethering_connection_state_changed_cb)(tethering_client_h client, bool opened, void *user_data);
181 * @brief Called when you get the connected client repeatedly.
183 * @remarks @a client is valid only in this function. In order to use the client outside this function, a user must copy the client with tethering_client_clone().
184 * @param[in] client The connected client
185 * @param[in] user_data The user data passed from the request function
186 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
187 * @pre tethering_foreach_connected_clients() will invoke this callback.
188 * @see tethering_foreach_connected_clients()
190 typedef bool(*tethering_connected_client_cb)(tethering_client_h client, void *user_data);
193 * @brief Called when you get the data usage.
195 * @param[in] result The result of getting the data usage
196 * @param[in] received_data The usage of received data
197 * @param[in] sent_data The usage of sent data
198 * @param[in] user_data The user data passed from the request function
199 * @pre tethering_get_data_usage() will invoked this callback.
201 typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long long received_data, unsigned long long sent_data, void *user_data);
204 * @brief Called when the security type of Wi-Fi tethering is changed.
206 * @param[in] changed_type The changed security type of Wi-Fi tethering
207 * @param[in] user_data The user data passed from the register function
208 * @see tethering_wifi_set_security_type_changed_cb()
209 * @see tethering_wifi_unset_security_type_changed_cb()
211 typedef void (*tethering_wifi_security_type_changed_cb)(tethering_wifi_security_type_e changed_type, void *user_data);
214 * @brief Called when the visibility of SSID is changed.
216 * @param[in] changed_visible The changed visibility of SSID
217 * @param[in] user_data The user data passed from the register function
218 * @see tethering_wifi_set_ssid_visibility_changed_cb()
219 * @see tethering_wifi_unset_ssid_visibility_changed_cb()
221 typedef void (*tethering_wifi_ssid_visibility_changed_cb)(bool changed_visible, void *user_data);
224 * @brief Called when the passphrase of Wi-Fi tethering is changed.
226 * @param[in] user_data The user data passed from the register function
227 * @see tethering_wifi_set_passphrase_changed_cb()
228 * @see tethering_wifi_unset_passphrase_changed_cb()
230 typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data);
233 * @brief Called when the settings are reloaded.
235 * @param[in] result The result of reloading the settings
236 * @param[in] user_data The user data passed from the request function
237 * @pre tethering_wifi_reload_settings() will invoke this callback.
239 typedef void (*tethering_wifi_settings_reloaded_cb)(tethering_error_e result, void *user_data);
242 * @brief Called when Wi-Fi AP settings are reloaded.
244 * @param[in] result The result of reloading the settings
245 * @param[in] user_data The user data passed from the request function
246 * @pre tethering_wifi_ap_reload_settings() will invoke this callback.
248 typedef void (*tethering_wifi_ap_settings_reloaded_cb)(tethering_error_e result, void *user_data);
251 * @brief Creates the handle for tethering.
253 * @privlevel platform
254 * @privilege http://tizen.org/privilege/tethering.admin
255 * @remarks The @a tethering must be released using tethering_destroy().
256 * @param[out] tethering A handle of a new mobile ap handle on success
257 * @return 0 on success, otherwise a negative error value
258 * @retval #TETHERING_ERROR_NONE Successful
259 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
260 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
261 * @retval #TETHERING_ERROR_NOT_SUPPORT_API API is not supported
262 * @see tethering_destroy()
264 int tethering_create(tethering_h *tethering);
267 * @brief Destroys the handle for tethering.
269 * @privlevel platform
270 * @privilege http://tizen.org/privilege/tethering.admin
271 * @param[in] tethering The tethering handle
272 * @return 0 on success, otherwise a negative error value
273 * @retval #TETHERING_ERROR_NONE Successful
274 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
275 * @see tethering_create()
277 int tethering_destroy(tethering_h tethering);
280 * @brief Enables the tethering, asynchronously.
282 * @privlevel platform
283 * @privilege http://tizen.org/privilege/tethering.admin
284 * @param[in] tethering The tethering handle
285 * @param[in] type The tethering type
286 * @return 0 on success, otherwise negative error value
287 * @retval #TETHERING_ERROR_NONE Successful
288 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
289 * @post tethering_enabled_cb() will be invoked.
290 * @see tethering_is_enabled()
291 * @see tethering_disable()
293 int tethering_enable(tethering_h tethering, tethering_type_e type);
296 * @brief Disables the tethering, asynchronously.
298 * @privlevel platform
299 * @privilege http://tizen.org/privilege/tethering.admin
300 * @param[in] tethering The tethering handle
301 * @param[in] type The tethering type
302 * @return 0 on success, otherwise negative error value
303 * @retval #TETHERING_ERROR_NONE Successful
304 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
305 * @post tethering_disabled_cb() will be invoked.
306 * @see tethering_is_enabled()
307 * @see tethering_enable()
309 int tethering_disable(tethering_h tethering, tethering_type_e type);
312 * @brief Checks whether the tethering is enabled or not.
314 * @privlevel platform
315 * @privilege http://tizen.org/privilege/tethering.admin
316 * @param[in] tethering The tethering handle
317 * @param[in] type The tethering type
318 * @return @c true if tethering is enabled, \n @c false if tethering is disabled
320 bool tethering_is_enabled(tethering_h tethering, tethering_type_e type);
323 * @brief Gets the MAC address of local device as "FC:A1:3E:D6:B1:B1".
325 * @privlevel platform
326 * @privilege http://tizen.org/privilege/tethering.admin
327 * @remarks @a mac_address must be released using free().
328 * @param[in] tethering The tethering handle
329 * @param[in] type The tethering type
330 * @param[out] mac_address The MAC address
331 * @return 0 on success, otherwise a negative error value
332 * @retval #TETHERING_ERROR_NONE Successful
333 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
334 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
335 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
336 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
337 * @pre The tethering must be enabled.
338 * @see tethering_is_enabled()
339 * @see tethering_enable()
341 int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address);
344 * @brief Gets the name of network interface (e.g. usb0).
346 * @privlevel platform
347 * @privilege http://tizen.org/privilege/tethering.admin
348 * @remarks @a interface_name must be released using free().
349 * @param[in] tethering The tethering handle
350 * @param[in] type The tethering type
351 * @param[out] interface_name The name of the network interface
352 * @return 0 on success, otherwise negative error value
353 * @retval #TETHERING_ERROR_NONE Successful
354 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
355 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
356 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
357 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
358 * @pre The tethering must be enabled.
359 * @see tethering_is_enabled()
360 * @see tethering_enable()
362 int tethering_get_network_interface_name(tethering_h tethering, tethering_type_e type, char **interface_name);
365 * @brief Gets the local IP address.
367 * @privlevel platform
368 * @privilege http://tizen.org/privilege/tethering.admin
369 * @remarks @a ip_address must be released using free().
370 * @param[in] tethering The tethering handle
371 * @param[in] type The tethering type
372 * @param[in] address_family The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
373 * @param[out] ip_address The local IP address
374 * @return 0 on success, otherwise negative error value
375 * @retval #TETHERING_ERROR_NONE Successful
376 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
377 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
378 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
379 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
380 * @pre The tethering must be enabled.
381 * @see tethering_is_enabled()
382 * @see tethering_enable()
384 int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address);
387 * @brief Gets the Gateway address.
389 * @privlevel platform
390 * @privilege http://tizen.org/privilege/tethering.admin
391 * @remarks @a gateway_address must be released using free().
392 * @param[in] tethering The tethering handle
393 * @param[in] type The tethering type
394 * @param[in] address_family The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
395 * @param[out] gateway_address The local IP address
396 * @return 0 on success, otherwise negative error value
397 * @retval #TETHERING_ERROR_NONE Successful
398 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
399 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
400 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
401 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
402 * @pre The tethering must be enabled.
403 * @see tethering_is_enabled()
404 * @see tethering_enable()
406 int tethering_get_gateway_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **gateway_address);
409 * @brief Gets the Subnet Mask.
411 * @privlevel platform
412 * @privilege http://tizen.org/privilege/tethering.admin
413 * @remarks @a subnet_mask must be released using free().
414 * @param[in] tethering The tethering handle
415 * @param[in] type The tethering type
416 * @param[in] address_family The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
417 * @param[out] subnet_mask The local IP address
418 * @return 0 on success, otherwise negative error value
419 * @retval #TETHERING_ERROR_NONE Successful
420 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
421 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
422 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
423 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
424 * @pre The tethering must be enabled.
425 * @see tethering_is_enabled()
426 * @see tethering_enable()
428 int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **subnet_mask);
431 * @brief Gets the data usage.
433 * @privlevel platform
434 * @privilege http://tizen.org/privilege/tethering.admin
435 * @param[in] tethering The tethering handle
436 * @param[out] usage The data usage
437 * @return 0 on success, otherwise negative error value
438 * @retval #TETHERING_ERROR_NONE Successful
439 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
440 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
441 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
442 * @pre The tethering must be enabled.
443 * @see tethering_is_enabled()
444 * @see tethering_enable()
446 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
449 * @brief Gets the clients which are connected.
451 * @privlevel platform
452 * @privilege http://tizen.org/privilege/tethering.admin
453 * @param[in] tethering The tethering handle
454 * @param[in] type The tethering type
455 * @param[in] callback The callback function to invoke
456 * @param[in] user_data The user data to be passed to the callback function
457 * @retval #TETHERING_ERROR_NONE Successful
458 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
459 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
460 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
461 * @pre The tethering must be enabled.
462 * @see tethering_is_enabled()
463 * @see tethering_enable()
465 int tethering_foreach_connected_clients(tethering_h tethering, tethering_type_e type, tethering_connected_client_cb callback, void *user_data);
468 * @brief Registers the callback function, which is called when tethering is enabled.
470 * @privlevel platform
471 * @privilege http://tizen.org/privilege/tethering.admin
472 * @param[in] tethering The tethering handle
473 * @param[in] type The tethering type
474 * @param[in] callback The callback function to invoke
475 * @param[in] user_data The user data to be passed to the callback function
476 * @retval #TETHERING_ERROR_NONE Successful
477 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
478 * @see tethering_unset_enabled_cb()
480 int tethering_set_enabled_cb(tethering_h tethering, tethering_type_e type, tethering_enabled_cb callback, void *user_data);
483 * @brief Unregisters the callback function, which is called when tethering is enabled.
485 * @privlevel platform
486 * @privilege http://tizen.org/privilege/tethering.admin
487 * @param[in] tethering The tethering handle
488 * @param[in] type The tethering type
489 * @retval #TETHERING_ERROR_NONE Successful
490 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
491 * @see tethering_set_enabled_cb()
493 int tethering_unset_enabled_cb(tethering_h tethering, tethering_type_e type);
496 * @brief Registers the callback function called when tethering is disabled.
498 * @privlevel platform
499 * @privilege http://tizen.org/privilege/tethering.admin
500 * @param[in] tethering The tethering handle
501 * @param[in] type The tethering type
502 * @param[in] callback The callback function to invoke
503 * @param[in] user_data The user data to be passed to the callback function
504 * @retval #TETHERING_ERROR_NONE Successful
505 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
506 * @see tethering_unset_disabled_cb()
508 int tethering_set_disabled_cb(tethering_h tethering, tethering_type_e type, tethering_disabled_cb callback, void *user_data);
511 * @brief Unregisters the callback function, which is called when tethering is disabled.
513 * @privlevel platform
514 * @privilege http://tizen.org/privilege/tethering.admin
515 * @param[in] tethering The tethering handle
516 * @param[in] type The tethering type
517 * @retval #TETHERING_ERROR_NONE Successful
518 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
519 * @see tethering_set_disabled_cb()
521 int tethering_unset_disabled_cb(tethering_h tethering, tethering_type_e type);
524 * @brief Registers the callback function, which is called when the state of connection is changed.
526 * @privlevel platform
527 * @privilege http://tizen.org/privilege/tethering.admin
528 * @param[in] tethering The tethering handle
529 * @param[in] type The tethering type
530 * @param[in] callback The callback function to invoke
531 * @param[in] user_data The user data to be passed to the callback function
532 * @retval #TETHERING_ERROR_NONE Successful
533 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
534 * @see tethering_unset_connection_state_changed_cb_cb()
536 int tethering_set_connection_state_changed_cb(tethering_h tethering, tethering_type_e type, tethering_connection_state_changed_cb callback, void *user_data);
539 * @brief Unregisters the callback function, which is called when the state of connection is changed.
541 * @privlevel platform
542 * @privilege http://tizen.org/privilege/tethering.admin
543 * @param[in] tethering The tethering handle
544 * @param[in] type The tethering type
545 * @retval #TETHERING_ERROR_NONE Successful
546 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
547 * @see tethering_set_connection_state_changed_cb()
549 int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering_type_e type);
552 * @brief Registers the callback function, which is called when the security type of Wi-Fi tethering is changed.
554 * @privlevel platform
555 * @privilege http://tizen.org/privilege/tethering.admin
556 * @param[in] tethering The tethering handle
557 * @param[in] callback The callback function to invoke
558 * @param[in] user_data The user data to be passed to the callback function
559 * @retval #TETHERING_ERROR_NONE Successful
560 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
561 * @see tethering_wifi_unset_security_type_changed_cb()
563 int tethering_wifi_set_security_type_changed_cb(tethering_h tethering, tethering_wifi_security_type_changed_cb callback, void *user_data);
566 * @brief Unregisters the callback function, which is called when the security type of Wi-Fi tethering is changed.
568 * @privlevel platform
569 * @privilege http://tizen.org/privilege/tethering.admin
570 * @param[in] tethering The tethering handle
571 * @param[in] type The tethering type
572 * @retval #TETHERING_ERROR_NONE Successful
573 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
574 * @see tethering_wifi_set_security_type_changed_cb()
576 int tethering_wifi_unset_security_type_changed_cb(tethering_h tethering);
579 * @brief Registers the callback function , which iscalled when the visibility of SSID is changed.
581 * @privlevel platform
582 * @privilege http://tizen.org/privilege/tethering.admin
583 * @param[in] tethering The tethering handle
584 * @param[in] callback The callback function to invoke
585 * @param[in] user_data The user data to be passed to the callback function
586 * @retval #TETHERING_ERROR_NONE Successful
587 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
588 * @see tethering_wifi_unset_ssid_visibility_changed_cb_cb()
590 int tethering_wifi_set_ssid_visibility_changed_cb(tethering_h tethering, tethering_wifi_ssid_visibility_changed_cb callback, void *user_data);
593 * @brief Unregisters the callback function, which is called when the visibility of SSID is changed.
595 * @privlevel platform
596 * @privilege http://tizen.org/privilege/tethering.admin
597 * @param[in] tethering The tethering handle
598 * @retval #TETHERING_ERROR_NONE Successful
599 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
600 * @see tethering_wifi_set_ssid_visibility_changed_cb()
602 int tethering_wifi_unset_ssid_visibility_changed_cb(tethering_h tethering);
605 * @brief Registers the callback function, which is called when the passphrase of Wi-Fi tethering is changed.
607 * @privlevel platform
608 * @privilege http://tizen.org/privilege/tethering.admin
609 * @param[in] tethering The tethering handle
610 * @param[in] callback The callback function to invoke
611 * @param[in] user_data The user data to be passed to the callback function
612 * @retval #TETHERING_ERROR_NONE Successful
613 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
614 * @see tethering_wifi_unset_passphrase_changed_cb()
616 int tethering_wifi_set_passphrase_changed_cb(tethering_h tethering, tethering_wifi_passphrase_changed_cb callback, void *user_data);
619 * @brief Unregisters the callback function, which is called when the passphrase of Wi-Fi tethering is changed.
621 * @privlevel platform
622 * @privilege http://tizen.org/privilege/tethering.admin
623 * @param[in] tethering The tethering handle
624 * @retval #TETHERING_ERROR_NONE Successful
625 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
626 * @see tethering_wifi_set_passphrase_changed_cb()
628 int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
636 * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
641 * @brief Sets the security type of Wi-Fi tethering.
643 * @privlevel platform
644 * @privilege http://tizen.org/privilege/tethering.admin
645 * @remarks This change is applied next time Wi-Fi tethering is enabled.
646 * @param[in] tethering The tethering handle
647 * @param[in] type The security type
648 * @return 0 on success, otherwise negative error value
649 * @retval #TETHERING_ERROR_NONE Successful
650 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
651 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
652 * @see tethering_wifi_get_security_type()
654 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
657 * @brief Gets the security type of Wi-Fi tethering.
659 * @privlevel platform
660 * @privilege http://tizen.org/privilege/tethering.admin
661 * @param[in] tethering The tethering handle
662 * @param[out] type The security type
663 * @return 0 on success, otherwise negative error value
664 * @retval #TETHERING_ERROR_NONE Successful
665 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
666 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
667 * @see tethering_wifi_set_security_type()
669 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
672 * @brief Sets the SSID (service set identifier).
673 * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID.
675 * @privlevel platform
676 * @privilege http://tizen.org/privilege/tethering.admin
677 * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle.
678 * @param[in] tethering The tethering handle
679 * @param[in] ssid The SSID
680 * @return 0 on success, otherwise negative error value
681 * @retval #TETHERING_ERROR_NONE Successful
682 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
683 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
685 int tethering_wifi_set_ssid(tethering_h tethering, const char *ssid);
688 * @brief Gets the SSID (service set identifier).
690 * @privlevel platform
691 * @privilege http://tizen.org/privilege/tethering.admin
692 * @remarks @a ssid must be released using free().
693 * @param[in] tethering The tethering handle
694 * @param[out] ssid The SSID
695 * @return 0 on success, otherwise negative error value
696 * @retval #TETHERING_ERROR_NONE Successful
697 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
698 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
699 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
701 int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
704 * @brief Sets the visibility of SSID (service set identifier).
705 * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan will not find the device.
707 * @privlevel platform
708 * @privilege http://tizen.org/privilege/tethering.admin
709 * @remarks This change is applied next time Wi-Fi tethering is enabled.
710 * @param[in] tethering The tethering handle
711 * @param[in] visible The visibility of SSID: (@c true = visible, @c false = invisible)
712 * @return 0 on success, otherwise negative error value
713 * @retval #TETHERING_ERROR_NONE Successful
714 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
715 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
716 * @see tethering_wifi_get_ssid_visibility()
718 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
721 * @brief Gets the visibility of SSID (service set identifier).
722 * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan will not find the device.
724 * @privlevel platform
725 * @privilege http://tizen.org/privilege/tethering.admin
726 * @param[in] tethering The tethering handle
727 * @param[out] visible The visibility of SSID: (@c true = visible, @c false = invisible)
728 * @return 0 on success, otherwise negative error value
729 * @retval #TETHERING_ERROR_NONE Successful
730 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
731 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
732 * @see tethering_wifi_set_ssid_visibility()
734 int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
737 * @brief Sets the passphrase.
739 * @privlevel platform
740 * @privilege http://tizen.org/privilege/tethering.admin
741 * @remarks This change is applied next time Wi-Fi tethering is enabled.
742 * @param[in] tethering The tethering handle
743 * @param[in] passphrase The passphrase
744 * @return 0 on success, otherwise negative error value
745 * @retval #TETHERING_ERROR_NONE Successful
746 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
747 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
748 * @see tethering_wifi_get_passphrase()
750 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);
753 * @brief Gets the passphrase.
755 * @privlevel platform
756 * @privilege http://tizen.org/privilege/tethering.admin
757 * @remarks @a passphrase must be released using free().
758 * @param[in] tethering The tethering handle
759 * @param[out] passphrase The passphrase
760 * @return 0 on success, otherwise negative error value
761 * @retval #TETHERING_ERROR_NONE Successful
762 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
763 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
764 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
765 * @see tethering_wifi_set_passphrase()
767 int tethering_wifi_get_passphrase(tethering_h tethering, char **passphrase);
770 * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility).
772 * @privlevel platform
773 * @privilege http://tizen.org/privilege/tethering.admin
774 * @remarks Connected devices via Wi-Fi tethering or MobileAP will be disconnected when the settings are reloaded.
775 * @param[in] tethering The tethering handle
776 * @param[in] callback The callback function to invoke
777 * @param[in] user_data The user data to be passed to the callback function
778 * @return 0 on success, otherwise negative error value
779 * @retval #TETHERING_ERROR_NONE Successful
780 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
781 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
783 int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_settings_reloaded_cb callback, void *user_data);
786 * @brief Sets the security type of Wi-Fi AP.
787 * @details If security type is not set, WPA2_PSK is used.
789 * @privlevel platform
790 * @privilege http://tizen.org/privilege/tethering.admin
791 * @param[in] tethering The tethering handle
792 * @param[in] type The security type
793 * @return 0 on success, otherwise negative error value
794 * @retval #TETHERING_ERROR_NONE Successful
795 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
796 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
797 * @see tethering_wifi_ap_get_security_type()
799 int tethering_wifi_ap_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
802 * @brief Gets the security type of Wi-Fi AP.
803 * @details If security type is not set, WPA2_PSK is used.
805 * @privlevel platform
806 * @privilege http://tizen.org/privilege/tethering.admin
807 * @param[in] tethering The tethering handle
808 * @param[out] type The security type
809 * @return 0 on success, otherwise negative error value
810 * @retval #TETHERING_ERROR_NONE Successful
811 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
812 * @see tethering_wifi_ap_set_security_type()
814 int tethering_wifi_ap_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
817 * @brief Sets the SSID (service set identifier) for Wi-Fi AP.
818 * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID.
820 * @privlevel platform
821 * @privilege http://tizen.org/privilege/tethering.admin
822 * @param[in] tethering The tethering handle
823 * @param[in] ssid The SSID
824 * @return 0 on success, otherwise negative error value
825 * @retval #TETHERING_ERROR_NONE Successful
826 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
827 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
829 int tethering_wifi_ap_set_ssid(tethering_h tethering, const char *ssid);
832 * @brief Gets the SSID (service set identifier) for Wi-Fi AP.
833 * @details If SSID is not set, Device name is used as SSID.
835 * @privlevel platform
836 * @privilege http://tizen.org/privilege/tethering.admin
837 * @remarks @a ssid must be released using free().
838 * @param[in] tethering The tethering handle
839 * @param[out] ssid The SSID
840 * @return 0 on success, otherwise negative error value
841 * @retval #TETHERING_ERROR_NONE Successful
842 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
843 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
845 int tethering_wifi_ap_get_ssid(tethering_h tethering, char **ssid);
848 * @brief Sets the visibility of SSID (service set identifier) for Wi-Fi AP.
849 * @details If you set the visibility to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device.
850 * @details By default visibility is set to @c true.
852 * @privlevel platform
853 * @privilege http://tizen.org/privilege/tethering.admin
854 * @remarks This change is applied next time Wi-Fi tethering is enabled.
855 * @param[in] tethering The tethering handle
856 * @param[in] visible The visibility of SSID: (@c true = visible, @c false = invisible)
857 * @return 0 on success, otherwise negative error value
858 * @retval #TETHERING_ERROR_NONE Successful
859 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
860 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
861 * @see tethering_wifi_ap_get_ssid_visibility()
863 int tethering_wifi_ap_set_ssid_visibility(tethering_h tethering, bool visible);
866 * @brief Gets the visibility of SSID (service set identifier) for Wi-Fi AP.
867 * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device.
868 * @details By default visibility is set to @c true.
870 * @privlevel platform
871 * @privilege http://tizen.org/privilege/tethering.admin
872 * @param[in] tethering The tethering handle
873 * @param[out] visible The visibility of SSID: (@c true = visible, @c false = invisible)
874 * @return 0 on success, otherwise negative error value
875 * @retval #TETHERING_ERROR_NONE Successful
876 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
877 * @see tethering_wifi_ap_set_ssid_visibility()
879 int tethering_wifi_ap_get_ssid_visibility(tethering_h tethering, bool *visible);
882 * @brief Sets the passphrase for Wi-Fi AP.
883 * @details If the passphrase is not set, random string of 8 characters will be used.
885 * @privlevel platform
886 * @privilege http://tizen.org/privilege/tethering.admin
887 * @param[in] tethering The tethering handle
888 * @param[in] passphrase The passphrase
889 * @return 0 on success, otherwise negative error value
890 * @retval #TETHERING_ERROR_NONE Successful
891 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
892 * @see tethering_wifi_ap_get_passphrase()
894 int tethering_wifi_ap_set_passphrase(tethering_h tethering, const char *passphrase);
897 * @brief Gets the passphrase for Wi-Fi AP.
898 * @details If the passphrase is not set, random string of 8 characters will be used.
900 * @privlevel platform
901 * @privilege http://tizen.org/privilege/tethering.admin
902 * @remarks @a passphrase must be released using free().
903 * @param[in] tethering The tethering handle
904 * @param[out] passphrase The passphrase
905 * @return 0 on success, otherwise negative error value
906 * @retval #TETHERING_ERROR_NONE Successful
907 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
908 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
909 * @see tethering_wifi_ap_set_passphrase()
911 int tethering_wifi_ap_get_passphrase(tethering_h tethering, char **passphrase);
914 * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility) for Wi-Fi AP.
916 * @privlevel platform
917 * @privilege http://tizen.org/privilege/tethering.admin
918 * @remarks Devices connected via MobileAP will be disconnected when the settings are reloaded.
919 * @param[in] tethering The tethering handle
920 * @param[in] callback The callback function to invoke
921 * @param[in] user_data The user data to be passed to the callback function
922 * @return 0 on success, otherwise negative error value
923 * @retval #TETHERING_ERROR_NONE Successful
924 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
925 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
927 int tethering_wifi_ap_reload_settings(tethering_h tethering, tethering_wifi_ap_settings_reloaded_cb callback, void *user_data);
935 * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
940 * @brief Clones the handle of a client.
942 * @privlevel platform
943 * @privilege http://tizen.org/privilege/tethering.admin
944 * @remarks @a dest must be release using tethering_client_destroy().
945 * @param[out] dest The cloned client handle
946 * @param[in] origin The origin client handle
947 * @return 0 on success, otherwise a negative error value
948 * @retval #TETHERING_ERROR_NONE Successful
949 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
950 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
951 * @see tethering_client_destroy()
953 int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin);
956 * @brief Destroys the handle of a client.
958 * @privlevel platform
959 * @privilege http://tizen.org/privilege/tethering.admin
960 * @param[in] client The client handle
961 * @return 0 on success, otherwise a negative error value
962 * @retval #TETHERING_ERROR_NONE Successful
963 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
964 * @see tethering_client_clone()
966 int tethering_client_destroy(tethering_client_h client);
969 * @brief Gets the tethering type of client.
971 * @privlevel platform
972 * @privilege http://tizen.org/privilege/tethering.admin
973 * @param[in] client The handle of client
974 * @param[out] type The type of tethering
975 * @return 0 on success, otherwise a negative error value.
976 * @retval #TETHERING_ERROR_NONE Successful
977 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
978 * @see tethering_usb_get_connected_client()
979 * @see tethering_connection_state_changed_cb()
981 int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type);
984 * @brief Gets the name of a client.
986 * @privlevel platform
987 * @privilege http://tizen.org/privilege/tethering.admin
988 * @remarks @a name must be released using free().
989 * @param[in] client The client handle
990 * @param[out] name The name of the client
991 * @return 0 on success, otherwise a negative error value
992 * @retval #TETHERING_ERROR_NONE Successful
993 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
994 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
995 * @see tethering_usb_get_connected_client()
996 * @see tethering_connection_state_changed_cb()
998 int tethering_client_get_name(tethering_client_h client, char **name);
1001 * @brief Gets the IP address of a client.
1003 * @privlevel platform
1004 * @privilege http://tizen.org/privilege/tethering.admin
1005 * @remarks @a ip_address must be released using free().
1006 * @param[in] client The client handle
1007 * @param[in] address_family The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported
1008 * @param[out] ip_address The IP address
1009 * @return 0 on success, otherwise a negative error value
1010 * @retval #TETHERING_ERROR_NONE Successful
1011 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1012 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
1013 * @see tethering_usb_get_connected_client()
1014 * @see tethering_connection_state_changed_cb()
1016 int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address);
1019 * @brief Gets the MAC address of a client such as "FC:A1:3E:D6:B1:B1".
1021 * @privlevel platform
1022 * @privilege http://tizen.org/privilege/tethering.admin
1023 * @remarks @a mac_address must be released using free().
1024 * @param[in] client The client handle
1025 * @param[out] mac_address The MAC address
1026 * @return 0 on success, otherwise a negative error value
1027 * @retval #TETHERING_ERROR_NONE Successful
1028 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1029 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
1030 * @see tethering_usb_get_connected_client()
1031 * @see tethering_connection_state_changed_cb()
1033 int tethering_client_get_mac_address(tethering_client_h client, char **mac_address);
1036 * @brief Gets the connection time of a client.
1038 * @privlevel platform
1039 * @privilege http://tizen.org/privilege/tethering.admin
1040 * @param[in] client The client handle
1041 * @param[out] time The connected time of the client
1042 * @return 0 on success, otherwise a negative error value
1043 * @retval #TETHERING_ERROR_NONE Successful
1044 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1045 * @see tethering_usb_get_connected_client()
1046 * @see tethering_connection_state_changed_cb()
1048 int tethering_client_get_time(tethering_client_h client, time_t *timestamp);
1059 #endif /* __TIZEN_NETWORK_TETHERING_H__ */