summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2023-10-25 12:16:28 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2023-10-25 16:11:53 +0900
commit176cb03d6b7cc9265a6d3d11e92a7335c57ff245 (patch)
tree6c53ddeea5cb88f367526eb0c40f41d05e20fdb5
parent287b39a54e17a3b4bcd400fd89e57d4bc4449b92 (diff)
downloadconnman-176cb03d6b7cc9265a6d3d11e92a7335c57ff245.tar.gz
connman-176cb03d6b7cc9265a6d3d11e92a7335c57ff245.tar.bz2
connman-176cb03d6b7cc9265a6d3d11e92a7335c57ff245.zip
Add ApSelectionMethod config option
Global config option, which allow to select the AP selection method to use when connecting to an AP. Existing AP selection methods have also been modified to use this option. Change-Id: I2e3be557ac0567507f5a098205d788c5f47b2700 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rw-r--r--Makefile.am2
-rwxr-xr-xclient/commands.c10
-rw-r--r--configure.ac7
-rwxr-xr-xgsupplicant/gsupplicant.h9
-rwxr-xr-xgsupplicant/supplicant.c122
-rwxr-xr-xinclude/network.h6
-rwxr-xr-xinclude/setting.h12
-rw-r--r--packaging/connman.spec3
-rwxr-xr-xplugins/wifi.c106
-rwxr-xr-xsrc/connman.h4
-rwxr-xr-xsrc/device.c14
-rwxr-xr-xsrc/main.c14
-rwxr-xr-xsrc/main.conf5
-rwxr-xr-xsrc/main_robot.conf5
-rwxr-xr-xsrc/main_tv.conf5
-rwxr-xr-xsrc/manager.c9
-rwxr-xr-xsrc/network.c12
-rwxr-xr-xsrc/service.c310
-rwxr-xr-xsrc/storage.c8
-rwxr-xr-xsrc/wispr.c5
20 files changed, 339 insertions, 329 deletions
diff --git a/Makefile.am b/Makefile.am
index 60653d97..9a756a49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -373,9 +373,7 @@ if TIZEN_EXT_WIFI_MESH
client_connmanctl_SOURCES += client/mesh.c client/mesh.h
endif
-if TIZEN_EXT_INS
client_connmanctl_SOURCES += client/ins.c client/ins.h
-endif
client_connmanctl_LDADD = gdbus/libgdbus-internal.la @DBUS_LIBS@ @GLIB_LIBS@ @DLOG_LIBS@ \
-lreadline -ldl -lncurses
diff --git a/client/commands.c b/client/commands.c
index b7316c54..2fd8af54 100755
--- a/client/commands.c
+++ b/client/commands.c
@@ -39,7 +39,7 @@
#include "dbus_helpers.h"
#include "input.h"
#include "services.h"
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
#include "ins.h"
#endif
#include "tethering.h"
@@ -331,7 +331,7 @@ static int services_list(DBusMessageIter *iter, int errnum, const char *error,
return 0;
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static int ins_list(DBusMessageIter *iter, int errnum,
const char *error, void *user_data)
{
@@ -445,7 +445,7 @@ static int cmd_services(char *args[], int num, struct connman_option *options)
object_properties, path, NULL, NULL);
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static int cmd_ins(char *args[], int num, struct connman_option *options)
{
char *filter = NULL;
@@ -3043,7 +3043,7 @@ static struct connman_option service_options[] = {
{ NULL, }
};
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static struct connman_option ins_options[] = {
{"all", 'a', ""},
{"filter-ssid", 's', "ssid"},
@@ -3507,7 +3507,7 @@ static const struct {
"Display tethering clients", NULL },
{ "services", "[<service>]", service_options, cmd_services,
"Display services", lookup_service_arg },
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
{ "ins", NULL, ins_options, cmd_ins,
"Display intelligent network selection", NULL },
#endif
diff --git a/configure.ac b/configure.ac
index 9e8a42f9..9a2f65d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,13 +80,6 @@ AC_ARG_ENABLE(tizen-ext,
fi])
AM_CONDITIONAL(TIZEN_EXT, test "${enable-tizen-ext}" != "no")
-AC_ARG_ENABLE(tizen-ext-ins,
- AS_HELP_STRING([--enable-tizen-ext-ins], [enable TIZEN extensions for INS]),
- [if (test "${enableval}" = "yes"); then
- CFLAGS="$CFLAGS -DTIZEN_EXT_INS"
- fi])
-AM_CONDITIONAL(TIZEN_EXT_INS, test "${enable_tizen_ext_ins}" != "no")
-
AC_ARG_ENABLE(tizen-ext-wifi-mesh,
AS_HELP_STRING([--enable-tizen-ext-wifi-mesh], [enable TIZEN extensions for Wi-Fi Mesh]),
[CFLAGS="$CFLAGS -DTIZEN_EXT_WIFI_MESH"], [enable_tizen_ext_wifi_mesh="no"])
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index f49ad803..61b63dd6 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -307,13 +307,11 @@ struct g_connman_bssids {
bool is_last_connected;
unsigned int est_throughput;
int score_snr;
-#if defined TIZEN_EXT_INS
int score_last_connected_bssid;
int score_assoc_reject;
int score_frequency;
int score_strength;
int score_est_throughput;
-#endif
int ins_score;
};
#endif
@@ -559,8 +557,7 @@ void g_supplicant_network_set_bss_signal(GSupplicantNetwork *network,
int signal, int snr);
GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface,
const char *group);
-#endif
-#if defined TIZEN_EXT_INS
+
void g_supplicant_network_set_last_connected_bssid(GSupplicantNetwork *network, const unsigned char *bssid);
const unsigned char *g_supplicant_network_get_last_connected_bssid(GSupplicantNetwork *network);
void g_supplicant_network_update_assoc_reject(GSupplicantInterface *interface,
@@ -625,12 +622,12 @@ struct _GSupplicantCallbacks {
typedef struct _GSupplicantCallbacks GSupplicantCallbacks;
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
void g_supplicant_set_ins_settings(GSupplicantINSPreferredFreq preferred_freq_bssid,
bool last_connected_bssid, bool assoc_reject, bool signal_bssid,
unsigned int preferred_freq_bssid_score, unsigned int last_connected_bssid_score,
unsigned int assoc_reject_score, int signal_level3_5ghz, int signal_level3_24ghz);
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
void g_supplicant_replace_config_file(const char *ifname, const char *config_file);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 0f44766d..cdf6007c 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -175,7 +175,7 @@ static struct strvalmap mode_capa_map[] = {
{ }
};
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
struct _GSupplicantINSSettings {
GSupplicantINSPreferredFreq preferred_freq_bssid;
unsigned int preferred_freq_bssid_score;
@@ -189,13 +189,11 @@ struct _GSupplicantINSSettings {
};
static struct _GSupplicantINSSettings ins_settings;
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
-#if defined TIZEN_EXT_INS
static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-#endif
+#endif /* defined TIZEN_EXT */
static GHashTable *interface_table;
static GHashTable *bss_mapping;
@@ -457,9 +455,7 @@ struct assoc_count_data {
int assoc_count;
};
-#if defined TIZEN_EXT_INS
static unsigned int last_connected_bss_timeout = 0;
-#endif
static bool simplified_log = true;
#endif
@@ -2031,7 +2027,6 @@ void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network)
return vsie_list;
}
-#if defined TIZEN_EXT_INS
static bool compare_bssid(unsigned char *bssid_a, unsigned char *bssid_b)
{
if (!memcmp(bssid_a, bssid_b, WIFI_BSSID_LEN_MAX))
@@ -2199,7 +2194,6 @@ static int calculate_score(bool is_last_connected, uint16_t assoc_reject_cnt,
return score;
}
-#endif /* defined TIZEN_EXT_INS */
static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
{
@@ -2222,22 +2216,23 @@ static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
bssids->est_throughput = bss->est_throughput;
bssids->score_snr = (int)bss->snr;
-#if defined TIZEN_EXT_INS
- bssids->assoc_reject_cnt = get_assoc_reject_cnt(bssid_data->assoc_reject_table, bssids->bssid);
- bssids->is_last_connected = compare_bssid(bssids->bssid, bssid_data->last_connected_bssid);
+ if (TIZEN_INS_ENABLED) {
+ bssids->assoc_reject_cnt = get_assoc_reject_cnt(bssid_data->assoc_reject_table, bssids->bssid);
+ bssids->is_last_connected = compare_bssid(bssids->bssid, bssid_data->last_connected_bssid);
- bssids->score_last_connected_bssid = calculate_score_last_connected_bssid(bssids->is_last_connected);
- bssids->score_assoc_reject = calculate_score_assoc_reject(bssids->assoc_reject_cnt);
- bssids->score_frequency = calculate_score_frequency(bss->signal, bssids->frequency);
- bssids->score_strength = calculate_score_strength(bss->signal);
- bssids->score_est_throughput = calculate_score_est_throughput(bss->est_throughput);
+ bssids->score_last_connected_bssid = calculate_score_last_connected_bssid(bssids->is_last_connected);
+ bssids->score_assoc_reject = calculate_score_assoc_reject(bssids->assoc_reject_cnt);
+ bssids->score_frequency = calculate_score_frequency(bss->signal, bssids->frequency);
+ bssids->score_strength = calculate_score_strength(bss->signal);
+ bssids->score_est_throughput = calculate_score_est_throughput(bss->est_throughput);
+
+ bssids->ins_score = calculate_score(bssids->is_last_connected,
+ bssids->assoc_reject_cnt, bssids->frequency, bss->signal,
+ bss->snr, bss->est_throughput);
+ } else {
+ bssids->ins_score = bss->signal;
+ }
- bssids->ins_score = calculate_score(bssids->is_last_connected,
- bssids->assoc_reject_cnt, bssids->frequency, bss->signal,
- bss->snr, bss->est_throughput);
-#else
- bssids->ins_score = bss->signal;
-#endif
bssid_data->bssid_list = g_slist_append(bssid_data->bssid_list, bssids);
} else
SUPPLICANT_DBG("Failed to allocate memory");
@@ -2264,7 +2259,6 @@ static gint cmp_bss(gconstpointer a, gconstpointer b)
return 0;
}
-#if defined TIZEN_EXT_INS
static void print_bssid_sort(gpointer data, gpointer user_data)
{
struct g_connman_bssids *bssids = data;
@@ -2274,14 +2268,12 @@ static void print_bssid_sort(gpointer data, gpointer user_data)
if (!bssids || !network)
return;
- if (!simplified_log)
- SUPPLICANT_DBG("ssid [%-20s] bssid[" MACSTR "] total[%2d] freq[%2d] "
- "last_conn[%2d] assoc_reject[%2d] strength[%2d] rssi[%2d]",
- network->ssid, MAC2STR(bssids->bssid), bssids->ins_score,
- bssids->score_frequency, bssids->score_last_connected_bssid,
- bssids->score_assoc_reject, bssids->score_strength, bssids->strength - 120);
+ SUPPLICANT_DBG("ssid [%-20s] bssid[" MACSTR "] total[%2d] freq[%2d] "
+ "last_conn[%2d] assoc_reject[%2d] strength[%2d] rssi[%2d]",
+ network->ssid, MAC2STR(bssids->bssid), bssids->ins_score,
+ bssids->score_frequency, bssids->score_last_connected_bssid,
+ bssids->score_assoc_reject, bssids->score_strength, bssids->strength - 120);
}
-#endif
void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network)
{
@@ -2297,14 +2289,12 @@ void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network)
g_hash_table_foreach(network->bss_table, update_bssid_list, &bssid_data);
bssid_data.bssid_list = g_slist_sort(bssid_data.bssid_list, cmp_bss);
-#if defined TIZEN_EXT_INS
- g_slist_foreach(bssid_data.bssid_list, print_bssid_sort, (gpointer)network);
-#endif
+ if (TIZEN_INS_ENABLED && !simplified_log)
+ g_slist_foreach(bssid_data.bssid_list, print_bssid_sort, (gpointer)network);
return bssid_data.bssid_list;
}
-#if defined TIZEN_EXT_INS
void g_supplicant_network_set_last_connected_bssid(GSupplicantNetwork *network, const unsigned char *bssid)
{
if (!bssid)
@@ -2405,7 +2395,6 @@ GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *ne
return cloned_assoc_reject_table;
}
-#endif /* defined TIZEN_EXT_INS */
GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface,
const char *group)
@@ -2693,21 +2682,21 @@ static bool update_best_bss(GSupplicantNetwork *network,
return true;
}
-#if defined TIZEN_EXT_INS
- score_new = calculate_score(
- compare_bssid(bss->bssid, network->last_connected_bssid),
- get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
- bss->frequency, bss->signal, bss->snr, bss->est_throughput);
+ if (TIZEN_INS_ENABLED) {
+ score_new = calculate_score(
+ compare_bssid(bss->bssid, network->last_connected_bssid),
+ get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
+ bss->frequency, bss->signal, bss->snr, bss->est_throughput);
- score_best = calculate_score(
- compare_bssid(network->best_bss->bssid, network->last_connected_bssid),
- get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
- network->best_bss->frequency, network->best_bss->signal,
- network->best_bss->snr, network->best_bss->est_throughput);
-#else
- score_new = bss->signal;
- score_best = network->best_bss->signal;
-#endif
+ score_best = calculate_score(
+ compare_bssid(network->best_bss->bssid, network->last_connected_bssid),
+ get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
+ network->best_bss->frequency, network->best_bss->signal,
+ network->best_bss->snr, network->best_bss->est_throughput);
+ } else {
+ score_new = bss->signal;
+ score_best = network->best_bss->signal;
+ }
if (score_new > score_best) {
SUPPLICANT_DBG("new[" MACSTR "][%d] : best[" MACSTR "][%d]",
@@ -3579,7 +3568,7 @@ static void update_network_signal(GSupplicantNetwork *network)
SUPPLICANT_DBG("New network signal %d", network->signal);
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static gboolean last_connected_timeout(gpointer data)
{
GSupplicantInterface *interface = data;
@@ -3630,7 +3619,7 @@ static void remove_timer_for_last_connected(GSupplicantInterface *interface)
}
}
}
-#endif /* defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static void interface_current_bss(GSupplicantInterface *interface,
DBusMessageIter *iter)
@@ -3727,8 +3716,9 @@ static void interface_current_bss(GSupplicantInterface *interface,
case G_SUPPLICANT_STATE_GROUP_HANDSHAKE:
case G_SUPPLICANT_STATE_COMPLETED:
callback_network_associated(network);
-#if defined TIZEN_EXT_INS
- add_timer_for_last_connected(interface);
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED)
+ add_timer_for_last_connected(interface);
#endif
break;
}
@@ -3886,16 +3876,18 @@ static void interface_property(const char *key, DBusMessageIter *iter,
interface->state = string2state(str);
callback_interface_state(interface);
}
-#if defined TIZEN_EXT_INS
- switch (interface->state) {
- case G_SUPPLICANT_STATE_COMPLETED:
- add_timer_for_last_connected(interface);
- break;
- case G_SUPPLICANT_STATE_DISCONNECTED:
- remove_timer_for_last_connected(interface);
- break;
- default:
- break;
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ switch (interface->state) {
+ case G_SUPPLICANT_STATE_COMPLETED:
+ add_timer_for_last_connected(interface);
+ break;
+ case G_SUPPLICANT_STATE_DISCONNECTED:
+ remove_timer_for_last_connected(interface);
+ break;
+ default:
+ break;
+ }
}
#endif
if (interface->ap_create_in_progress) {
@@ -8830,7 +8822,7 @@ static void invoke_introspect_method(void)
dbus_message_unref(message);
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
void g_supplicant_set_ins_settings(GSupplicantINSPreferredFreq preferred_freq_bssid,
bool last_connected_bssid, bool assoc_reject, bool signal_bssid,
unsigned int preferred_freq_bssid_score, unsigned int last_connected_bssid_score,
@@ -8856,7 +8848,7 @@ void g_supplicant_set_ins_settings(GSupplicantINSPreferredFreq preferred_freq_bs
SUPPLICANT_DBG("signal_level3_5ghz [%d]", signal_level3_5ghz);
SUPPLICANT_DBG("signal_level3_24ghz [%d]", signal_level3_24ghz);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
void g_supplicant_register_eap_callback(g_supplicant_eap_callback cb)
diff --git a/include/network.h b/include/network.h
index 9f1a6118..f9bd3c0a 100755
--- a/include/network.h
+++ b/include/network.h
@@ -79,12 +79,10 @@ struct connman_bssids {
uint16_t frequency;
uint16_t assoc_reject_cnt;
bool is_last_connected;
-#if defined TIZEN_EXT_INS
int score_last_connected_bssid;
int score_assoc_reject;
int score_frequency;
int score_strength;
-#endif
int ins_score;
};
@@ -236,14 +234,14 @@ int connman_network_set_bssid_list(struct connman_network *network,
GSList *bssids);
void *connman_network_get_bssid_list(struct connman_network *network);
unsigned int connman_network_get_max_bssid_count(struct connman_network *network);
-#if defined TIZEN_EXT_INS
+
int connman_network_set_last_connected_bssid(struct connman_network *network,
const unsigned char *bssid);
unsigned char *connman_network_get_last_connected_bssid(struct connman_network *network);
void connman_network_set_assoc_reject_table(struct connman_network *network,
GHashTable *assoc_reject_table);
GHashTable *connman_network_get_assoc_reject_table(struct connman_network *network);
-#endif /* defined TIZEN_EXT_INS */
+
__time_t connman_network_get_roam_scan_time(struct connman_network *network);
void connman_network_set_roam_scan_time(struct connman_network *network,
__time_t roam_scan_time);
diff --git a/include/setting.h b/include/setting.h
index f141bf68..4fb4957b 100755
--- a/include/setting.h
+++ b/include/setting.h
@@ -28,10 +28,20 @@
extern "C" {
#endif
-bool connman_setting_get_bool(const char *key);
#if defined TIZEN_EXT
+/* AP selection method to be used */
+typedef enum {
+ AP_SELECTION_METHOD_NORMAL = 0,
+ AP_SELECTION_METHOD_INS = 1,
+} ap_selection_method_e;
+
+#define TIZEN_INS_ENABLED \
+ (connman_setting_get_int("ApSelectionMethod") == AP_SELECTION_METHOD_INS)
+
int connman_setting_get_int(const char *key);
#endif
+
+bool connman_setting_get_bool(const char *key);
unsigned int connman_setting_get_uint(const char *key);
char *connman_setting_get_string(const char *key);
char **connman_setting_get_string_list(const char *key);
diff --git a/packaging/connman.spec b/packaging/connman.spec
index 9ef738ad..c97b261d 100644
--- a/packaging/connman.spec
+++ b/packaging/connman.spec
@@ -174,8 +174,7 @@ chmod +x bootstrap
--sysconfdir=/etc \
--enable-client \
--enable-tizen-ext \
- --disable-tizen-ext-ins \
- --enable-tizen-ext-eap-on-ethernet \
+ --enable-tizen-ext-eap-on-ethernet \
--enable-pacrunner \
--enable-wifi=builtin \
%if %{with connman_openconnect}
diff --git a/plugins/wifi.c b/plugins/wifi.c
index f19dd8f3..68f34313 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -5012,19 +5012,19 @@ static void interface_state(GSupplicantInterface *interface)
GSList *bssid_list = NULL;
guint bssid_length = 0;
-#if defined TIZEN_EXT_INS
- const char *group = connman_network_get_group(network);
- GSupplicantNetwork *supplicant_network;
+ if (TIZEN_INS_ENABLED) {
+ const char *group = connman_network_get_group(network);
+ GSupplicantNetwork *supplicant_network;
- if (group) {
- supplicant_network = g_supplicant_interface_get_network(interface, group);
+ if (group) {
+ supplicant_network = g_supplicant_interface_get_network(interface, group);
- connman_network_set_assoc_reject_table(network,
- g_supplicant_network_clone_assoc_reject_table(supplicant_network));
+ connman_network_set_assoc_reject_table(network,
+ g_supplicant_network_clone_assoc_reject_table(supplicant_network));
- g_supplicant_network_update_assoc_reject(interface, supplicant_network);
+ g_supplicant_network_update_assoc_reject(interface, supplicant_network);
+ }
}
-#endif
bssid_list = (GSList *)connman_network_get_bssid_list(network);
if (bssid_list)
@@ -5686,12 +5686,13 @@ static void network_added(GSupplicantNetwork *supplicant_network)
g_supplicant_network_is_hs20AP(supplicant_network));
connman_network_set_bssid_list(network,
(GSList *)g_supplicant_network_get_bssid_list(supplicant_network));
-#endif
-#if defined TIZEN_EXT_INS
- connman_network_set_last_connected_bssid(network,
- g_supplicant_network_get_last_connected_bssid(supplicant_network));
- connman_network_set_assoc_reject_table(network,
- g_supplicant_network_clone_assoc_reject_table(supplicant_network));
+
+ if (TIZEN_INS_ENABLED) {
+ connman_network_set_last_connected_bssid(network,
+ g_supplicant_network_get_last_connected_bssid(supplicant_network));
+ connman_network_set_assoc_reject_table(network,
+ g_supplicant_network_clone_assoc_reject_table(supplicant_network));
+ }
#endif
connman_network_set_available(network, true);
@@ -5704,12 +5705,11 @@ static void network_added(GSupplicantNetwork *supplicant_network)
#endif
connman_network_set_group(network, group);
-#if defined TIZEN_EXT_INS
- g_supplicant_network_set_last_connected_bssid(supplicant_network,
- connman_network_get_last_connected_bssid(network));
-#endif
-
#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED)
+ g_supplicant_network_set_last_connected_bssid(supplicant_network,
+ connman_network_get_last_connected_bssid(network));
+
if (wifi_first_scan == true)
found_with_first_scan = true;
#endif
@@ -5870,35 +5870,39 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
calculate_strength(network));
update_needed = true;
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
- else if (g_str_equal(property, "LastConnectedBSSID")) {
- const char *ident, *group;
- char *service_ident;
- bool need_save;
-
- ident = connman_device_get_ident(wifi->device);
- group = connman_network_get_group(connman_network);
- if (ident && group) {
- service_ident = g_strdup_printf("%s_%s_%s",
- __connman_network_get_type(connman_network), ident, group);
-
- need_save = connman_device_set_last_connected_ident(wifi->device, service_ident);
- if (need_save)
- connman_device_save_last_connected(wifi->device);
-
- g_free(service_ident);
- }
+#if defined TIZEN_EXT
+ else if (TIZEN_INS_ENABLED) {
+ if (g_str_equal(property, "LastConnectedBSSID")) {
+ const char *ident, *group;
+ char *service_ident;
+ bool need_save;
+
+ ident = connman_device_get_ident(wifi->device);
+ group = connman_network_get_group(connman_network);
+ if (ident && group) {
+ service_ident = g_strdup_printf("%s_%s_%s",
+ __connman_network_get_type(connman_network), ident, group);
+
+ need_save = connman_device_set_last_connected_ident(wifi->device, service_ident);
+ if (need_save)
+ connman_device_save_last_connected(wifi->device);
+
+ g_free(service_ident);
+ }
- connman_network_set_last_connected_bssid(connman_network,
+ connman_network_set_last_connected_bssid(connman_network,
g_supplicant_network_get_last_connected_bssid(network));
- update_needed = true;
- } else if (g_str_equal(property, "UpdateAssocReject")) {
- connman_network_set_assoc_reject_table(connman_network,
- g_supplicant_network_clone_assoc_reject_table(network));
- update_needed = true;
+ update_needed = true;
+ } else if (g_str_equal(property, "UpdateAssocReject")) {
+ connman_network_set_assoc_reject_table(connman_network,
+ g_supplicant_network_clone_assoc_reject_table(network));
+ update_needed = true;
+ } else {
+ update_needed = false;
+ }
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
else
update_needed = false;
@@ -6778,7 +6782,7 @@ static int tech_set_regdom(struct connman_technology *technology, const char *al
return g_supplicant_set_country(alpha2, regdom_callback, NULL);
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static void supp_ins_init(void)
{
const char *string;
@@ -6803,7 +6807,7 @@ static void supp_ins_init(void)
connman_setting_get_int("INSSignalLevel3_2_4GHz")
);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static struct connman_technology_driver tech_driver = {
.name = "wifi",
@@ -6855,11 +6859,9 @@ static int wifi_init(void)
DBG("Min SNR: %d, Min RSSI: %d(2.4GHz), %d(5GHz), %d(6GHz)",
min_snr, min_rssi_2_4GHz, min_rssi_5GHz, min_rssi_6GHz);
-#endif
-
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
- supp_ins_init();
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+ if (TIZEN_INS_ENABLED)
+ supp_ins_init();
+#endif /* defined TIZEN_EXT */
return 0;
}
diff --git a/src/connman.h b/src/connman.h
index db51e04e..e6e16d11 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -758,11 +758,9 @@ int __connman_service_move(struct connman_service *service,
int __connman_service_load_modifiable(struct connman_service *service);
void __connman_service_list_struct(DBusMessageIter *iter);
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
void __connman_ins_list_struct(DBusMessageIter *iter);
-#endif
-#if defined TIZEN_EXT
int connman_service_get_ipv6_dns_method(struct connman_service *service);
enum connman_dnsconfig_method {
CONNMAN_DNSCONFIG_METHOD_UNKNOWN = 0,
diff --git a/src/device.c b/src/device.c
index 1e3924b9..9ba52c27 100755
--- a/src/device.c
+++ b/src/device.c
@@ -883,7 +883,7 @@ const char *connman_device_get_last_connected_ident(struct connman_device *devic
}
#endif
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
void connman_device_save_last_user_selection(struct connman_device *device)
{
GKeyFile *keyfile;
@@ -1017,7 +1017,7 @@ void connman_device_load_last_connected(struct connman_device *device)
g_key_file_free(keyfile);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static void mark_network_available(gpointer key, gpointer value,
gpointer user_data)
@@ -2062,10 +2062,12 @@ struct connman_device *connman_device_create_from_index(int index)
connman_device_set_index(device, index);
connman_device_set_interface(device, devname);
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
- connman_device_load_last_connected(device);
- connman_device_load_last_user_selection(device);
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ connman_device_load_last_connected(device);
+ connman_device_load_last_user_selection(device);
+ }
+#endif /* defined TIZEN_EXT */
if (ident) {
connman_device_set_ident(device, ident);
diff --git a/src/main.c b/src/main.c
index 54f06654..8b0a995c 100755
--- a/src/main.c
+++ b/src/main.c
@@ -130,6 +130,7 @@ static struct {
int wifi_roam_min_rssi_2_4GHz;
int wifi_roam_min_rssi_5GHz;
int wifi_roam_min_rssi_6GHz;
+ int wifi_ap_selection_method;
#endif
} connman_settings = {
.bg_scan = true,
@@ -174,6 +175,7 @@ static struct {
.wifi_roam_min_rssi_2_4GHz = 0,
.wifi_roam_min_rssi_5GHz = 0,
.wifi_roam_min_rssi_6GHz = 0,
+ .wifi_ap_selection_method = AP_SELECTION_METHOD_NORMAL,
#endif
};
@@ -275,6 +277,7 @@ static struct {
#define CONF_WIFI_ROAM_MIN_RSSI_2_4 "WifiRoamingMinRSSI_2_4GHz"
#define CONF_WIFI_ROAM_MIN_RSSI_5 "WifiRoamingMinRSSI_5GHz"
#define CONF_WIFI_ROAM_MIN_RSSI_6 "WifiRoamingMinRSSI_6GHz"
+#define CONF_WIFI_AP_SELECTION_METHOD "ApSelectionMethod"
#endif
#if defined TIZEN_EXT
@@ -348,6 +351,7 @@ static const char *supported_options[] = {
CONF_WIFI_ROAM_MIN_RSSI_2_4,
CONF_WIFI_ROAM_MIN_RSSI_5,
CONF_WIFI_ROAM_MIN_RSSI_6,
+ CONF_WIFI_AP_SELECTION_METHOD,
#endif
NULL
};
@@ -799,6 +803,13 @@ static void check_tizen_configuration(GKeyFile *config)
g_clear_error(&error);
+ integer = g_key_file_get_integer(config, "General",
+ CONF_WIFI_AP_SELECTION_METHOD, &error);
+ if (!error)
+ connman_settings.wifi_ap_selection_method = integer;
+
+ g_clear_error(&error);
+
check_tizen_ins_configuration(config);
}
@@ -1424,6 +1435,9 @@ unsigned int connman_setting_get_uint(const char *key)
#if defined TIZEN_EXT
int connman_setting_get_int(const char *key)
{
+ if (g_str_equal(key, CONF_WIFI_AP_SELECTION_METHOD))
+ return connman_settings.wifi_ap_selection_method;
+
if (g_str_equal(key, CONF_INS_SIGNAL_LEVEL3_5GHZ))
return connman_ins_settings.ins_signal_level3_5ghz;
diff --git a/src/main.conf b/src/main.conf
index 656a9a80..9905e3e2 100755
--- a/src/main.conf
+++ b/src/main.conf
@@ -229,6 +229,11 @@ WifiRoamingMinRSSI_2_4GHz = -75
WifiRoamingMinRSSI_5GHz = -77
WifiRoamingMinRSSI_6GHz = -78
+# This value indicates which AP selection method to be used.
+# 0: Normal(Signal strength)
+# 1: INS
+ApSelectionMethod = 0
+
[INS]
# INS(Intelligent Network Selection) configuration: BSSID Selection.
INSPreferredFreqBSSID = 5GHz
diff --git a/src/main_robot.conf b/src/main_robot.conf
index 2f16e1da..5b72cd98 100755
--- a/src/main_robot.conf
+++ b/src/main_robot.conf
@@ -225,6 +225,11 @@ WifiRoamingMinRSSI_2_4GHz = -75
WifiRoamingMinRSSI_5GHz = -77
WifiRoamingMinRSSI_6GHz = -78
+# This value indicates which AP selection method to be used.
+# 0: Normal(Signal strength)
+# 1: INS
+ApSelectionMethod = 0
+
[INS]
# INS(Intelligent Network Selection) configuration: BSSID Selection.
INSPreferredFreqBSSID = 5GHz
diff --git a/src/main_tv.conf b/src/main_tv.conf
index ce9d711f..b40394c0 100755
--- a/src/main_tv.conf
+++ b/src/main_tv.conf
@@ -120,6 +120,11 @@ TizenTVExtension = true
# Default value is wlan0.
DefaultWifiInterface = wlan0
+# This value indicates which AP selection method to be used.
+# 0: Normal(Signal strength)
+# 1: INS
+ApSelectionMethod = 0
+
[INS]
# INS(Intelligent Network Selection) configuration: BSSID Selection.
INSPreferredFreqBSSID = 5GHz
diff --git a/src/manager.c b/src/manager.c
index 5f7f99ad..9fea4e0e 100755
--- a/src/manager.c
+++ b/src/manager.c
@@ -289,9 +289,7 @@ static DBusMessage *get_dhcp_status(DBusConnection *conn, DBusMessage *msg, void
return reply;
}
-#endif
-#if defined TIZEN_EXT_INS
static void append_ins_structs(DBusMessageIter *iter, void *user_data)
{
__connman_ins_list_struct(iter);
@@ -306,8 +304,9 @@ static DBusMessage *get_ins(DBusConnection *conn,
if (!reply)
return NULL;
- __connman_dbus_append_objpath_dict_array(reply,
- append_ins_structs, NULL);
+ if (TIZEN_INS_ENABLED)
+ __connman_dbus_append_objpath_dict_array(reply,
+ append_ins_structs, NULL);
return reply;
}
@@ -778,8 +777,6 @@ static const GDBusMethodTable manager_methods[] = {
GDBUS_ARGS({ "ifname", "s" }),
GDBUS_ARGS({ "status", "s" }),
get_dhcp_status) },
-#endif
-#if defined TIZEN_EXT_INS
{ GDBUS_METHOD("GetINS",
NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }),
get_ins) },
diff --git a/src/network.c b/src/network.c
index 568bad5b..69816999 100755
--- a/src/network.c
+++ b/src/network.c
@@ -58,13 +58,11 @@ static DBusConnection *connection;
#define DHCP_RETRY_TIMEOUT 10
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-#endif
-#if defined TIZEN_EXT
static GHashTable *dhcp_status_list = NULL;
#endif
@@ -1367,9 +1365,9 @@ static void network_destruct(struct connman_network *network)
#if defined TIZEN_EXT
g_slist_free_full(network->wifi.vsie_list, g_free);
g_slist_free_full(network->wifi.bssid_list, g_free);
-#endif
-#if defined TIZEN_EXT_INS
- g_hash_table_destroy(network->wifi.assoc_reject_table);
+
+ if (TIZEN_INS_ENABLED)
+ g_hash_table_destroy(network->wifi.assoc_reject_table);
#endif
g_free(network->path);
g_free(network->group);
@@ -2750,7 +2748,6 @@ unsigned int connman_network_get_max_bssid_count(struct connman_network *network
return network->wifi.max_bssid_count;
}
-#if defined TIZEN_EXT_INS
int connman_network_set_last_connected_bssid(struct connman_network *network,
const unsigned char *bssid)
{
@@ -2791,7 +2788,6 @@ GHashTable *connman_network_get_assoc_reject_table(struct connman_network *netwo
return network->wifi.assoc_reject_table;
}
-#endif /* defined TIZEN_EXT_INS */
__time_t connman_network_get_roam_scan_time(struct connman_network *network)
{
diff --git a/src/service.c b/src/service.c
index bbb639a5..bf5c11be 100755
--- a/src/service.c
+++ b/src/service.c
@@ -82,14 +82,11 @@ struct saved_profiles {
GTimeVal modified;
gchar *profile_name;
};
-#endif
-#if defined TIZEN_EXT_INS
+
static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-#endif
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
enum connman_ins_preferred_freq {
CONNMAN_INS_PREFERRED_FREQ_UNKNOWN,
CONNMAN_INS_PREFERRED_FREQ_24GHZ,
@@ -115,7 +112,7 @@ struct connman_ins_settings {
};
static struct connman_ins_settings ins_settings;
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
struct connman_stats {
bool valid;
@@ -237,12 +234,10 @@ struct connman_service {
enum connman_dnsconfig_method dns_config_method_ipv4;
enum connman_dnsconfig_method dns_config_method_ipv6;
-#endif
-#if defined TIZEN_EXT
+
char *connector;
char *c_sign_key;
char *net_access_key;
-#if defined TIZEN_EXT_INS
unsigned char last_connected_bssid[WIFI_BSSID_LEN_MAX];
bool is_internet_connection;
int assoc_reject_count;
@@ -252,7 +247,6 @@ struct connman_service {
int score_security_priority;
int score_internet_connection;
int score_strength;
-#endif
int ins_score;
#endif
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
@@ -830,7 +824,7 @@ static int connman_service_set_eapol_property(struct connman_service *service,
}
#endif
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static void save_assoc_reject(gpointer key, gpointer value, gpointer user_data)
{
struct assoc_reject_data *assoc_rd = value;
@@ -1063,7 +1057,7 @@ done:
g_key_file_free(keyfile);
return err;
}
-#endif /* defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static int service_load(struct connman_service *service)
{
@@ -1074,7 +1068,7 @@ static int service_load(struct connman_service *service)
bool autoconnect;
unsigned int ssid_len;
int err = 0;
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
bool internet_connection;
#endif
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
@@ -1164,45 +1158,47 @@ static int service_load(struct connman_service *service)
g_free(hex_ssid);
}
-#if defined TIZEN_EXT_INS
- /* Last connected BSSID */
- if (service->network) {
- gchar *bssid_str;
- unsigned char last_connected_bssid[WIFI_BSSID_LEN_MAX];
- char **str_list;
- unsigned int i;
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ /* Last connected BSSID */
+ if (service->network) {
+ gchar *bssid_str;
+ unsigned char last_connected_bssid[WIFI_BSSID_LEN_MAX];
+ char **str_list;
+ unsigned int i;
- bssid_str = g_key_file_get_string(keyfile,
- service->identifier, "LastConnectedBSSID", NULL);
+ bssid_str = g_key_file_get_string(keyfile,
+ service->identifier, "LastConnectedBSSID", NULL);
- if (bssid_str) {
- str_list = g_strsplit(bssid_str, ":", 0);
+ if (bssid_str) {
+ str_list = g_strsplit(bssid_str, ":", 0);
- if (str_list) {
- for (i = 0; i < WIFI_BSSID_LEN_MAX; i++)
- last_connected_bssid[i] = strtol(str_list[i], NULL, 16);
+ if (str_list) {
+ for (i = 0; i < WIFI_BSSID_LEN_MAX; i++)
+ last_connected_bssid[i] = strtol(str_list[i], NULL, 16);
- memcpy(service->last_connected_bssid,
- last_connected_bssid, WIFI_BSSID_LEN_MAX);
+ memcpy(service->last_connected_bssid,
+ last_connected_bssid, WIFI_BSSID_LEN_MAX);
- connman_network_set_last_connected_bssid(service->network,
- last_connected_bssid);
+ connman_network_set_last_connected_bssid(service->network,
+ last_connected_bssid);
- g_strfreev(str_list);
- }
+ g_strfreev(str_list);
+ }
- g_free(bssid_str);
+ g_free(bssid_str);
+ }
}
- }
- /* Internet connection */
- internet_connection = g_key_file_get_boolean(keyfile,
- service->identifier, "InternetConnection", &error);
- if (!error)
- service->is_internet_connection = internet_connection;
+ /* Internet connection */
+ internet_connection = g_key_file_get_boolean(keyfile,
+ service->identifier, "InternetConnection", &error);
+ if (!error)
+ service->is_internet_connection = internet_connection;
- g_clear_error(&error);
-#endif /* defined TIZEN_EXT_INS */
+ g_clear_error(&error);
+ }
+#endif /* defined TIZEN_EXT */
/* fall through */
case CONNMAN_SERVICE_TYPE_GADGET:
@@ -1479,7 +1475,7 @@ static int service_save(struct connman_service *service)
if (service->network) {
const unsigned char *ssid;
unsigned int ssid_len = 0;
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
GHashTable *assoc_reject_table;
#endif
@@ -1511,69 +1507,70 @@ static int service_save(struct connman_service *service)
g_key_file_set_integer(keyfile, service->identifier,
"Frequency", freq);
-#if defined TIZEN_EXT_INS
- /* Last connected BSSID */
- if (memcmp(service->last_connected_bssid, invalid_bssid, WIFI_BSSID_LEN_MAX)) {
- char *identifier = service->identifier;
- GString *bssid_str;
- unsigned int i;
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ /* Last connected BSSID */
+ if (memcmp(service->last_connected_bssid, invalid_bssid, WIFI_BSSID_LEN_MAX)) {
+ char *identifier = service->identifier;
+ GString *bssid_str;
+ unsigned int i;
- bssid_str = g_string_sized_new(18);
- if (!bssid_str) {
- err = -ENOMEM;
- goto done;
- }
+ bssid_str = g_string_sized_new(18);
+ if (!bssid_str) {
+ err = -ENOMEM;
+ goto done;
+ }
- for (i = 0; i < WIFI_BSSID_LEN_MAX; i++) {
- g_string_append_printf(bssid_str,
- "%02x", service->last_connected_bssid[i]);
- if (i < WIFI_BSSID_LEN_MAX - 1)
- g_string_append(bssid_str, ":");
- }
+ for (i = 0; i < WIFI_BSSID_LEN_MAX; i++) {
+ g_string_append_printf(bssid_str,
+ "%02x", service->last_connected_bssid[i]);
+ if (i < WIFI_BSSID_LEN_MAX - 1)
+ g_string_append(bssid_str, ":");
+ }
- g_key_file_set_string(keyfile, identifier,
+ g_key_file_set_string(keyfile, identifier,
"LastConnectedBSSID", bssid_str->str);
- DBG("last connected bssid[%s]", bssid_str->str);
+ DBG("last connected bssid[%s]", bssid_str->str);
- g_string_free(bssid_str, TRUE);
- }
-
- /* Assoc reject */
- assoc_reject_table = connman_network_get_assoc_reject_table(service->network);
- if (assoc_reject_table && g_hash_table_size(assoc_reject_table) > 0) {
- GString *assoc_reject_str;
- char **assoc_reject_list;
- guint assoc_reject_len;
-
- assoc_reject_str = g_string_new(NULL);
- if (!assoc_reject_str) {
- err = -ENOMEM;
- goto done;
+ g_string_free(bssid_str, TRUE);
}
- g_hash_table_foreach(assoc_reject_table, save_assoc_reject, assoc_reject_str);
+ /* Assoc reject */
+ assoc_reject_table = connman_network_get_assoc_reject_table(service->network);
+ if (assoc_reject_table && g_hash_table_size(assoc_reject_table) > 0) {
+ GString *assoc_reject_str;
+ char **assoc_reject_list;
+ guint assoc_reject_len;
- assoc_reject_list = g_strsplit_set(assoc_reject_str->str, " ", 0);
- assoc_reject_len = g_strv_length(assoc_reject_list);
+ assoc_reject_str = g_string_new(NULL);
+ if (!assoc_reject_str) {
+ err = -ENOMEM;
+ goto done;
+ }
- g_key_file_set_string_list(keyfile, service->identifier,
- "AssocReject", (const gchar **)assoc_reject_list, assoc_reject_len);
+ g_hash_table_foreach(assoc_reject_table, save_assoc_reject, assoc_reject_str);
- DBG("assoc reject table [%d]", assoc_reject_len);
+ assoc_reject_list = g_strsplit_set(assoc_reject_str->str, " ", 0);
+ assoc_reject_len = g_strv_length(assoc_reject_list);
- g_strfreev(assoc_reject_list);
- g_string_free(assoc_reject_str, TRUE);
- } else
- g_key_file_remove_key(keyfile, service->identifier, "AssocReject", NULL);
+ g_key_file_set_string_list(keyfile, service->identifier,
+ "AssocReject", (const gchar **)assoc_reject_list, assoc_reject_len);
- /* Internet connection */
- g_key_file_set_boolean(keyfile, service->identifier,
- "InternetConnection", service->is_internet_connection);
+ DBG("assoc reject table [%d]", assoc_reject_len);
- DBG("internet connection [%s]", service->is_internet_connection ? "true" : "false");
+ g_strfreev(assoc_reject_list);
+ g_string_free(assoc_reject_str, TRUE);
+ } else
+ g_key_file_remove_key(keyfile, service->identifier, "AssocReject", NULL);
-#endif /* defined TIZEN_EXT_INS */
+ /* Internet connection */
+ g_key_file_set_boolean(keyfile, service->identifier,
+ "InternetConnection", service->is_internet_connection);
+
+ DBG("internet connection [%s]", service->is_internet_connection ? "true" : "false");
+ }
+#endif /* defined TIZEN_EXT */
}
/* fall through */
@@ -3155,33 +3152,32 @@ static void state_changed(struct connman_service *service)
#if defined TIZEN_EXT
static void connect_reason_changed(struct connman_service *service)
{
-#if defined TIZEN_EXT_INS
struct connman_device *device;
-#endif
+
if (!service->path)
return;
if (!allow_property_changed(service))
return;
-#if defined TIZEN_EXT_INS
- if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_USER) {
- device = connman_network_get_device(service->network);
- if (device) {
- bool need_save = false;
+ if (TIZEN_INS_ENABLED) {
+ if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_USER) {
+ device = connman_network_get_device(service->network);
+ if (device) {
+ bool need_save = false;
- need_save |= connman_device_set_last_user_selection_ident(device, service->identifier);
- need_save |= connman_device_set_last_user_selection_time(device, time(NULL));
+ need_save |= connman_device_set_last_user_selection_ident(device, service->identifier);
+ need_save |= connman_device_set_last_user_selection_time(device, time(NULL));
- DBG("last user selection ident[%s] time[%ld]",
- connman_device_get_last_user_selection_ident(device),
- connman_device_get_last_user_selection_time(device));
+ DBG("last user selection ident[%s] time[%ld]",
+ connman_device_get_last_user_selection_ident(device),
+ connman_device_get_last_user_selection_time(device));
- if (need_save)
- connman_device_save_last_user_selection(device);
+ if (need_save)
+ connman_device_save_last_user_selection(device);
+ }
}
}
-#endif
connman_dbus_property_changed_basic(service->path,
CONNMAN_SERVICE_INTERFACE,
@@ -3189,9 +3185,7 @@ static void connect_reason_changed(struct connman_service *service)
DBUS_TYPE_INT32,
&service->connect_reason);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
-#if defined TIZEN_EXT
static void disconnection_requested_changed(struct connman_service *service)
{
dbus_bool_t disconnection_requested;
@@ -3275,7 +3269,7 @@ static void strength_changed(struct connman_service *service)
DBUS_TYPE_BYTE, &service->strength);
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static bool update_last_connected_bssid(struct connman_service *service)
{
const unsigned char *last_connected_bssid;
@@ -4711,7 +4705,7 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
connman_network_append_acddbus(dict, service->network);
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static void append_ins_bssid_info(DBusMessageIter *iter, void *user_data)
{
GSList *bssid_list = NULL;
@@ -4802,7 +4796,7 @@ static void append_ins_properties(DBusMessageIter *dict,
append_ins_bssid_info, service->network);
}
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static void append_struct_service(DBusMessageIter *iter,
connman_dbus_append_cb_t function,
@@ -4841,7 +4835,7 @@ static void append_struct(gpointer value, gpointer user_data)
append_struct_service(iter, append_dict_properties, service);
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static void append_dict_ins_properties(DBusMessageIter *dict, void *user_data)
{
struct connman_service *service = user_data;
@@ -4867,7 +4861,7 @@ void __connman_ins_list_struct(DBusMessageIter *iter)
{
g_list_foreach(service_list, append_ins_struct, iter);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
void __connman_service_list_struct(DBusMessageIter *iter)
{
@@ -5122,7 +5116,7 @@ const char *connman_service_get_proxy_url(struct connman_service *service)
return service->pac;
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
void connman_service_set_internet_connection(struct connman_service *service,
bool internet_connection)
{
@@ -5144,9 +5138,7 @@ bool connman_service_get_internet_connection(struct connman_service *service)
return service->is_internet_connection;
}
-#endif
-#if defined TIZEN_EXT
DBusMessage *connman_service_create_dbus_service_reply(DBusMessage *msg,
struct connman_service *service)
{
@@ -7951,12 +7943,10 @@ static void service_initialize(struct connman_service *service)
service->wps = false;
service->wps_advertizing = false;
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
memset(service->last_connected_bssid, 0, WIFI_BSSID_LEN_MAX);
service->is_internet_connection = false;
service->assoc_reject_count = 0;
-#endif
-#if defined TIZEN_EXT
service->disconnection_requested = false;
service->storage_reload = false;
/*
@@ -8056,7 +8046,7 @@ void connman_service_unref_debug(struct connman_service *service,
g_hash_table_remove(service_hash, service->identifier);
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static int calculate_score_last_user_selection(struct connman_service *service)
{
int score = 0;
@@ -8234,7 +8224,7 @@ static int calculate_score(struct connman_service *service)
service->ins_score = score;
return score;
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static gint service_compare(gconstpointer a, gconstpointer b);
@@ -8295,13 +8285,13 @@ static gint service_compare(gconstpointer a, gconstpointer b)
struct connman_service *service_b = (void *) b;
enum connman_service_state state_a, state_b;
bool a_connected, b_connected;
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
int score_a;
int score_b;
gint strength = 0;
-#else /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#else /* defined TIZEN_EXT */
gint strength;
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
state_a = service_a->state;
state_b = service_b->state;
@@ -8415,21 +8405,24 @@ static gint service_compare(gconstpointer a, gconstpointer b)
return 1;
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
- score_a = calculate_score(service_a);
- score_b = calculate_score(service_b);
- if (score_b != score_a)
- return score_b - score_a;
- else if (score_b == score_a) {
- strength = (gint) service_b->strength - (gint) service_a->strength;
- if (strength)
- return strength;
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ score_a = calculate_score(service_a);
+ score_b = calculate_score(service_b);
+
+ if (score_b != score_a)
+ return score_b - score_a;
+ else if (score_b == score_a) {
+ strength = (gint) service_b->strength - (gint) service_a->strength;
+ if (strength)
+ return strength;
+ }
}
-#else /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#else /* defined TIZEN_EXT */
strength = (gint) service_b->strength - (gint) service_a->strength;
if (strength)
return strength;
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
return g_strcmp0(service_a->name, service_b->name);
}
@@ -9431,8 +9424,8 @@ static int service_indicate_state(struct connman_service *service)
single_connected_tech(service);
#endif
-#if defined TIZEN_EXT_INS
- if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED && service->type == CONNMAN_SERVICE_TYPE_WIFI)
connman_service_set_internet_connection(service, true);
#endif
break;
@@ -10587,11 +10580,13 @@ static int service_register(struct connman_service *service)
#if defined TIZEN_EXT
int ret;
service_load(service);
-#if defined TIZEN_EXT_INS
- ret = service_ext_load(service);
- if (ret == -ERANGE)
- service_ext_save(service);
-#endif /* defined TIZEN_EXT_INS */
+
+ if (TIZEN_INS_ENABLED) {
+ ret = service_ext_load(service);
+ if (ret == -ERANGE)
+ service_ext_save(service);
+ }
+
ret = __connman_config_provision_service(service);
if (ret < 0 && !simplified_log)
DBG("Failed to provision service");
@@ -11254,9 +11249,6 @@ void __connman_service_update_from_network(struct connman_network *network)
bool roaming;
const char *name;
bool stats_enable;
-#if defined TIZEN_EXT_INS
- bool need_save = false;
-#endif
service = connman_service_lookup_from_network(network);
if (!service)
@@ -11313,13 +11305,18 @@ roaming:
roaming_changed(service);
sorting:
-#if defined TIZEN_EXT_INS
- need_save |= update_last_connected_bssid(service);
- need_save |= update_assoc_reject(service);
- if (need_save) {
- g_get_current_time((GTimeVal *)&service->modified);
- service_ext_save(service);
- need_sort = true;
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ bool need_save = false;
+
+ need_save |= update_last_connected_bssid(service);
+ need_save |= update_assoc_reject(service);
+
+ if (need_save) {
+ g_get_current_time((GTimeVal *)&service->modified);
+ service_ext_save(service);
+ need_sort = true;
+ }
}
#endif
@@ -11505,7 +11502,7 @@ static struct connman_agent_driver agent_driver = {
.context_unref = agent_context_unref,
};
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static void ins_setting_init(void)
{
int i;
@@ -11596,7 +11593,7 @@ static void ins_setting_init(void)
DBG("signal_level3_5ghz [%d]", ins_settings.signal_level3_5ghz);
DBG("signal_level3_24ghz [%d]", ins_settings.signal_level3_24ghz);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
int __connman_service_init(void)
{
@@ -11627,9 +11624,10 @@ int __connman_service_init(void)
remove_unprovisioned_services();
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
- ins_setting_init();
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED)
+ ins_setting_init();
+#endif /* defined TIZEN_EXT */
return 0;
}
diff --git a/src/storage.c b/src/storage.c
index fb6dc149..67f6036b 100755
--- a/src/storage.c
+++ b/src/storage.c
@@ -35,9 +35,9 @@
#define SETTINGS "settings"
#define DEFAULT "default.profile"
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
#define INS_SETTINGS "settings.ins"
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
#define MODE (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | \
S_IXGRP | S_IROTH | S_IXOTH)
@@ -133,7 +133,7 @@ int __connman_storage_save_global(GKeyFile *keyfile)
return ret;
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
GKeyFile *__connman_storage_load_ins(void)
{
gchar *pathname;
@@ -165,7 +165,7 @@ int __connman_storage_save_ins(GKeyFile *keyfile)
return ret;
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
void __connman_storage_delete_global(void)
{
diff --git a/src/wispr.c b/src/wispr.c
index 6fc211fa..f4dcb73e 100755
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -424,8 +424,9 @@ static void wispr_portal_error(struct connman_wispr_portal_context *wp_context)
wp_context->wispr_result = CONNMAN_WISPR_RESULT_FAILED;
-#if defined TIZEN_EXT_INS
- connman_service_set_internet_connection(wp_context->service, false);
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED)
+ connman_service_set_internet_connection(wp_context->service, false);
#endif
}