-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from BlinkID/feature/AND-323/vin_detection_impr…
…ovements [Android] Vin detection improvements
- Loading branch information
Showing
6 changed files
with
161 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...src/android/java/com/phonegap/plugins/blinkid/resulthistory/AcceptFirstResultHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.phonegap.plugins.blinkid.resulthistory; | ||
|
||
public class AcceptFirstResultHistory implements ResultHistory { | ||
|
||
private String mResult; | ||
|
||
@Override | ||
public void onNewResult(String result) { | ||
mResult = result; | ||
} | ||
|
||
@Override | ||
public String getResult() { | ||
return mResult; | ||
} | ||
|
||
@Override | ||
public boolean hasValidResult() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
mResult = null; | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
BlinkMoto/src/android/java/com/phonegap/plugins/blinkid/resulthistory/ResultHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.phonegap.plugins.blinkid.resulthistory; | ||
|
||
public interface ResultHistory { | ||
|
||
void onNewResult(String result); | ||
String getResult(); | ||
boolean hasValidResult(); | ||
void clear(); | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
BlinkMoto/src/android/java/com/phonegap/plugins/blinkid/resulthistory/VinResultHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.phonegap.plugins.blinkid.resulthistory; | ||
|
||
//accept result as valid only if we got it 3 times in a row | ||
public class VinResultHistory implements ResultHistory { | ||
|
||
private static final int SAME_RESULT_COUNT_REQUIRED_FOR_SUCCESS = 3; | ||
private int mSameScannedVinCount = 0; | ||
private String mLastScannedVin; | ||
|
||
@Override | ||
public void onNewResult(String result) { | ||
if(result != null && result.equals(mLastScannedVin)) { | ||
mSameScannedVinCount++; | ||
} else { | ||
mSameScannedVinCount = 0; | ||
mLastScannedVin = result; | ||
} | ||
} | ||
|
||
@Override | ||
public String getResult() { | ||
return mLastScannedVin; | ||
} | ||
|
||
@Override | ||
public boolean hasValidResult() { | ||
return mSameScannedVinCount >= SAME_RESULT_COUNT_REQUIRED_FOR_SUCCESS; | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
mSameScannedVinCount = 0; | ||
mLastScannedVin = null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters