Add API to flush BSS 89/148889/1 accepted/tizen/4.0/unified/20170913.002854 submit/tizen_4.0/20170911.130433
authortaesub kim <taesub.kim@samsung.com>
Mon, 11 Sep 2017 04:34:16 +0000 (13:34 +0900)
committertaesub kim <taesub.kim@samsung.com>
Mon, 11 Sep 2017 05:46:10 +0000 (14:46 +0900)
Change-Id: I26a2ba518b5bbda07ba5597eb9f55df851df1159
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
include/network_dbus.h
include/network_interface.h
include/wifi_internal.h
include/wifi_manager_extension.h
src/network_dbus.c
src/network_interface.c
src/wifi_internal.c
src/wifi_manager.c
test/wifi_manager_test.c

index 2d82d1f8ba1409d8c464b3ff97fc9acb4288061b..bce8821aedfca30f3b3693452077eb8071c2add5 100755 (executable)
@@ -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
 }
index 0a818e4d4b0e5ca7a4e99d61c459423b88f895df..2bae8a5b4804b10d9d405044b3e3bbb4a8988503 100755 (executable)
@@ -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);
 
index 161f98f55c34fa4846014cad5dcda1810b3b72f3..8d160c1932d540cd702861e205f13ef0207128df 100755 (executable)
@@ -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();
index 75fe71c23f7cacd79710d724b4681a1ae805adcd..f103414512ab737b796cf4f42e82ba3fb80b6b24 100755 (executable)
@@ -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);
+
 /**
 * @}
 */
index 1aa88bb90865bda36813c5bdcc8673e1dcebd9f2..135a65e9ca35f35d6f1c9339f540510d01328c5e 100755 (executable)
@@ -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)
index f30eee6fc22ed1d6b9633613a2afc6a0419b92ec..5b5881e3c16797d7907c671eb560235af543a2f4 100755 (executable)
@@ -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__;
index 6746e52adff63ad806e32e45f6664dbbd5dd4541..28d8badb774db31dd1e6722014d12ee2702bdd12 100755 (executable)
@@ -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;
index 77366b8971af4b5cf77c0cd05106972d644dc001..19894b2799d04c2a8d8b232ac6f752aa860ed393 100755 (executable)
@@ -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,
index 574e092f758593aaf8639f0e7902b39c3f27e5d3..5a5d196b5f2bfd7fe0c2734f87e6968288fa5c6f 100755 (executable)
@@ -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;
        }