Do not emit changed signal 65/187365/1
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 22 Aug 2018 08:59:40 +0000 (17:59 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 22 Aug 2018 08:59:47 +0000 (17:59 +0900)
changed signal will be emitted on daemon side

Change-Id: I0ff6acae1c7856bdefb7a50da7a42ef2b983b3c8

packaging/capi-network-softap.spec
src/softap.c
test/softap_test.c

index 742afe27837ee40c6bc3a2bbe05d2745ed57309f..ff5a3f6941a620997bd65a355c00e4337542ca37 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-softap
 Summary:       Softap Framework
-Version:       0.0.24
+Version:       0.0.25
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index de4c7f6b84e859e06c699bcbf505e92555e9d92d..bcbe90de1e520e31a7cb4d3b5c187a01303e4d1c 100755 (executable)
@@ -76,29 +76,6 @@ static __softap_sig_t sigs[] = {
 
 static int retry = 0;
 
-#if 0
-static void __send_dbus_signal(GDBusConnection *conn, const char *signal_name, const char *arg)
-{
-       if (conn == NULL || signal_name == NULL)
-               return;
-
-       GVariant *message = NULL;
-       GError *error = NULL;
-
-       if (arg)
-               message = g_variant_new("(s)", arg);
-
-       g_dbus_connection_emit_signal(conn, NULL, SOFTAP_SERVICE_OBJECT_PATH,
-                                       SOFTAP_SERVICE_INTERFACE, signal_name, message, &error);
-       if (error) {
-//LCOV_EXCL_START
-               ERR("g_dbus_connection_emit_signal is failed because  %s\n", error->message);
-               g_error_free(error);
-//LCOV_EXCL_END
-       }
-}
-#endif
-
 static int __get_common_ssid(char *ssid, unsigned int size)
 {
        if (ssid == NULL) {
@@ -444,28 +421,15 @@ static void __handle_security_type_changed(GDBusConnection *connection, const gc
 
        softap_security_type_changed_cb scb = NULL;
        void *data = NULL;
-       softap_security_type_e security_type;
-       char *buf = NULL;
+       int security_type;
 
        scb = sa->security_type_changed_cb;
        if (scb == NULL)
                return;
 
-       g_variant_get(parameters, "(s)", &buf);
+       g_variant_get(parameters, "(i)", &security_type);
        data = sa->security_type_user_data;
-       if (g_strcmp0(buf, SOFTAP_SECURITY_TYPE_OPEN_STR) == 0)
-               security_type = SOFTAP_SECURITY_TYPE_NONE;
-       else if (g_strcmp0(buf, SOFTAP_SECURITY_TYPE_WPA2_PSK_STR) == 0)
-               security_type = SOFTAP_SECURITY_TYPE_WPA2_PSK;
-       else if (g_strcmp0(buf, SOFTAP_SECURITY_TYPE_WPS_STR) == 0)
-               security_type = SOFTAP_SECURITY_TYPE_WPS;
-       else {
-               SERR("Unknown type : %s", buf);
-               g_free(buf);
-               return;
-       }
-       g_free(buf);
-       scb(security_type, data);
+       scb((softap_security_type_e)security_type, data);
 
        return;
 }
@@ -481,21 +445,16 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
 
        softap_ssid_visibility_changed_cb scb = NULL;
        void *data = NULL;
-       bool visible = false;
-       char *buf = NULL;
+       int visible = 0;
 
        scb = sa->ssid_visibility_changed_cb;
        if (scb == NULL) {
                DBG("-");
                return;
        }
-       g_variant_get(parameters, "(s)", &buf);
+       g_variant_get(parameters, "(i)", &visible);
        data = sa->ssid_visibility_user_data;
-       if (g_strcmp0(buf, SIGNAL_MSG_SSID_VISIBLE) == 0)
-               visible = true;
-
        scb(visible, data);
-       g_free(buf);
        DBG("-");
 }
 
index 94909a8559ce317898db788f12c3c7ce8d93ee30..4db27b418b2b0f3df467131319237dccdf881505 100755 (executable)
@@ -133,11 +133,17 @@ static void __security_changed_cb(softap_security_type_e changed_type, void *use
 
 static void __ssid_visibility_changed_cb(bool changed_visible, void *user_data)
 {
-       g_print("SSID visibility forSoftap changed to [%s]\n",
+       g_print("SSID visibility is changed to [%s]\n",
                        changed_visible ? "visible" : "invisible");
        return;
 }
 
+static void __passphrase_changed_cb(void *user_data)
+{
+
+       g_print("Passphrase is changed\n");
+}
+
 static bool __clients_foreach_cb(softap_client_h client, void *data)
 {
        softap_client_h clone = NULL;
@@ -250,6 +256,10 @@ static void __register_cbs(void)
        if (ret != SOFTAP_ERROR_NONE)
                printf("Fail to set visibility changed callback!!\n");
 
+       ret = softap_set_passphrase_changed_cb(sa, __passphrase_changed_cb, NULL);
+       if (ret != SOFTAP_ERROR_NONE)
+               printf("Fail to set passphrase changed callback!!\n");
+
        ret = softap_set_client_connection_state_changed_cb(sa, __connection_state_changed_cb, NULL);
        if (ret != SOFTAP_ERROR_NONE)
                printf("Fail to set client connection state changed callback!!\n");