Skip to content

Commit

Permalink
Fixed bad ssid comparison when checking for already connected wifi
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Geniola committed Jun 6, 2021
1 parent e602350 commit cf2f795
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ private void unregisterWifiChanges() {
private void connectToDeviceWifiAp() {
state = State.CONNECTING_DEVICE_WIFI_AP;

String targetSsid = "\""+pairActivityViewModel.getMerossPairingAp().getValue().getSsid()+"\"";
String ssid = pairActivityViewModel.getMerossPairingAp().getValue().getSsid();
String targetSsid = "\""+ssid+"\"";
String bssid = pairActivityViewModel.getMerossPairingAp().getValue().getBssid();

// Check if we are already connected to such wifi
Expand All @@ -142,15 +143,16 @@ private void connectToDeviceWifiAp() {
connectedWifi.getSSID() == null ||
connectedWifi.getSSID().compareTo(targetSsid)!=0 ||
connectedWifi.getBSSID().compareTo(bssid)!=0)
connectToKnownWifi(targetSsid, bssid);
connectToKnownWifi(ssid, bssid);
else
stateMachine(Signal.DEVICE_WIFI_CONNECTED);
}

private void connectToLocalWifi() {
state = State.CONNETING_LOCAL_WIFI;

String targetSsid = "\""+pairActivityViewModel.getMerossConfiguredWifi().getValue().getScannedWifi().getSsid()+"\"";
String ssid = pairActivityViewModel.getMerossConfiguredWifi().getValue().getScannedWifi().getSsid();
String targetSsid = "\""+ssid+"\"";
String bssid = pairActivityViewModel.getMerossConfiguredWifi().getValue().getScannedWifi().getBssid();

// Check if we are already connected to such wifi
Expand All @@ -159,7 +161,7 @@ private void connectToLocalWifi() {
connectedWifi.getSSID() == null ||
connectedWifi.getSSID().compareTo(targetSsid)!=0 ||
connectedWifi.getBSSID().compareTo(bssid)!=0)
connectToKnownWifi(targetSsid, bssid);
connectToKnownWifi(ssid, bssid);
else
stateMachine(Signal.LOCAL_WIFI_CONNECTED);
}
Expand Down

0 comments on commit cf2f795

Please sign in to comment.