From: taesub kim Date: Mon, 11 Sep 2017 04:34:16 +0000 (+0900) Subject: Add API to flush BSS X-Git-Tag: submit/tizen_4.0/20170911.130433^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F148889%2F1;p=platform%2Fcore%2Fapi%2Fwifi-manager.git Add API to flush BSS Change-Id: I26a2ba518b5bbda07ba5597eb9f55df851df1159 Signed-off-by: Taesub Kim --- diff --git a/include/network_dbus.h b/include/network_dbus.h index 2d82d1f..bce8821 100755 --- a/include/network_dbus.h +++ b/include/network_dbus.h @@ -148,6 +148,8 @@ int _net_dbus_add_vsie(unsigned int frame_id, const char *vsie_str); int _net_dbus_get_vsie(unsigned int frame_id, char **vsie_str); int _net_dbus_remove_vsie(unsigned int frame_id, const char *vsie_str); int _net_dbus_get_vsie_list(GSList **vsie_list); +int _net_dbus_flush_bss(void); + #ifdef __cplusplus } diff --git a/include/network_interface.h b/include/network_interface.h index 0a818e4..2bae8a5 100755 --- a/include/network_interface.h +++ b/include/network_interface.h @@ -256,6 +256,7 @@ int net_wifi_add_vsie(unsigned int frame_id, const char *vsie_str); int net_wifi_get_vsie(unsigned int frame_id, char **vsie_str); int net_wifi_remove_vsie(unsigned int frame_id, const char *vsie_str); int net_wifi_get_vsie_list(GSList **vsie_list); +int net_wifi_flush_bss(void); int net_wifi_cancel_wps(void); diff --git a/include/wifi_internal.h b/include/wifi_internal.h index 161f98f..8d160c1 100755 --- a/include/wifi_internal.h +++ b/include/wifi_internal.h @@ -290,6 +290,7 @@ int _wifi_get_vsie(wifi_manager_h wifi, int _wifi_remove_vsie(wifi_manager_h wifi, wifi_manager_vsie_frames_e frame_id, const char *vsie_str); int _wifi_get_vsie_list(wifi_manager_vsie_list_cb callback, void *user_data); +int _wifi_flush_bss(void); /* WIFI Privilege Check */ int _wifi_check_get_privilege(); diff --git a/include/wifi_manager_extension.h b/include/wifi_manager_extension.h index 75fe71c..f103414 100755 --- a/include/wifi_manager_extension.h +++ b/include/wifi_manager_extension.h @@ -270,6 +270,16 @@ int wifi_manager_remove_vsie(wifi_manager_h wifi, int wifi_manager_get_vsie_list(wifi_manager_h wifi, wifi_manager_vsie_list_cb callback, void *user_data); +/** + * @brief Flush BSS + * @since_tizen 4.0 + * @return 0 on success, otherwise negative error value. + * @retval #WIFI_ERROR_NONE Successful + * @retval #WIFI_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation + */ +int wifi_manager_flush_bss(wifi_manager_h wifi); + /** * @} */ diff --git a/src/network_dbus.c b/src/network_dbus.c index 1aa88bb..135a65e 100755 --- a/src/network_dbus.c +++ b/src/network_dbus.c @@ -828,11 +828,9 @@ int _net_dbus_set_bgscan_mode(net_wifi_background_scan_mode_e mode) GVariant *message = NULL; GVariant *params; - char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH; - params = g_variant_new("(u)", mode); - message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path, + message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE, "SetBgscan", params, &Error); if (Error != NET_ERR_NONE) @@ -2007,6 +2005,28 @@ int _net_dbus_get_vsie_list(GSList **vsie_list) return Error; } +int _net_dbus_flush_bss(void) +{ + __NETWORK_FUNC_ENTER__; + + net_err_e Error = NET_ERR_NONE; + GVariant *message = NULL; + + message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH, + NETCONFIG_WIFI_INTERFACE, "FlushBss", NULL, &Error); + + if (message == NULL) { + WIFI_LOG(WIFI_ERROR, "Failed to flush bss"); + __NETWORK_FUNC_EXIT__; + return Error; + } + + g_variant_unref(message); + WIFI_LOG(WIFI_INFO, "Successfully flush bss\n"); + + return Error; +} + static void __net_wps_cancel_reply(GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -2799,9 +2819,7 @@ int _net_dbus_resume_bgscan(void) net_err_e Error = NET_ERR_NONE; GVariant *message = NULL; - char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH; - - message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path, + message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE, "ResumeBgscan", NULL, &Error); if (Error != NET_ERR_NONE) @@ -2821,9 +2839,7 @@ int _net_dbus_pause_bgscan(void) net_err_e Error = NET_ERR_NONE; GVariant *message = NULL; - char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH; - - message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path, + message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE, "PauseBgscan", NULL, &Error); if (Error != NET_ERR_NONE) diff --git a/src/network_interface.c b/src/network_interface.c index f30eee6..5b5881e 100755 --- a/src/network_interface.c +++ b/src/network_interface.c @@ -1739,6 +1739,30 @@ int net_wifi_get_vsie_list(GSList **vsie_list) } //LCOV_EXCL_STOP +EXPORT_API int net_wifi_flush_bss(void) +{ + __NETWORK_FUNC_ENTER__; + + net_err_e Error = NET_ERR_NONE; + + if (NetworkInfo.ref_count < 1) { + WIFI_LOG(WIFI_ERROR, "Application is not registered"); + __NETWORK_FUNC_EXIT__; + return NET_ERR_APP_NOT_REGISTERED; + } + + Error = _net_dbus_flush_bss(); + if (Error != NET_ERR_NONE) { + WIFI_LOG(WIFI_ERROR, "Failed to flush bss. Error [%s]\n", + _net_print_error(Error)); + __NETWORK_FUNC_EXIT__; + return Error; + } + + __NETWORK_FUNC_EXIT__; + return NET_ERR_NONE; +} + int net_open_connection_with_wifi_info(const net_wifi_connection_info_s *wifi_info) { __NETWORK_FUNC_ENTER__; diff --git a/src/wifi_internal.c b/src/wifi_internal.c index 6746e52..28d8bad 100755 --- a/src/wifi_internal.c +++ b/src/wifi_internal.c @@ -1756,6 +1756,20 @@ int _wifi_get_vsie_list(wifi_manager_vsie_list_cb callback, void *user_data) } //LCOV_EXCL_STOP +int _wifi_flush_bss(void) +{ + int rv; + + rv = net_wifi_flush_bss(); + + if (rv != NET_ERR_NONE) { + WIFI_LOG(WIFI_ERROR, "Failed to flush bss"); + return WIFI_MANAGER_ERROR_OPERATION_FAILED; + } + + return WIFI_MANAGER_ERROR_NONE; +} + int _wifi_get_connected_profile(wifi_manager_ap_h *ap) { int rv; diff --git a/src/wifi_manager.c b/src/wifi_manager.c index 77366b8..19894b2 100755 --- a/src/wifi_manager.c +++ b/src/wifi_manager.c @@ -1011,6 +1011,27 @@ EXPORT_API int wifi_manager_get_vsie_list(wifi_manager_h wifi, return _wifi_get_vsie_list(callback, user_data); } + +EXPORT_API int wifi_manager_flush_bss(wifi_manager_h wifi) +{ + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + WIFI_LOG(WIFI_INFO, "[App-->TizenMW] bss flush request"); + + int rv; + + if (!(__wifi_check_handle_validity(wifi))) { + WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE + return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE + } + + rv = _wifi_flush_bss(); + + if (rv != WIFI_MANAGER_ERROR_NONE) + WIFI_LOG(WIFI_ERROR, "[App<--TizenMW] Error!! bss flush Request failed. rv[%d]\n", rv); + + return rv; + +} //LCOV_EXCL_STOP EXPORT_API int wifi_manager_specific_scan_create(wifi_manager_h wifi, diff --git a/test/wifi_manager_test.c b/test/wifi_manager_test.c index 574e092..5a5d196 100755 --- a/test/wifi_manager_test.c +++ b/test/wifi_manager_test.c @@ -2460,6 +2460,21 @@ int test_wifi_manager_specific_ap_start_multi_scan(void) return 1; } +int test_wifi_manager_flush_bss(void) +{ + int rv; + + rv = wifi_manager_flush_bss(wifi); + + if (rv != WIFI_MANAGER_ERROR_NONE) { + printf("Fail to flush bss rv = %d\n", rv); + return -1; + } + + printf("Request to flush bss\n"); + return 1; +} + int main(int argc, char **argv) { GMainLoop *mainloop; @@ -2545,6 +2560,7 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) printf("G - Get VSIE\n"); printf("H - Remove VSIE\n"); printf("I - Start Multi Scan\n"); + printf("J - Flush BSS\n"); printf(LOG_RED "0 - Exit \n" LOG_END); printf("ENTER - Show options menu.......\n"); @@ -2685,6 +2701,9 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) case 'I': rv = test_wifi_manager_specific_ap_start_multi_scan(); break; + case 'J': + rv = test_wifi_manager_flush_bss(); + break; default: break; }