Apply Tizen coding rule and Remove unnecessary things 61/236261/5 accepted/tizen/unified/20200617.134118 submit/tizen/20200616.063112
authorCheoleun Moon <chleun.moon@samsung.com>
Tue, 16 Jun 2020 04:00:54 +0000 (13:00 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Tue, 16 Jun 2020 04:15:17 +0000 (13:15 +0900)
Change-Id: I5506afceb45dc575dee7cf5633adfcfa3d778742

21 files changed:
cts-verifier/cts-verifier-main.c
cts-verifier/cts-verifier-subscribe-test.c
cts-verifier/cts-verifier.h
include/wifi-aware.h
packaging/capi-network-wifi-aware.spec
src/include/wifi-aware-utils.h
src/wifi-aware-data-path.c
src/wifi-aware-gdbus.c
src/wifi-aware-peer.c
src/wifi-aware-private.c
src/wifi-aware.c
tests/nan-test/wifi-aware-matching-filter-test.h
tests/nan-test/wifi-aware-publish-test.c
tests/nan-test/wifi-aware-subscribe-test.c
tests/nan-test/wifi-aware-test.c
tests/nan-test/wifi-aware-test.h [deleted file]
tests/unittest/wifi-aware-publish-unittest-fixture.h
tests/unittest/wifi-aware-session-unittest-fixture.h
tests/unittest/wifi-aware-subscribe-unittest-fixture.h
tests/unittest/wifi-aware-unittest-fixture.h
tests/unittest/wifi-aware-unittest-util.h

index 72b8711..079e931 100644 (file)
@@ -40,7 +40,7 @@ static GMainLoop *g_main_loop_p = NULL;
                if (!g_wifi_aware_session) {\
                        printf("wifi-aware-session handle is not created yet\n");\
                        return;\
-               }\
+               } \
        } while (0)
 
 #define RET_IF_NDP_IS_NULL()\
