summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/service.c')
-rwxr-xr-xsrc/service.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/src/service.c b/src/service.c
index 175f39d9..d2f89d2a 100755
--- a/src/service.c
+++ b/src/service.c
@@ -7958,14 +7958,16 @@ static int calculate_score_last_connected(struct connman_service *service)
last_connected_ident = connman_device_get_last_connected_ident(device);
frequency = connman_network_get_frequency(service->network);
- if (g_strcmp0(last_connected_ident, service->identifier) == 0 &&
- (((frequency >= FREQ_RANGE_24GHZ_CHANNEL_1 &&
- frequency <= FREQ_RANGE_24GHZ_CHANNEL_14) &&
- service->strength >= ins_settings.signal_level3_24ghz) ||
- ((frequency >= FREQ_RANGE_5GHZ_CHANNEL_32 &&
- frequency <= FREQ_RANGE_5GHZ_CHANNEL_165) &&
- service->strength >= ins_settings.signal_level3_5ghz))) {
- score += ins_settings.last_connected_score;
+ if (ins_settings.last_connected) {
+ if (g_strcmp0(last_connected_ident, service->identifier) == 0 &&
+ (((frequency >= FREQ_RANGE_24GHZ_CHANNEL_1 &&
+ frequency <= FREQ_RANGE_24GHZ_CHANNEL_14) &&
+ service->strength >= ins_settings.signal_level3_24ghz) ||
+ ((frequency >= FREQ_RANGE_5GHZ_CHANNEL_32 &&
+ frequency <= FREQ_RANGE_5GHZ_CHANNEL_165) &&
+ service->strength >= ins_settings.signal_level3_5ghz))) {
+ score += ins_settings.last_connected_score;
+ }
}
return score;
@@ -9237,6 +9239,55 @@ static int service_indicate_state(struct connman_service *service)
#else
__connman_service_connect_default(service);
#endif
+ /* Update Wi-Fi Roaming result */
+ if (connman_setting_get_bool("WifiRoaming") &&
+ connman_network_get_bool(service->network, "WiFi.Roaming")) {
+ const char *cur_bssid;
+ const char *dst_bssid;
+ const char *ifname;
+ struct connman_device *device;
+
+ device = connman_network_get_device(service->network);
+ if (device) {
+ ifname = connman_device_get_string(device, "Interface");
+ cur_bssid = connman_network_get_string(service->network,
+ "WiFi.RoamingCurBSSID");
+ dst_bssid = connman_network_get_string(service->network,
+ "WiFi.RoamingDstBSSID");
+ }
+
+ if (device && ifname && cur_bssid && dst_bssid) {
+ switch(new_state) {
+ case CONNMAN_SERVICE_STATE_UNKNOWN:
+ case CONNMAN_SERVICE_STATE_ASSOCIATION:
+ case CONNMAN_SERVICE_STATE_CONFIGURATION:
+ break;
+ case CONNMAN_SERVICE_STATE_READY:
+ case CONNMAN_SERVICE_STATE_ONLINE:
+ __connman_technology_notify_roaming_state(ifname,
+ "success", cur_bssid, dst_bssid);
+ connman_network_set_bool(service->network,
+ "WiFi.Roaming", false);
+ connman_network_set_string(service->network,
+ "WiFi.RoamingCurBSSID", NULL);
+ connman_network_set_string(service->network,
+ "WiFi.RoamingDstBSSID", NULL);
+ break;
+ case CONNMAN_SERVICE_STATE_DISCONNECT:
+ case CONNMAN_SERVICE_STATE_FAILURE:
+ case CONNMAN_SERVICE_STATE_IDLE:
+ __connman_technology_notify_roaming_state(ifname,
+ "failure", cur_bssid, dst_bssid);
+ connman_network_set_bool(service->network,
+ "WiFi.Roaming", false);
+ connman_network_set_string(service->network,
+ "WiFi.RoamingCurBSSID", NULL);
+ connman_network_set_string(service->network,
+ "WiFi.RoamingDstBSSID", NULL);
+ break;
+ }
+ }
+ }
#endif
__connman_connection_update_gateway();