Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Commit d0c1793

Browse files
Fix bug in QR Code Scanner
1 parent e21290b commit d0c1793

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

skunkworks_crow/src/main/java/org/odk/share/activities/ReceiverActivity.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public class ReceiverActivity extends InjectableActivity implements OnItemClickL
102102

103103
private boolean isQRCodeScanned;
104104
private String ip;
105-
private String ssidScanned;
106105
private boolean isProtected;
107106
private String passwordScanned;
108107

@@ -122,7 +121,6 @@ protected void onCreate(Bundle savedInstanceState) {
122121
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
123122

124123
isQRCodeScanned = false;
125-
ssidScanned = null;
126124
isProtected = false;
127125
port = -1;
128126

@@ -405,14 +403,14 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
405403
try {
406404
JSONObject obj = new JSONObject(result.getContents());
407405
ip = (String) obj.get(IP);
408-
ssidScanned = (String) obj.get(SSID);
406+
wifiNetworkSSID = (String) obj.get(SSID);
409407
port = (Integer) obj.get(PORT);
410408
isProtected = (boolean) obj.get(PROTECTED);
411409
if (isProtected) {
412410
passwordScanned = (String) obj.get(PASSWORD);
413411
}
414412

415-
Timber.d("Scanned results " + ssidScanned + " " + port + " " + isProtected + " " + passwordScanned);
413+
Timber.d("Scanned results " + wifiNetworkSSID + " " + port + " " + isProtected + " " + passwordScanned);
416414
isQRCodeScanned = true;
417415

418416
if (wifiConnector.getAccessPointIpAddress() != null && wifiConnector.getAccessPointIpAddress().equals(ip)) {
@@ -497,12 +495,12 @@ private void wifiListAvailable(ArrayList<WifiNetworkInfo> list) {
497495
if (isQRCodeScanned) {
498496
isQRCodeScanned = false;
499497
for (WifiNetworkInfo info : list) {
500-
if (info.getSsid().equals(ssidScanned)) {
498+
if (info.getSsid().equals(wifiNetworkSSID)) {
501499
if (info.getState() != NetworkInfo.DetailedState.CONNECTED) {
502500
Toast.makeText(this, "attempting connection", Toast.LENGTH_SHORT).show();
503-
connectToNetwork(info.getSecurityType(), ssidScanned, passwordScanned);
501+
connectToNetwork(info.getSecurityType(), wifiNetworkSSID, passwordScanned);
504502
} else {
505-
Toast.makeText(this, "already connected to " + ssidScanned, Toast.LENGTH_SHORT).show();
503+
Toast.makeText(this, "already connected to " + wifiNetworkSSID, Toast.LENGTH_SHORT).show();
506504
}
507505
return;
508506
}

0 commit comments

Comments
 (0)