Send txpower in enable_wifi_tethering and reload_wifi_settings call
[platform/core/api/tethering.git] / src / tethering.c
index 9d76233..9082884 100755 (executable)
@@ -369,6 +369,9 @@ static void __handle_dhcp(GDBusConnection *connection, const gchar *sender_name,
                goto DONE;
        }
 
+       SINFO("[%s] type %d, ip %s, mac %s, name %s, timestamp %d",
+                buf, ap_type, ip, mac, name, timestamp);
+
        ccb = th->changed_cb[type];
        if (ccb == NULL)
                goto DONE;
@@ -405,6 +408,8 @@ static void __handle_net_closed(GDBusConnection *connection, const gchar *sender
        void *data = NULL;
        tethering_disabled_cause_e code = TETHERING_DISABLED_BY_NETWORK_CLOSE;
 
+       SINFO("Tethering Disabled by network close !");
+
        for (type = TETHERING_TYPE_USB; type <= TETHERING_TYPE_BT; type++) {
                dcb = th->disabled_cb[type];
                if (dcb == NULL)
@@ -786,6 +791,8 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                        TETHERING_SERVICE_OBJECT_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
                        sigs[E_SIGNAL_WIFI_TETHER_ON].cb, (gpointer)th, NULL);
 
+       SINFO("Tethering enabled event ! error(%d)", error);
+
        if (!ecb) {
                INFO("-\n");
                return;
@@ -1305,6 +1312,7 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se
        set->mac_filter = th->mac_filter;
        set->max_connected = th->wifi_max_connected;
        set->channel = th->channel;
+       set->txpower = th->txpower;
 
        __get_wifi_mode_type(th->mode_type, &ptr);
        if (ptr == NULL) {
@@ -1413,6 +1421,7 @@ API int tethering_create(tethering_h *tethering)
        th->channel = TETHERING_WIFI_CHANNEL;
        th->mode_type = TETHERING_WIFI_MODE_TYPE_G;
        th->wifi_max_connected = TETHERING_WIFI_MAX_STA;
+       th->txpower = TETHERING_WIFI_MAX_TXPOWER;
 
        if (__generate_initial_passphrase(th->passphrase,
                        sizeof(th->passphrase)) == 0) {
@@ -1427,6 +1436,10 @@ API int tethering_create(tethering_h *tethering)
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
+       SINFO("ssid: %s, key: %s, channel: %d, mode: %d, txpower: %d, security: %d max_device: %d\n",
+                ssid, th->passphrase, th->channel, th->mode_type, th->txpower, th->sec_type,
+                th->wifi_max_connected);
+
 #if !GLIB_CHECK_VERSION(2, 36, 0)
        g_type_init();
 #endif
@@ -1566,8 +1579,12 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
 
+               SINFO("ssid %s, key %s, channel %d, mode %s, txpower %d, security %d max_device %d\n",
+                        set.ssid, set.key, set.channel, set.mode, set.txpower, set.sec_type,
+                        set.max_connected);
+
                g_dbus_proxy_call(proxy, "enable_wifi_tethering",
-                               g_variant_new("(sssiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, TETHERING_ADDRESS_FAMILY_IPV4),
+                               g_variant_new("(sssiiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, set.txpower, TETHERING_ADDRESS_FAMILY_IPV4),
                                G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
                                (GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
                break;
@@ -1703,10 +1720,15 @@ API int tethering_ipv6_enable(tethering_h tethering, tethering_type_e type)
                }
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
-                       g_dbus_proxy_call(proxy, "enable_wifi_tethering",
-                               g_variant_new("(sssiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, TETHERING_ADDRESS_FAMILY_IPV6),
-                               G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
-                               (GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
+
+               SINFO("ssid %s, key %s, channel %d, mode %s, txpower %d, security %d max_device %d\n",
+                       set.ssid, set.key, set.channel, set.mode, set.txpower, set.sec_type,
+                       set.max_connected);
+
+               g_dbus_proxy_call(proxy, "enable_wifi_tethering",
+                       g_variant_new("(sssiiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, set.txpower, TETHERING_ADDRESS_FAMILY_IPV6),
+                       G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+                       (GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
                break;
         }
 
@@ -3300,8 +3322,12 @@ API int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_set
        th->settings_reloaded_cb = callback;
        th->settings_reloaded_user_data = user_data;
 
+       SINFO("ssid %s, key %s, channel %d, mode %s, txpower %d, security %d max_device %d\n",
+                set.ssid, set.key, set.channel, set.mode, set.txpower, set.sec_type,
+                set.max_connected);
+
        g_dbus_proxy_call(proxy, "reload_wifi_settings",
-                       g_variant_new("(sssiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type),
+                       g_variant_new("(sssiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, set.txpower),
                        G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
                        (GAsyncReadyCallback) __settings_reloaded_cb, (gpointer)tethering);
 
@@ -3641,6 +3667,7 @@ API int tethering_wifi_set_txpower(tethering_h tethering, unsigned int txpower)
                        TETHERING_ERROR_NOT_ENABLED,
                        "tethering type[%d] is not enabled\n", TETHERING_TYPE_WIFI);
        __tethering_h *th = (__tethering_h *)tethering;
+       th->txpower = txpower;
 
        g_dbus_proxy_call_sync(th->client_bus_proxy, "hostapd_set_txpower",
                        g_variant_new("(u)", txpower),