Add API : tethering_wifi_set_ssid()
[platform/core/api/tethering.git] / include / tethering.h
index 8236c66..f68dc5e 100644 (file)
@@ -181,6 +181,32 @@ typedef bool(*tethering_connected_client_cb)(tethering_client_h client, void *us
 typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long long received_data, unsigned long long sent_data, void *user_data);
 
 /**
+ * @brief  Called when the security type of Wi-Fi tethering is changed
+ * @param[in]  changed_type  The changed security type of Wi-Fi tethering
+ * @param[in]  user_data  The user data passed from the register function
+ * @see        tethering_wifi_set_security_type_changed_cb()
+ * @see        tethering_wifi_unset_security_type_changed_cb()
+ */
+typedef void (*tethering_wifi_security_type_changed_cb)(tethering_wifi_security_type_e changed_type, void *user_data);
+
+/**
+ * @brief  Called when the visibility of SSID is changed
+ * @param[in]  changed_visible  The changed visibility of SSID
+ * @param[in]  user_data  The user data passed from the register function
+ * @see        tethering_wifi_set_ssid_visibility_changed_cb()
+ * @see        tethering_wifi_unset_ssid_visibility_changed_cb()
+ */
+typedef void (*tethering_wifi_ssid_visibility_changed_cb)(bool changed_visible, void *user_data);
+
+/**
+ * @brief  Called when the passphrase of Wi-Fi tethering is changed
+ * @param[in]  user_data  The user data passed from the register function
+ * @see        tethering_wifi_set_passphrase_changed_cb()
+ * @see        tethering_wifi_unset_passphrase_changed_cb()
+ */
+typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data);
+
+/**
  * @brief  Creates the handle of tethering.
  * @remarks  The @a tethering must be released tethering_destroy() by you.
  * @param[out]  tethering  A handle of a new mobile ap handle on success
@@ -345,7 +371,7 @@ int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, teth
 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
 
 /**
- * @brief Gets the client which is connected by USB tethering.
+ * @brief Gets the clients which are connected.
  * @param[in]  tethering  The handle of tethering
  * @param[in]  type  The type of tethering
  * @param[in]  callback  The callback function to invoke
@@ -427,6 +453,67 @@ int tethering_set_connection_state_changed_cb(tethering_h tethering, tethering_t
 int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering_type_e type);
 
 /**
+ * @brief Registers the callback function called when the security type of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  callback  The callback function to invoke
+ * @param[in]  user_data  The user data to be passed to the callback function
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_unset_security_type_changed_cb()
+ */
+int tethering_wifi_set_security_type_changed_cb(tethering_h tethering, tethering_wifi_security_type_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function called when the security type of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  type  The type of tethering
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_set_security_type_changed_cb()
+ */
+int tethering_wifi_unset_security_type_changed_cb(tethering_h tethering);
+
+/**
+ * @brief Registers the callback function called when the visibility of SSID is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  callback  The callback function to invoke
+ * @param[in]  user_data  The user data to be passed to the callback function
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_unset_ssid_visibility_changed_cb_cb()
+ */
+int tethering_wifi_set_ssid_visibility_changed_cb(tethering_h tethering, tethering_wifi_ssid_visibility_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function called when the visibility of SSID is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_set_ssid_visibility_changed_cb()
+ */
+int tethering_wifi_unset_ssid_visibility_changed_cb(tethering_h tethering);
+
+/**
+ * @brief Registers the callback function called when the passphrase of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  callback  The callback function to invoke
+ * @param[in]  user_data  The user data to be passed to the callback function
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_unset_passphrase_changed_cb()
+ */
+int tethering_wifi_set_passphrase_changed_cb(tethering_h tethering, tethering_wifi_passphrase_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function called when the passphrase of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_set_passphrase_changed_cb()
+ */
+int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
+
+/**
  * @}
  */
 
@@ -438,16 +525,13 @@ int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering
 
 /**
  * @brief Sets the security type of Wi-Fi tethering.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @param[in]  tethering  The handle of tethering
  * @param[in]  type  The security type
  * @return 0 on success, otherwise negative error value.
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_security_type()
  */
 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
@@ -465,6 +549,19 @@ int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_secur
 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
 
 /**
+ * @brief Sets the SSID (service set identifier).
+ * @details If SSID is not set, Device name is used as SSID
+ * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle
+ * @param[in]  tethering  The handle of tethering
+ * @param[out]  ssid  The SSID
+ * @return 0 on success, otherwise negative error value.
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
+ */
+int tethering_wifi_set_ssid(tethering_h tethering, const char *ssid);
+
+/**
  * @brief Gets the SSID (service set identifier).
  * @remarks @a ssid must be released with free() by you.
  * @param[in]  tethering  The handle of tethering
@@ -480,16 +577,13 @@ int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
 /**
  * @brief Sets the visibility of SSID(service set identifier).
  * @details If you set the visibility invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @param[in]  tethering  The handle of tethering
  * @param[in]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
  * @return 0 on success, otherwise negative error value.
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_ssid_visibility()
  */
 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
@@ -509,16 +603,13 @@ int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
 
 /**
  * @brief Sets the passphrase.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @param[in]  tethering  The handle of tethering
  * @param[in]  passphrase  The passphrase
  * @return 0 on success, otherwise negative error value.
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_passphrase()
  */
 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);