Send txpower in enable_wifi_tethering and reload_wifi_settings call 35/239035/1
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 21 Jul 2020 07:56:38 +0000 (13:26 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 21 Jul 2020 07:56:38 +0000 (13:26 +0530)
Change-Id: I39347e727d6aa31cd3e7552203994e0e00014ad1
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
include/tethering_private.h
packaging/capi-network-tethering.spec
src/tethering.c

index ff6e579..06b3268 100644 (file)
@@ -40,6 +40,7 @@ extern "C" {
 #define DBG(fmt, args...)      LOGD(fmt, ##args)
 #define WARN(fmt, args...)     LOGW(fmt, ##args)
 #define ERR(fmt, args...)      LOGE(fmt, ##args)
+#define SINFO(fmt, args...)    SECURE_LOGI(fmt, ##args)
 #define SDBG(fmt, args...)     SECURE_LOGD(fmt, ##args)
 #define SERR(fmt, args...)     SECURE_LOGE(fmt, ##args)
 
@@ -237,6 +238,7 @@ typedef enum {
 #define TETHERING_WIFI_KEY_MAX_LEN     64      /**< Maximum length of wifi key */
 #define TETHERING_WIFI_HASH_KEY_MAX_LEN        64
 #define TETHERING_WIFI_MAX_STA 10              /**< Maximum Wi-Fi tethering station */
+#define TETHERING_WIFI_MAX_TXPOWER     100           /**< Default max TX POWER */
 
 #define TETHERING_WIFI_MODE_MAX_LEN 10  /**< Maximum length of mode */
 
@@ -301,6 +303,7 @@ typedef struct {
        bool dhcp_enabled;
        int channel;
        int wifi_max_connected;
+       unsigned int txpower;
 } __tethering_h;
 
 typedef struct {
@@ -328,6 +331,7 @@ typedef struct {
        bool mac_filter;
        int max_connected;
        int channel;
+       unsigned int txpower;
 } _softap_settings_t;
 
 void _tethering_add_handle(tethering_h handle);
index a2ebc2d..99c920c 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-tethering
 Summary:       Tethering Framework
-Version:       1.0.58
+Version:       1.0.59
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
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),