Added network.get privilege to get the wps pin number 69/177569/4
authortaesub kim <taesub.kim@samsung.com>
Wed, 2 May 2018 03:57:19 +0000 (12:57 +0900)
committertaesub kim <taesub.kim@samsung.com>
Tue, 8 May 2018 00:14:33 +0000 (09:14 +0900)
Change-Id: I4f8d46f38fdce39128d808b29a0634b1ff6a6512
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
include/wifi-manager.h
src/wifi_manager.c

index 1f8d970..0e99a20 100755 (executable)
@@ -1651,12 +1651,16 @@ int wifi_manager_cancel_wps(wifi_manager_h wifi);
 /**
  * @brief Gets the WPS generated PIN code.
  * @since_tizen 5.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/network.get
  * @remarks You must release @a wps_pin using free().
  * @param[in] wifi            The Wi-Fi handle
  * @param[out] wps_pin        The WPS PIN
  * @return 0 on success, otherwise negative error value
  * @retval #WIFI_MANAGER_ERROR_NONE                 Successful
  * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED     Operation failed
+ * @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED    Permission Denied
  * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED        Not supported
  */
 int wifi_manager_get_wps_generated_pin(wifi_manager_h wifi, char **wps_pin);
index c7c26a4..c047d62 100755 (executable)
@@ -1155,6 +1155,15 @@ EXPORT_API int wifi_manager_get_wps_generated_pin(wifi_manager_h wifi, char **wp
        }
 
        rv = _wifi_get_wps_generated_pin(wps_pin);
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+       } else if (rv != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "wps generated pin number failed[%d]", rv); //LCOV_EXCL_LINE
+               __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+       }
 
        return rv;
 }