@@ -48,7 +48,7 @@ static GMainLoop *g_main_loop_p = NULL;
                if (!g_ndp) {\
                        printf("wifi_aware_data_path handle is not created yet\n");\
                        return;\
-               }\
+               } \
        } while (0)
 
 enum {
@@ -90,12 +90,12 @@ static char *g_menu_str[] = {
        [CMD_OPEN_SOL]
                = "Publish",
        [CMD_OPEN_ACT]
-               ="Subscribe",
+               = "Subscribe",
 
        [CMD_PSK_SOL]
-               ="Publish",
+               = "Publish",
        [CMD_PSK_ACT]
-               ="Subscribe",
+               = "Subscribe",
 
        [CMD_INVALID]
                = NULL,
@@ -135,7 +135,7 @@ static inline void __usage_full()
                        printf(MAKE_GREEN"Test 3. Solicited/Active/DataPath(Open)"RESET_COLOR"\n");
                else if (i == CMD_PSK_SOL)
                        printf(MAKE_GREEN"Test 4. Solicited/Active/DataPath(PSK)"RESET_COLOR"\n");
-       
+
                printf(" [%02d] %s\n", i, g_menu_str[i]);
        }
 
index d31aeea..5e3941a 100644 (file)
@@ -63,8 +63,7 @@ static void __subscribed_cb(wifi_aware_session_h session,
 {
        if (error == WIFI_AWARE_ERROR_NONE) {
                printf("Subscribe discovery session started...\n");
-       }
-       else {
+       } else {
                printf("Subscribe is failed...\n");
                return;
        }
@@ -145,8 +144,7 @@ static void __message_result_cb(wifi_aware_session_h session, wifi_aware_error_e
        if (error != WIFI_AWARE_ERROR_NONE) {
                printf("Sending message is failed...\n");
                __test_finish(0);
-       }
-       else {
+       } else {
                printf("Sent message successfully...\n");
        }
 }
index a52feb8..f3f0af9 100644 (file)
  *
  */
 
-/**
-
- * This file declares functions for testing Wi-Fi aware CAPIs.
- *
- * @file        wifi-aware-test.h
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
 #ifndef __WIFI_AWARE_TEST_H__
 #define __WIFI_AWARE_TEST_H__
 
index 341d973..192e51f 100644 (file)
@@ -358,7 +358,7 @@ int wifi_aware_subscribe_set_ttl(wifi_aware_subscribe_h subscribe, unsigned shor
 int wifi_aware_subscribe_set_type(wifi_aware_subscribe_h subscribe, wifi_aware_subscribe_type_e subscribe_type);
 
 /**
- * @brief Sets the name of the service. 
+ * @brief Sets the name of the service.
  * @since_tizen 6.0
  * @param[in] subscribe The Wi-Fi Aware Subscribe handle
  * @param[in] service_name UTF-8 name which identifies the service
@@ -405,7 +405,7 @@ int wifi_aware_subscribe_set_match_filter(wifi_aware_subscribe_h subscribe, cons
  * @since_tizen 6.0
  * @remark Only for the services within the @a distance are searched.
  * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] distance The maximum distance 
+ * @param[in] distance The maximum distance
  * @return 0 on success, otherwise a negative error value
  * @retval #WIFI_AWARE_ERROR_NONE
  * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
@@ -508,7 +508,7 @@ int wifi_aware_session_destroy(wifi_aware_session_h session);
  * @see wifi_aware_session_unset_terminated_cb()
  */
 typedef void(*wifi_aware_session_terminated_cb)(wifi_aware_session_h session,
- wifi_aware_termination_reason_e reason, void *user_data);
              wifi_aware_termination_reason_e reason, void *user_data);
 
 /**
  * @brief Registers a callback function to notify session is terminated.
@@ -523,7 +523,7 @@ typedef void(*wifi_aware_session_terminated_cb)(wifi_aware_session_h session,
  * @see wifi_aware_session_unset_terminated_cb()
  */
 int wifi_aware_session_set_terminated_cb(wifi_aware_session_h session,
- wifi_aware_session_terminated_cb callback, void *user_data);
              wifi_aware_session_terminated_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the session terminated callback function.
@@ -614,7 +614,7 @@ int wifi_aware_session_update_publish(wifi_aware_session_h session,
                wifi_aware_published_cb callback, void *user_data);
 
 /**
- * @brief Called when Subscribe request is finished. 
+ * @brief Called when Subscribe request is finished.
  * @since_tizen 6.0
  * @param[in] session   The Wi-Fi Aware Session handle
  * @param[in] error     The error code
@@ -674,7 +674,7 @@ int wifi_aware_session_update_subscribe(wifi_aware_session_h session,
  * @remark If the publisher doesn't enabled ranging or the subscriber doesn't set both max and min distance,\n
  *         @a distance would be negative value.
  * @param[in] session   The Wi-Fi Aware Session handle
- * @param[in] peer      The found Peer information 
+ * @param[in] peer      The found Peer information
  * @param[in] service_specific_info     Sequence of octets which were received from published service
  * @param[in] service_specific_info_len The length of @a service_specific_info
  * @param[in] distance The distance to the peer
@@ -1021,7 +1021,7 @@ int wifi_aware_data_path_get_interface(wifi_aware_data_path_h data_path, char **
 /**
  * @brief Called when the Wi-Fi Aware Data Path has been lost.
  * @since_tizen 6.0
- * @param[in] data_path The terminated Data Path handle 
+ * @param[in] data_path The terminated Data Path handle
  * @param[in] reason    The reason of termination
  * @param[in] user_data The user data passed from request function
  * @see wifi_aware_data_path_set_terminated_cb()
index ed3e808..67b976c 100644 (file)
@@ -110,7 +110,6 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
 %check
 export LD_LIBRARY_PATH=./src/
 LD_PRELOAD=./tests/unittest/libwifi-aware-mock.so ./tests/unittest/wifi-aware-unittest
-#LD_LIBRARY_PATH=
 
 %if 0%{?gcov:1}
 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
@@ -143,7 +142,6 @@ genhtml %{name}.info -o out --legend --show-details
 %attr(755,root,root) %{_bindir}/wifi-aware-subscribe-matching-filter-test
 
 %files cts-verifier
-#%manifest wifi-aware-test.manifest
 %attr(755,root,root) %{_bindir}/cts-verifier
 
 %if 0%{?gcov:1}
index 88fed93..cec0e5a 100644 (file)
@@ -38,20 +38,19 @@ extern "C" {
 /*
 #define CHECK_FEATURE_SUPPORTED(feature_name)\
     do {\
-        bool feature_supported = FALSE;\
-        if (!system_info_get_platform_bool(feature_name,\
-                    &feature_supported)) {\
-            if (feature_supported == FALSE) {\
-                WIFI_AWARE_LOGE("%s feature is disabled",\
-                        feature_name);\
-                __WIFI_AWARE_FUNC_EXIT__;\
-                return WIFI_AWARE_ERROR_NOT_SUPPORTED;\
-            } \
-        } else {\
-            WIFI_AWARE_LOGE("Error - Feature getting from System Info");\
-            __WIFI_AWARE_FUNC_EXIT__;\
-            return WIFI_AWARE_ERROR_OPERATION_FAILED;\
-        }\
+               bool feature_supported = FALSE;\
+               if (!system_info_get_platform_bool(feature_name,\
+                               &feature_supported)) {\
+                       if (feature_supported == FALSE) {\
+                               WIFI_AWARE_LOGE("%s feature is disabled", feature_name);\
+                               __WIFI_AWARE_FUNC_EXIT__;\
+                               return WIFI_AWARE_ERROR_NOT_SUPPORTED;\
+                       } \
+               } else {\
+                       WIFI_AWARE_LOGE("Error - Feature getting from System Info");\
+                       __WIFI_AWARE_FUNC_EXIT__;\
+                       return WIFI_AWARE_ERROR_OPERATION_FAILED;\
+               }\
     } while (0)
 */
 
index 949f9aa..05a93b4 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware user library.
- *
- * @file        wifi-aware-client.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
-
 #include <glib.h>
 #include <net/if.h>
 
@@ -254,9 +246,9 @@ static void __data_path_unset_data_path_confirmed_cb(wifi_aware_data_path_h data
 }
 
 static void __ndp_confirmed_cb(GDBusConnection *connection,
-                    const gchar *sender, const gchar *object_path,
-                    const gchar *interface, const gchar *signal,
-                    GVariant *parameters, gpointer user_data)
+               const gchar *sender, const gchar *object_path,
+               const gchar *interface, const gchar *signal,
+               GVariant *parameters, gpointer user_data)
 {
        __WIFI_AWARE_FUNC_ENTER__;
        WIFI_AWARE_LOGD("NAN Data Path Confirmed");
@@ -422,9 +414,9 @@ static void __parsing_data_path_terminated_event(GVariant *parameters, uint32_t
 }
 
 static void __data_path_terminated_cb(GDBusConnection *connection,
-                   const gchar *sender, const gchar *object_path,
-                    const gchar *interface, const gchar *signal,
-                    GVariant *parameters, gpointer user_data)
+               const gchar *sender, const gchar *object_path,
+               const gchar *interface, const gchar *signal,
+               GVariant *parameters, gpointer user_data)
 {
        __WIFI_AWARE_FUNC_ENTER__;
 
@@ -470,7 +462,7 @@ int _wifi_aware_data_path_unset_terminated_cb(wifi_aware_data_path_h data_path)
                wifi_aware_gdbus_deregister_signal(DATA_PATH_TERMINATED_SIGNAL);
 
        ndp->terminated_signal_id = 0;
-               
+
        __WIFI_AWARE_FUNC_ENTER__;
 
        return ret;
index 96777e9..cea1fe2 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware gdbus global.
- *
- * @file        wifi-aware-gdbus.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
 #include <system_info.h>
 
 #include "wifi-aware-log.h"
@@ -38,16 +31,16 @@ typedef struct {
 static wifi_aware_gdbus_data gdbus_data = {NULL, NULL};
 
 static struct {
-    const char *interface;
-    const char *member;
+       const char *interface;
+       const char *member;
 } wifi_aware_gdbus_signal_map[] = {
        /*
-        {
-                WIFI_AWARE_DISCOVERY_INTERFACE,
-                "MacAddressChanged",
-                _mac_address_changed
-        },
-               */
+       {
+               WIFI_AWARE_DISCOVERY_INTERFACE,
+               "MacAddressChanged",
+               _mac_address_changed
+       },
+       */
        [SERVICE_DISCOVERED_SIGNAL] = {
                WIFI_AWARE_DISCOVERY_INTERFACE,
                "ServiceDiscovered",
@@ -150,10 +143,10 @@ static int __wifi_aware_dbus_method_call_async(const char *interface_name,
                const char *method, GVariant *params,
                GAsyncReadyCallback callback, void *user_data)
 {
-    if (gdbus_data.connection == NULL) {
-        WIFI_AWARE_LOGE("GDBusconnection is NULL");
+       if (gdbus_data.connection == NULL) {
+               WIFI_AWARE_LOGE("GDBusconnection is NULL");
                return WIFI_AWARE_ERROR_OPERATION_FAILED;
-    }
+       }
 
        g_dbus_connection_call(gdbus_data.connection,
                WIFI_AWARE_INTERFACE,
@@ -168,7 +161,7 @@ static int __wifi_aware_dbus_method_call_async(const char *interface_name,
                callback,
                user_data);
 
-    return WIFI_AWARE_ERROR_NONE;
+       return WIFI_AWARE_ERROR_NONE;
 
 }
 
@@ -538,7 +531,7 @@ int wifi_aware_gdbus_cancel_publish(wifi_aware_session_h session, int client_id)
                WIFI_AWARE_LOGE("Invalid Publish Id");
                return WIFI_AWARE_ERROR_INVALID_PARAMETER;
        }
-       
+
        params = __create_cancel_publish_request_param(client_id, pub_id);
        DBUS_DEBUG_VARIANT(params);
 
@@ -628,7 +621,7 @@ int wifi_aware_gdbus_cancel_subscribe(wifi_aware_session_h session, int client_i
                WIFI_AWARE_LOGE("Invalid Subscribe Id");
                return WIFI_AWARE_ERROR_INVALID_PARAMETER;
        }
-       
+
        params = __create_cancel_subscribe_request_param(client_id, sub_id);
        DBUS_DEBUG_VARIANT(params);
 
index ec318f5..435e8bc 100644 (file)
@@ -73,9 +73,8 @@ int _wifi_aware_peer_remove(GHashTable *peer_map, wifi_aware_peer_h peer)
        wifi_aware_peer_s *peer_handle = (wifi_aware_peer_s *)peer;
        RET_VAL_IF(peer_handle == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "peer is NULL");
 
-       if (!g_hash_table_remove(peer_map, GINT_TO_POINTER(peer_handle->id))) {
+       if (!g_hash_table_remove(peer_map, GINT_TO_POINTER(peer_handle->id)))
                WIFI_AWARE_LOGE("peer %d doesn't exist", peer_handle->id);
-       }
 
        return WIFI_AWARE_ERROR_NONE;
 }
index 521aa82..1537be0 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware user library.
- *
- * @file        wifi-aware-client.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
-
 #include <glib.h>
 #include <cynara-client.h>
 #include <stdio.h>
@@ -38,7 +30,7 @@
 
 /**
  * These enum values has dependency with nan-manager daemon.
- * If the daemon changes error enum, It also must be changed. 
+ * If the daemon changes error enum, It also must be changed.
  */
 enum {
        NAN_ERROR_NONE = 0,
@@ -69,8 +61,8 @@ typedef struct {
 typedef struct {
        uint16_t pub_sub_id;
        wifi_aware_session_type_e session_type;
-    wifi_aware_publish_h publish_config;
-    wifi_aware_subscribe_h subscribe_config;
+       wifi_aware_publish_h publish_config;
+       wifi_aware_subscribe_h subscribe_config;
        bool is_requested;
 
        wifi_aware_published_cb published_cb;
@@ -153,17 +145,17 @@ wifi_aware_error_e _wifi_aware_convert_error_string_to_enum(const char *error)
        if (strstr(error, "NoReply") != NULL)
                return WIFI_AWARE_ERROR_INVALID_OPERATION;
        else if (NULL != strstr(error, "UnknownMethod"))
-        return WIFI_AWARE_ERROR_INVALID_OPERATION;
-    else if (NULL != strstr(error, "InvalidArguments"))
-        return WIFI_AWARE_ERROR_INVALID_PARAMETER;
-    else if (NULL != strstr(error, "AccessDenied"))
-        return WIFI_AWARE_ERROR_PERMISSION_DENIED;
-    else if (NULL != strstr(error, "PermissionDenied"))
-        return WIFI_AWARE_ERROR_PERMISSION_DENIED;
-    else if (NULL != strstr(error, "NotSupported"))
-        return WIFI_AWARE_ERROR_NOT_SUPPORTED;
-    else if (NULL != strstr(error, "InProgress"))
-        return WIFI_AWARE_ERROR_NOW_IN_PROGRESS;
+               return WIFI_AWARE_ERROR_INVALID_OPERATION;
+       else if (NULL != strstr(error, "InvalidArguments"))
+               return WIFI_AWARE_ERROR_INVALID_PARAMETER;
+       else if (NULL != strstr(error, "AccessDenied"))
+               return WIFI_AWARE_ERROR_PERMISSION_DENIED;
+       else if (NULL != strstr(error, "PermissionDenied"))
+               return WIFI_AWARE_ERROR_PERMISSION_DENIED;
+       else if (NULL != strstr(error, "NotSupported"))
+               return WIFI_AWARE_ERROR_NOT_SUPPORTED;
+       else if (NULL != strstr(error, "InProgress"))
+               return WIFI_AWARE_ERROR_NOW_IN_PROGRESS;
        else
                WIFI_AWARE_LOGI("Unknown Error %s", error);
 
@@ -172,7 +164,7 @@ wifi_aware_error_e _wifi_aware_convert_error_string_to_enum(const char *error)
 
 wifi_aware_error_e _wifi_aware_convert_gdbus_error(GDBusError error)
 {
-       switch(error) {
+       switch (error) {
        case G_DBUS_ERROR_NO_REPLY:
                return WIFI_AWARE_ERROR_INVALID_OPERATION;
        case G_DBUS_ERROR_UNKNOWN_METHOD:
@@ -316,7 +308,7 @@ static void __enable_request_reply(GObject *src, GAsyncResult *res, gpointer use
                WIFI_AWARE_LOGI("Client ID: %i, error: %d", g_wifi_aware->client_id, nan_error);
                error = _wifi_aware_convert_nan_manager_error(nan_error);
        }
-       
+
        if (g_wifi_aware->enabled_cb) {
                wifi_aware_enabled_cb enabled_cb = g_wifi_aware->enabled_cb;
                g_wifi_aware->enabled_cb = NULL;
@@ -326,22 +318,22 @@ static void __enable_request_reply(GObject *src, GAsyncResult *res, gpointer use
 }
 
 static void __session_add_published_callback(wifi_aware_session_h session,
-        wifi_aware_published_cb callback, void *user_data)
+               wifi_aware_published_cb callback, void *user_data)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
-    handle->published_cb = callback;
-    handle->published_cb_data = user_data;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       handle->published_cb = callback;
+       handle->published_cb_data = user_data;
 }
 
 static int __is_published(wifi_aware_session_h session)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        return handle->session_type == WIFI_AWARE_SESSION_PUBLISH && handle->pub_sub_id > 0;
 }
 
 static void __session_set_pub_sub_id(wifi_aware_session_h session, uint16_t pub_sub_id)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        handle->pub_sub_id = pub_sub_id;
 }
 
@@ -406,8 +398,7 @@ static wifi_aware_error_e __get_dbus_result(GObject *src, GAsyncResult *res, uin
                WIFI_AWARE_LOGE("Publish/Subsribe Request failure: %s", dbus_error->message);
                error = _wifi_aware_convert_error_string_to_enum(dbus_error->message);
                g_error_free(dbus_error);
-       }
-       else {
+       } else {
                g_variant_get(reply, "(qi)", id, &nan_error);
                WIFI_AWARE_LOGI("Pub/Sub ID: %u, error: %d", *id, nan_error);
                error = _wifi_aware_convert_nan_manager_error(nan_error);
@@ -432,23 +423,23 @@ static void __publish_request_reply(GObject *src, GAsyncResult *res, gpointer us
 }
 
 static void __session_add_subscribed_callback(wifi_aware_session_h session,
-        wifi_aware_subscribed_cb callback, void *user_data)
+               wifi_aware_subscribed_cb callback, void *user_data)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
-    handle->subscribed_cb = callback;
-    handle->subscribed_cb_data = user_data;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       handle->subscribed_cb = callback;
+       handle->subscribed_cb_data = user_data;
 }
 
 static int __is_subscribed(wifi_aware_session_h session)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        return handle->session_type == WIFI_AWARE_SESSION_SUBSCRIBE && handle->pub_sub_id > 0;
 }
 
 static void __wifi_aware_subscribe_invoke_callback(wifi_aware_session_h session, wifi_aware_error_e error)
 {
        RET_IF(session == NULL, "Session is NULL");
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
 
        if (handle->subscribed_cb) {
                wifi_aware_subscribed_cb subscribed_cb = handle->subscribed_cb;
@@ -492,19 +483,18 @@ uint16_t _wifi_aware_session_get_subscribe_id(wifi_aware_session_h session)
 
 uint16_t _wifi_aware_session_get_pub_sub_id(wifi_aware_session_h session)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        return handle->pub_sub_id;
 }
 
 const char *_wifi_aware_session_get_service_name(wifi_aware_session_h session)
 {
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        if (handle->session_type == WIFI_AWARE_SESSION_PUBLISH) {
                wifi_aware_publish_request_s *req =
                        (wifi_aware_publish_request_s *)handle->publish_config;
                return req->service_name;
-       }
-       else {
+       } else {
                wifi_aware_subscribe_request_s *req =
                        (wifi_aware_subscribe_request_s *)handle->subscribe_config;
                return req->service_name;
@@ -630,8 +620,8 @@ static void _wifi_aware_session_handle_init(wifi_aware_session_s *session_handle
 {
        session_handle->pub_sub_id = 0;
        session_handle->session_type = WIFI_AWARE_SESSION_PUBLISH;
-    session_handle->publish_config = NULL;
-    session_handle->subscribe_config = NULL;
+       session_handle->publish_config = NULL;
+       session_handle->subscribe_config = NULL;
        session_handle->is_requested = false;
 
        session_handle->published_cb = NULL;
@@ -688,9 +678,9 @@ static void __parsing_session_terminated_event(GVariant *parameters, uint16_t *p
 }
 
 static void __session_terminated_cb(GDBusConnection *connection,
-                   const gchar *sender, const gchar *object_path,
-                    const gchar *interface, const gchar *signal,
-                    GVariant *parameters, gpointer user_data)
+               const gchar *sender, const gchar *object_path,
+               const gchar *interface, const gchar *signal,
+               GVariant *parameters, gpointer user_data)
 {
        WIFI_AWARE_LOGD("session is terminated.");
 
@@ -751,7 +741,7 @@ int _wifi_aware_publish_handle_create(wifi_aware_publish_h *publish)
 
 void _wifi_aware_publish_set_default_values(wifi_aware_publish_h publish)
 {
-    wifi_aware_publish_request_s *req = (wifi_aware_publish_request_s *)publish;
+       wifi_aware_publish_request_s *req = (wifi_aware_publish_request_s *)publish;
        req->ttl = 0;
        req->publish_type = WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED;
        req->specific_info_len = 0;
@@ -890,7 +880,7 @@ int _wifi_aware_subscribe_handle_create(wifi_aware_subscribe_h *subscribe)
 void _wifi_aware_subscribe_set_default_values(
                wifi_aware_subscribe_h subscribe)
 {
-    wifi_aware_subscribe_request_s *req = (wifi_aware_subscribe_request_s *)subscribe;
+       wifi_aware_subscribe_request_s *req = (wifi_aware_subscribe_request_s *)subscribe;
        req->ttl = 0;
        req->subscribe_type = WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE;
        //memset(req->specific_info[WIFI_AWARE_MAX_SERVICE_SPECIFIC_INFO_LEN], 0, WIFI_AWARE_MAX_SERVICE_SPECIFIC_INFO_LEN);
@@ -1065,26 +1055,26 @@ int _wifi_aware_session_cancel(wifi_aware_session_h session)
 
 static bool __unpack_byte_array(unsigned char *array, GVariant *var, uint16_t len)
 {
-    GVariantIter *iter = NULL;
-    int length = 0;
+       GVariantIter *iter = NULL;
+       int length = 0;
 
-    if (array == NULL || var == NULL || len == 0) {
-        WIFI_AWARE_LOGI("Invalid parameter");
-        return false;
-    }
+       if (array == NULL || var == NULL || len == 0) {
+               WIFI_AWARE_LOGI("Invalid parameter");
+               return false;
+       }
 
-    g_variant_get(var, "ay", &iter);
-    if (iter == NULL) {
-        WIFI_AWARE_LOGE("Fail to get iterator");
-        return false;
-    }
+       g_variant_get(var, "ay", &iter);
+       if (iter == NULL) {
+               WIFI_AWARE_LOGE("Fail to get iterator");
+               return false;
+       }
 
-    while (g_variant_iter_loop(iter, "y", &array[length])) {
-        ++length;
-        if (length >= len)
-            break;
-    }
-    g_variant_iter_free(iter);
+       while (g_variant_iter_loop(iter, "y", &array[length])) {
+               ++length;
+               if (length >= len)
+                       break;
+       }
+       g_variant_iter_free(iter);
 
        return true;
 }
@@ -1165,9 +1155,9 @@ static int __get_peer_handle(unsigned int peer_id, wifi_aware_peer_h *peer)
 }
 
 static void __service_discovered_cb(GDBusConnection *connection,
-                    const gchar *sender, const gchar *object_path,
-                    const gchar *interface, const gchar *signal,
-                    GVariant *parameters, gpointer user_data)
+               const gchar *sender, const gchar *object_path,
+               const gchar *interface, const gchar *signal,
+               GVariant *parameters, gpointer user_data)
 {
        __WIFI_AWARE_FUNC_ENTER__;
        WIFI_AWARE_LOGD("NAN Service is discovered");
@@ -1208,9 +1198,9 @@ static void __service_discovered_cb(GDBusConnection *connection,
 }
 
 static void __message_received_cb(GDBusConnection *connection,
-                    const gchar *sender, const gchar *object_path,
-                    const gchar *interface, const gchar *signal,
-                    GVariant *parameters, gpointer user_data)
+               const gchar *sender, const gchar *object_path,
+               const gchar *interface, const gchar *signal,
+               GVariant *parameters, gpointer user_data)
 {
        __WIFI_AWARE_FUNC_ENTER__;
        WIFI_AWARE_LOGD("NAN Service is discovered");
@@ -1253,7 +1243,7 @@ int _wifi_aware_set_service_discovered_cb(wifi_aware_session_h session,
        RET_VAL_IF(!_wifi_aware_session_is_subscribe_type(session),
                        WIFI_AWARE_ERROR_INVALID_OPERATION, "This session is not for Subscribe");
 
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        handle->discovered_cb = callback;
        handle->discovered_cb_data = user_data;
        handle->discovered_signal_id =
@@ -1269,7 +1259,7 @@ int _wifi_aware_unset_service_discovered_cb(wifi_aware_session_h session)
        RET_VAL_IF(!_wifi_aware_session_is_subscribe_type(session),
                        WIFI_AWARE_ERROR_INVALID_OPERATION, "This session is not for Subscribe");
 
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        handle->discovered_cb = NULL;
        handle->discovered_cb_data = NULL;
        if (handle->discovered_signal_id > 0)
@@ -1285,7 +1275,7 @@ int _wifi_aware_set_message_received_cb(wifi_aware_session_h session,
        __WIFI_AWARE_FUNC_ENTER__;
        RET_VAL_IF(session == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "wifi_aware_session_h is NULL");
 
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        handle->received_cb = callback;
        handle->received_cb_data = user_data;
        handle->received_signal_id =
@@ -1299,7 +1289,7 @@ int _wifi_aware_unset_message_received_cb(wifi_aware_session_h session)
        __WIFI_AWARE_FUNC_ENTER__;
        RET_VAL_IF(session == NULL, WIFI_AWARE_ERROR_INVALID_PARAMETER, "wifi_aware_session_h is NULL");
 
-    wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
+       wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
        handle->received_cb = NULL;
        handle->received_cb_data = NULL;
        if (handle->received_signal_id > 0)
@@ -1357,8 +1347,7 @@ static void __send_message_reply(GObject *src, GAsyncResult *res, gpointer user_
                WIFI_AWARE_LOGE("Followup Request failure: %s", dbus_error->message);
                error = _wifi_aware_convert_error_string_to_enum(dbus_error->message);
                g_error_free(dbus_error);
-       }
-       else {
+       } else {
                g_variant_get(reply, "(i)", &nan_error);
                WIFI_AWARE_LOGI("error: %d", nan_error);
                error = _wifi_aware_convert_nan_manager_error(nan_error);
index e0008d0..7316feb 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware user library.
- *
- * @file        wifi-aware-client.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
-
 #include <glib.h>
 
 #include "wifi-aware.h"
index 9675ed0..ef0c5c9 100644 (file)
@@ -117,14 +117,14 @@ typedef struct {
 #define MATCHING_FILTER_FORMAT_NUM 8
 
 matching_filter_format_t test_matching_filter[MATCHING_FILTER_FORMAT_NUM]
-       = {     {5, {0, 0, 0, 0, 0}}, // <0><0><0><0><0>  -> wildcard
-               {10, {1, 1, 1, 2, 1, 3, 1, 4, 1, 5}}, // <1,1,><1,2><1,3><1,4><1,5> -> value filter 1
-               {10, {1, 1, 1, 2, 1, 1, 1, 4, 1, 5}}, // <1,1,><1,2><1,1><1,4><1,5> -> value filter 2
-               {6, {0, 1, 2, 0, 1, 4}}, // <0><1,2><0><1,4> -> value filter 3
-               {8, {0, 1, 2, 1, 3, 0, 1, 5}}, // <0><1,2><1,3><0><1,5> -> value filter 4
-               {6, {1, 1, 0, 1, 3, 0}}, // <1,1><0><1,3><0> -> value filter 5
-               {8, {1, 1, 0, 1, 3, 0, 1, 5}}, // <1,1><0><1,3><0><1,5> -> value filter 6
-               {0, {0, }}, // No filter
+       = {     {5, {0, 0, 0, 0, 0} }, // <0><0><0><0><0>  -> wildcard
+               {10, {1, 1, 1, 2, 1, 3, 1, 4, 1, 5} }, // <1,1,><1,2><1,3><1,4><1,5> -> value filter 1
+               {10, {1, 1, 1, 2, 1, 1, 1, 4, 1, 5} }, // <1,1,><1,2><1,1><1,4><1,5> -> value filter 2
+               {6, {0, 1, 2, 0, 1, 4} }, // <0><1,2><0><1,4> -> value filter 3
+               {8, {0, 1, 2, 1, 3, 0, 1, 5} }, // <0><1,2><1,3><0><1,5> -> value filter 4
+               {6, {1, 1, 0, 1, 3, 0} }, // <1,1><0><1,3><0> -> value filter 5
+               {8, {1, 1, 0, 1, 3, 0, 1, 5} }, // <1,1><0><1,3><0><1,5> -> value filter 6
+               {0, {0, } }, // No filter
 };
 
 #ifdef __cplusplus
index 16d1e74..8342d6c 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware test executable.
- *
- * @file        wifi-aware-test.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
-
-/*****************************************************************************
- *  Standard headers
- *****************************************************************************/
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <glib.h>
 
-/*****************************************************************************
- *  System headers
- *****************************************************************************/
 #include <system_info.h>
 
-/*****************************************************************************
- *  Wi-Fi Aware library headers
- *****************************************************************************/
 #include "wifi-aware.h"
 
-/*****************************************************************************
- *  Intelligent Network Monitoring(WIFI_AWARE) test local headers
- *****************************************************************************/
-#include "wifi-aware-test.h"
-
-/*****************************************************************************
- *  Macros and Typedefs
- *****************************************************************************/
-
 #define RESET_COLOR "\e[m"
 #define MAKE_RED "\e[31m"
 #define MAKE_GREEN "\e[32m"
@@ -247,8 +221,8 @@ void __print_byte_array(const unsigned char *data, size_t len)
                else
                        printf("\\\\x%02X", *ptr);
                ptr++;
-       }   
-    printf("\n");
+       }
+       printf("\n");
 }
 
 void test_full_menu()
@@ -313,8 +287,7 @@ static void __open_cb(wifi_aware_data_path_h data_path, wifi_aware_error_e error
                else
                        PRINT_FAILURE_ERROR("\tPeer's Port:", ret);
                __test_finish(1);
-       }
-       else {
+       } else {
                PRINT_FAILURE("[CB][OpenDataPath] Failure(%d:%s) %p", error, __print_error(error), data_path);
                __test_finish(0);
        }
@@ -455,10 +428,9 @@ static bool __set_publish_config(wifi_aware_publish_h publish)
 
        ret = wifi_aware_publish_set_type(publish, g_pub_type);
        if (ret == WIFI_AWARE_ERROR_NONE) {
-               printf("\tPublish Type: %s\n", g_pub_type == WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED ? 
+               printf("\tPublish Type: %s\n", g_pub_type == WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED ?
                                "Unsolicited" : "Solicited");
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tPublish Type:", ret);
                return false;
        }
@@ -466,8 +438,7 @@ static bool __set_publish_config(wifi_aware_publish_h publish)
        ret = wifi_aware_publish_set_service_name(publish, g_service_name);
        if (ret == WIFI_AWARE_ERROR_NONE) {
                printf("\tService Name: %s\n", g_service_name);
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tService Name:", ret);
                return false;
        }
@@ -479,8 +450,7 @@ static bool __set_publish_config(wifi_aware_publish_h publish)
        if (ret == WIFI_AWARE_ERROR_NONE) {
                printf("\tService Specific Info: ");
                __print_byte_array(specific_info, len);
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tService Specific Info:", ret);
                return false;
        }
@@ -488,8 +458,7 @@ static bool __set_publish_config(wifi_aware_publish_h publish)
        ret = wifi_aware_publish_enable_ranging(publish, g_ranging);
        if (ret == WIFI_AWARE_ERROR_NONE) {
                printf("\tRanging: %s\n", g_ranging ? "Enable" : "Disable");
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tRanging:", ret);
                return false;
        }
@@ -541,8 +510,7 @@ static void __enabled_cb(wifi_aware_error_e error, void *user_data)
 {
        if (error == WIFI_AWARE_ERROR_NONE) {
                PRINT_SUCCESS("[CB][Enable] Enabled");
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("[CB][Enable]", error);
                return;
        }
index 104198a..8126ae3 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware test executable.
- *
- * @file        wifi-aware-test.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
-
-/*****************************************************************************
- *  Standard headers
- *****************************************************************************/
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <glib.h>
 
-/*****************************************************************************
- *  System headers
- *****************************************************************************/
 #include <system_info.h>
 
-/*****************************************************************************
- *  Wi-Fi Aware library headers
- *****************************************************************************/
 #include "wifi-aware.h"
 
-/*****************************************************************************
- *  Intelligent Network Monitoring(WIFI_AWARE) test local headers
- *****************************************************************************/
-#include "wifi-aware-test.h"
-
-/*****************************************************************************
- *  Macros and Typedefs
- *****************************************************************************/
-
 #define RESET_COLOR "\e[m"
 #define MAKE_RED "\e[31m"
 #define MAKE_GREEN "\e[32m"
@@ -267,8 +241,8 @@ static void __print_byte_array(const unsigned char *data, size_t len)
                else
                        printf("\\\\x%02X", *ptr);
                ptr++;
-       }   
-    printf("\n");
+       }
+       printf("\n");
 }
 
 static void test_quit()
@@ -336,8 +310,7 @@ static void __open_cb(wifi_aware_data_path_h data_path, wifi_aware_error_e error
                else
                        PRINT_FAILURE_ERROR("\tPeer's Port:", ret);
                __test_finish(1);
-       }
-       else {
+       } else {
                PRINT_FAILURE("[CB][OpenDataPath] Failure(%d:%s) %p", error, __print_error(error), data_path);
                __test_finish(0);
        }
@@ -422,9 +395,8 @@ static void __message_received_cb(wifi_aware_session_h session, wifi_aware_peer_
                printf("\tPeer's NMI: Failure(%d:%s)\n", ret, __print_error(ret));
        } else {
                printf("\tPeer's NMI: ");
-               if (mac != NULL) {
+               if (mac != NULL)
                        __print_mac(mac);
-               }
                printf("\n");
        }
 
@@ -506,10 +478,9 @@ static bool __set_subscribe_config(wifi_aware_subscribe_h subscribe)
 
        ret = wifi_aware_subscribe_set_type(subscribe, g_sub_type);
        if (ret == WIFI_AWARE_ERROR_NONE) {
-               printf("\tSubscribe Type: %s\n", g_sub_type == WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE ? 
+               printf("\tSubscribe Type: %s\n", g_sub_type == WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE ?
                                "Passive" : "Active");
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tSubscribe Type:", ret);
                return false;
        }
@@ -518,8 +489,7 @@ static bool __set_subscribe_config(wifi_aware_subscribe_h subscribe)
                        g_service_name);
        if (ret == WIFI_AWARE_ERROR_NONE) {
                printf("\tService Name: %s\n", g_service_name);
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tService Name:", ret);
                return false;
        }
@@ -531,8 +501,7 @@ static bool __set_subscribe_config(wifi_aware_subscribe_h subscribe)
        if (ret == WIFI_AWARE_ERROR_NONE) {
                printf("\tService Specific Info: ");
                __print_byte_array(specific_info, len);
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("\tService Specific Info:", ret);
                return false;
        }
@@ -541,8 +510,7 @@ static bool __set_subscribe_config(wifi_aware_subscribe_h subscribe)
                ret = wifi_aware_subscribe_set_min_distance(subscribe, g_min_distance);
                if (ret == WIFI_AWARE_ERROR_NONE) {
                        printf("\tMin Distance: %d\n", g_min_distance);
-               }
-               else {
+               } else {
                        PRINT_FAILURE_ERROR("\tMin Distance:", ret);
                        return false;
                }
@@ -551,8 +519,7 @@ static bool __set_subscribe_config(wifi_aware_subscribe_h subscribe)
                ret = wifi_aware_subscribe_set_max_distance(subscribe, g_max_distance);
                if (ret == WIFI_AWARE_ERROR_NONE) {
                        printf("\tMax Distance: %d\n", g_min_distance);
-               }
-               else {
+               } else {
                        PRINT_FAILURE_ERROR("\tMax Distance:", ret);
                        return false;
                }
@@ -614,8 +581,7 @@ static void __enabled_cb(wifi_aware_error_e error, void *user_data)
 {
        if (error == WIFI_AWARE_ERROR_NONE) {
                PRINT_SUCCESS("[CB][Enable] Enabled");
-       }
-       else {
+       } else {
                PRINT_FAILURE_ERROR("[CB][Enable]", error);
                return;
        }
index 74274b7..0b3a286 100644 (file)
  *
  */
 
-/**
- * This file implements Wi-Fi Aware test executable.
- *
- * @file        wifi-aware-test.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-
-
-/*****************************************************************************
- *  Standard headers
- *****************************************************************************/
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <glib.h>
 
-/*****************************************************************************
- *  System headers
- *****************************************************************************/
 #include <system_info.h>
 
-/*****************************************************************************
- *  Wi-Fi Aware library headers
- *****************************************************************************/
 #include "wifi-aware.h"
 
-/*****************************************************************************
- *  Intelligent Network Monitoring(WIFI_AWARE) test local headers
- *****************************************************************************/
-#include "wifi-aware-test.h"
-
-/*****************************************************************************
- *  Macros and Typedefs
- *****************************************************************************/
-
 #define RESET_COLOR "\e[m"
 #define MAKE_RED "\e[31m"
 #define MAKE_GREEN "\e[32m"
@@ -78,7 +52,7 @@
                if (!g_wifi_aware_session) {\
                        printf("wifi-aware-session handle is not created yet\n");\
                        return;\
-               }\
+               } \
        } while (0)
 
 #define RET_IF_NDP_IS_NULL()\
@@ -86,7 +60,7 @@
                if (!g_ndp) {\
                        printf("wifi_aware_data_path handle is not created yet\n");\
                        return;\
-               }\
+               } \
        } while (0)
 
 #define MATCH_FILTER "bytes used for matching"
@@ -143,10 +117,6 @@ enum {
        CMD_INVALID,
 };
 
-/*****************************************************************************
- *  Global Variables
- *****************************************************************************/
-
 static char *g_menu_str[] = {
        [CMD_QUIT]
                = "QUIT",
@@ -196,10 +166,6 @@ static wifi_aware_data_path_h g_ndp = NULL;
 static int g_session_type = -1;        // 0: publish, 1: subscribe
 static unsigned char g_msg[4];
 
-/*****************************************************************************
- *  Local Functions Definition
- *****************************************************************************/
-
 static inline char* __cmd_transform(char*str)
 {
        int i, j;
@@ -299,14 +265,14 @@ const char *__print_error(wifi_aware_error_e err)
 
 static void __print_result(int ret, gchar *function_name)
 {
-    if (ret == WIFI_AWARE_ERROR_NONE) {
-        printf(MAKE_GREEN"%s"RESET_COLOR"\n", function_name);
-    } else {
-        printf(MAKE_RED"%s: %s ", function_name, __print_error(ret));
-        printf(RESET_COLOR"\n");
-    }
-
-    printf("%s() result=[%d]\n", function_name, ret);
+       if (ret == WIFI_AWARE_ERROR_NONE) {
+               printf(MAKE_GREEN"%s"RESET_COLOR"\n", function_name);
+       } else {
+               printf(MAKE_RED"%s: %s ", function_name, __print_error(ret));
+               printf(RESET_COLOR"\n");
+       }
+
+       printf("%s() result=[%d]\n", function_name, ret);
 }
 
 void __print_byte_array(const unsigned char *data, size_t len)
@@ -323,8 +289,8 @@ void __print_byte_array(const unsigned char *data, size_t len)
                else
                        printf("\\\\x%02X", *ptr);
                ptr++;
-       }   
-    printf("\n");
+       }
+       printf("\n");
 }
 
 void test_full_menu()
@@ -409,9 +375,8 @@ static void __print_match_filter(unsigned char filter[MAX_MATCH_FILTER_LEN + 1],
        while (i < filter_len) {
                len = filter[i];
                printf("%d: ", len);
-               for (int j = 1; j <= len; ++j) {
+               for (int j = 1; j <= len; ++j)
                        printf("%d, ", filter[i + j]);
-               }
                printf("\n");
                i += len + 1;
        }
@@ -495,7 +460,7 @@ static void __set_publish_config(wifi_aware_publish_h publish)
        printf("Do you want to set Service Specific Information? (0-No, 1-Yes) ");
        if (scanf("%d", &set_info) < 0)
                return;
-       
+
        if (set_info == 1) {
                if (scanf(" %" STR(MAX_SPECIFIC_INFO_LEN) "s", str_specific_info) < 0)
                        return;
@@ -668,7 +633,7 @@ static int __equal_peer_id(gconstpointer a, gconstpointer b)
 static wifi_aware_peer_h __get_peer_by_id(int peer_id)
 {
        GSList *list = (GSList *)g_slist_find_custom(g_peer_list,
-                       GINT_TO_POINTER(peer_id), (GCompareFunc)__equal_peer_id); 
+                       GINT_TO_POINTER(peer_id), (GCompareFunc)__equal_peer_id);
        if (!list) {
                printf("No Peer %d ", peer_id);
                return NULL;
@@ -725,7 +690,7 @@ static void __set_subscribe_config(wifi_aware_subscribe_h subscribe)
        printf("Do you want to set Service Specific Information? (0-No, 1-Yes) ");
        if (scanf("%d", &set_info) < 0)
                return;
-       
+
        if (set_info == 1) {
                if (scanf(" %" STR(MAX_SPECIFIC_INFO_LEN) "s", str_specific_info) < 0)
                        return;
@@ -916,7 +881,7 @@ void test_send_message()
                return;
 
        wifi_aware_peer_h peer = __get_peer_by_id(peer_id);
-       printf("Selected peer: %p",  peer);
+       printf("Selected peer: %p", peer);
 
        int ret = wifi_aware_session_send_message(g_wifi_aware_session, peer, g_msg, len, __message_result_cb, peer);
        __print_result(ret, "wifi_aware_send_message");
@@ -949,8 +914,7 @@ static void __open_cb(wifi_aware_data_path_h data_path, wifi_aware_error_e error
                        else
                                printf("Fail to get Port number\n");
                }
-       }
-       else {
+       } else {
                printf("\n>>Fail to open Data path. data path: %p. error: %s\n", data_path, __print_error(error));
        }
 
diff --git a/tests/nan-test/wifi-aware-test.h b/tests/nan-test/wifi-aware-test.h
deleted file mode 100644 (file)
index 4a73218..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Wi-Fi Aware Test Program
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-
- * This file declares functions for testing Wi-Fi aware CAPIs.
- *
- * @file        wifi-aware-test.h
- * @author      Jiung Yu (jiung.yu@samsung.com)
- */
-#ifndef __WIFI_AWARE_TEST_H__
-#define __WIFI_AWARE_TEST_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __WIFI_AWARE_TEST_H__ */
index 0dc3c52..aa32900 100644 (file)
@@ -23,12 +23,14 @@ wifi_aware_publish_h g_publish_config = NULL;
 class WifiAwarePublish : public WifiAware
 {
 protected:
-       virtual void SetUp() {
+       virtual void SetUp()
+       {
                WifiAware::SetUp();
                wifi_aware_publish_create(&g_publish_config);
        }
 
-       virtual void TearDown() {
+       virtual void TearDown()
+       {
                wifi_aware_publish_destroy(g_publish_config);
                WifiAware::TearDown();
        }
index 8c18cf5..9de6db0 100644 (file)
@@ -21,7 +21,8 @@
 class WifiAwareSession : public WifiAware
 {
 protected:
-       virtual void SetUp() {
+       virtual void SetUp()
+       {
                g_published = false;
                g_subscribed = false;
                WifiAware::SetUp();
@@ -29,7 +30,8 @@ protected:
                RUN_GMAIN_LOOP;
        }
 
-       virtual void TearDown() {
+       virtual void TearDown()
+       {
                wifi_aware_disable();
                WifiAware::TearDown();
        }
index 7080207..f5d1132 100644 (file)
@@ -23,12 +23,14 @@ wifi_aware_subscribe_h g_subscribe_config = NULL;
 class WifiAwareSubscribe : public WifiAware
 {
 protected:
-       virtual void SetUp() {
+       virtual void SetUp()
+       {
                WifiAware::SetUp();
                wifi_aware_subscribe_create(&g_subscribe_config);
        }
 
-       virtual void TearDown() {
+       virtual void TearDown()
+       {
                wifi_aware_subscribe_destroy(g_subscribe_config);
                WifiAware::TearDown();
        }
index 2c8afe0..9f2fe96 100644 (file)
@@ -27,7 +27,8 @@
 class WifiAware : public ::testing::Test
 {
 protected:
-       virtual void SetUp() {
+       virtual void SetUp()
+       {
                g_enabled = false;
                g_wifi_aware_supported = false;
                system_info_get_platform_bool(WIFI_AWARE_FEATURE,
@@ -35,7 +36,8 @@ protected:
                wifi_aware_initialize();
        }
 
-       virtual void TearDown() {
+       virtual void TearDown()
+       {
                wifi_aware_deinitialize();
        }
 
index f78a317..7b8f9ed 100644 (file)
 #include "wifi-aware.h"
 
 #define CHECK_WIFI_AWARE_SUPPORTED(ret) do { \
-        if (!WifiAware::g_wifi_aware_supported) { \
-            ASSERT_EQ(ret, WIFI_AWARE_ERROR_NOT_SUPPORTED) << "FAIL NOT_SUPPORTED"; \
-        } \
-    } while (0)
+               if (!WifiAware::g_wifi_aware_supported) { \
+                       ASSERT_EQ(ret, WIFI_AWARE_ERROR_NOT_SUPPORTED) << "FAIL NOT_SUPPORTED"; \
+               } \
+       } while (0)
 
 #define CHECK_RESULT(ret, expected, message) do { \
-        CHECK_WIFI_AWARE_SUPPORTED(ret); \
-        ASSERT_EQ(ret, expected) << "FAIL " << message; \
-    } while (0)
+               CHECK_WIFI_AWARE_SUPPORTED(ret); \
+               ASSERT_EQ(ret, expected) << "FAIL " << message; \
+       } while (0)
 
 #define CALLBACK_TIMEOUT 20000
 #define RUN_GMAIN_LOOP do { \
                WifiAware::g_main_loop = g_main_loop_new(NULL, false); \
-        WifiAware::g_timeout_id = g_timeout_add(CALLBACK_TIMEOUT, \
+               WifiAware::g_timeout_id = g_timeout_add(CALLBACK_TIMEOUT, \
                                WifiAware::_wifi_aware_callback_timeout, WifiAware::g_main_loop); \
-        g_main_loop_run(WifiAware::g_main_loop); \
-        g_source_remove(WifiAware::g_timeout_id); \
-        WifiAware::g_main_loop = NULL; \
-    } while (0)
+               g_main_loop_run(WifiAware::g_main_loop); \
+               g_source_remove(WifiAware::g_timeout_id); \
+               WifiAware::g_main_loop = NULL; \
+       } while (0)
 
 #define QUIT_GMAIN_LOOP do { \
-        if (WifiAware::g_main_loop) { \
-            g_main_loop_quit(WifiAware::g_main_loop); \
-            WifiAware::g_main_loop = NULL; \
-        } \
-    } while (0)
+               if (WifiAware::g_main_loop) { \
+                       g_main_loop_quit(WifiAware::g_main_loop); \
+                       WifiAware::g_main_loop = NULL; \
+               } \
+       } while (0)
 
 #define SERVICE_NAME "NanService"
 #define SERVICE_INFO "ServiceInfo"