Implement Wi-Fi QR code scanner flow.
1. Implements WifiNetworkConfig Wi-Fi connection method 2. Shows error message when the QR code is not valid and hides it after 2s 3. In configurator mode, launchs AddDeviceFragment for a valid QR code 4. In enrollee mode, connects Wi-Fi for a valid QR code Bug: 118794978 Test: manual test atest WifiQrCodetest atest WifiDppConfiguratorActivityTest atest WifiDppEnrolleeActivityTest atest WifiDppQrCodeScannerFragmentTest Change-Id: Ie4731b22df295c60906156d33ea28dad9c084ce4
This commit is contained in:
@@ -152,6 +152,15 @@ public class QrCamera extends Handler {
|
||||
* @param transform The transform to apply to the content of preview
|
||||
*/
|
||||
void setTransform(Matrix transform);
|
||||
|
||||
/**
|
||||
* Verify QR code is valid or not. The camera will stop scanning if this callback returns
|
||||
* true.
|
||||
*
|
||||
* @param qrCode The result QR code after decoding.
|
||||
* @return Returns true if qrCode hold valid information.
|
||||
*/
|
||||
boolean isValid(String qrCode);
|
||||
}
|
||||
|
||||
private void setCameraParameter() {
|
||||
@@ -245,7 +254,9 @@ public class QrCamera extends Handler {
|
||||
mReader.reset();
|
||||
}
|
||||
if (qrCode != null) {
|
||||
return qrCode.getText();
|
||||
if (mScannerCallback.isValid(qrCode.getText())) {
|
||||
return qrCode.getText();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
Reference in New Issue
Block a user