Skip to content

Commit f832d01

Browse files
authored
Merge pull request #15 from cslrfid/release-1.20.0
Updates on tag access features
2 parents 1508e45 + edda171 commit f832d01

25 files changed

+1604
-454
lines changed

.gitignore

Lines changed: 91 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,91 @@
1-
*.iml
2-
.gradle
3-
/local.properties
4-
/.idea/workspace.xml
5-
/.idea/libraries
6-
.DS_Store
7-
/build
8-
/captures
9-
.externalNativeBuild
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# mac specific
8+
.DS_Store
9+
10+
# Files for the ART/Dalvik VM
11+
*.dex
12+
13+
# Java class files
14+
*.class
15+
16+
# Generated files
17+
bin/
18+
gen/
19+
out/
20+
# Uncomment the following line in case you need and you don't have the release build type files in your app
21+
# release/
22+
23+
# Gradle files
24+
.gradle/
25+
build/
26+
27+
# Local configuration file (sdk path, etc)
28+
local.properties
29+
30+
# Proguard folder generated by Eclipse
31+
proguard/
32+
33+
# Log Files
34+
*.log
35+
36+
# Android Studio Navigation editor temp files
37+
.navigation/
38+
39+
# Android Studio captures folder
40+
captures/
41+
42+
# IntelliJ
43+
*.iml
44+
.idea/workspace.xml
45+
.idea/tasks.xml
46+
.idea/gradle.xml
47+
.idea/assetWizardSettings.xml
48+
.idea/dictionaries
49+
.idea/libraries
50+
# Android Studio 3 in .gitignore file.
51+
.idea/caches
52+
.idea/modules.xml
53+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
54+
.idea/navEditor.xml
55+
56+
# Keystore files
57+
# Uncomment the following lines if you do not want to check your keystore files in.
58+
#*.jks
59+
#*.keystore
60+
61+
# External native build folder generated in Android Studio 2.2 and later
62+
.externalNativeBuild
63+
.cxx/
64+
65+
# Google Services (e.g. APIs or Firebase)
66+
# google-services.json
67+
68+
# Freeline
69+
freeline.py
70+
freeline/
71+
freeline_project_description.json
72+
73+
# fastlane
74+
fastlane/report.xml
75+
fastlane/Preview.html
76+
fastlane/screenshots
77+
fastlane/test_output
78+
fastlane/readme.md
79+
80+
# Version control
81+
vcs.xml
82+
83+
# lint
84+
lint/intermediates/
85+
lint/generated/
86+
lint/outputs/
87+
lint/tmp/
88+
# lint/reports/
89+
90+
# Android Profiling
91+
*.hprof

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
applicationId "com.csl.cs108ademoapp"
77
minSdkVersion 19
88
targetSdkVersion 28
9-
versionCode 24
10-
versionName "1.19.0"
9+
versionCode 25
10+
versionName "1.20.0"
1111
}
1212
compileOptions {
1313
sourceCompatibility JavaVersion.VERSION_1_7

app/src/main/java/com/csl/cs108ademoapp/AccessTask.java

Lines changed: 80 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,35 @@ public enum TaskCancelRReason {
3636
boolean done = false;
3737
boolean ending = false;
3838
private String endingMessaage;
39-
int qValue;
40-
boolean repeat, nextNew;
39+
40+
int qValue=0;
41+
boolean repeat=false, nextNew=false;
42+
boolean bEnableErrorPopWindow=true;
43+
4144
boolean gotInventory;
4245
int batteryCountInventory_old;
4346

47+
public AccessTask(Button button, boolean invalidRequest,
48+
String selectMask, int selectBank, int selectOffset,
49+
String strPassword, int powerLevel, Cs108Connector.HostCommands hostCommand, boolean bEnableErrorPopWindow) {
50+
this.button = button;
51+
this.registerTagGot = registerTagGot;
52+
this.registerVoltageLevel = registerVoltageLevel;
53+
54+
this.invalidRequest = invalidRequest; MainActivity.mCs108Library4a.appendToLog("invalidRequest = " + invalidRequest);
55+
this.selectMask = selectMask;
56+
this.selectBank = selectBank;
57+
this.selectOffset = selectOffset;
58+
this.strPassword = strPassword;
59+
this.powerLevel = powerLevel;
60+
this.hostCommand = hostCommand;
61+
this.bEnableErrorPopWindow = bEnableErrorPopWindow;
62+
if (true) {
63+
total = 0;
64+
tagList.clear();
65+
}
66+
preExecute();
67+
}
4468
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest,
4569
String selectMask, int selectBank, int selectOffset,
4670
String strPassword, int powerLevel, Cs108Connector.HostCommands hostCommand,
@@ -69,15 +93,15 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
6993
total = 0;
7094
tagList.clear();
7195
}
96+
preExecute();
97+
}
7298

99+
void preExecute() {
73100
accessResult = null;
74101
playerO = MainActivity.sharedObjects.playerO;
75102
playerN = MainActivity.sharedObjects.playerN;
76-
playerN.start();
77-
}
103+
//playerN.start();
78104

79-
@Override
80-
protected void onPreExecute() {
81105
buttonText = button.getText().toString().trim();
82106
String buttonText1 = null; String strLastChar = buttonText.substring(buttonText.length()-1);
83107
if (strLastChar.toUpperCase().matches("E")) {
@@ -158,7 +182,7 @@ else if (rx000pkgData != null) {
158182
} else if (rx000pkgData.responseType == Cs108Connector.HostCmdResponseTypes.TYPE_18K6C_TAG_ACCESS) {
159183
if (true) {
160184
if (rx000pkgData.decodedError == null) {
161-
if (done == false) { accessResult = rx000pkgData.decodedResult; }
185+
if (done == false) { accessResult = rx000pkgData.decodedResult; MainActivity.mCs108Library4a.appendToLog("HelloA, accResult=" + accessResult);}
162186
done = true;
163187
publishProgress(null, rx000pkgData.decodedResult);
164188
}
@@ -194,18 +218,19 @@ else if (repeat && (nextNew == false || resultError.length() != 0)) {
194218
String tagInventoried = null;
195219
@Override
196220
protected void onProgressUpdate(String... output) {
197-
if (output[0] != null) {
221+
if (true) progressUpdate(output);
222+
else if (output[0] != null) {
198223
if (output[0].length() == 2) {
199224
if (output[0].contains("TT")) {
200225
gotInventory = true;
201-
if (registerTagGot != null) registerTagGot.setText(output[1]);
202226
boolean matched = false;
203227
for (int i = 0; i < tagList.size(); i++) {
204228
if (output[1].matches(tagList.get(i))) {
205229
matched = true;
206230
break;
207231
}
208232
}
233+
if (registerTagGot != null) registerTagGot.setText(output[1]);
209234
if (matched == false) tagInventoried = output[1];
210235
} else if (output[0].contains("WW")) {
211236
long timePeriod = (System.currentTimeMillis() - startTimeMillis) / 1000;
@@ -249,6 +274,45 @@ protected void onPostExecute(String result) {
249274
DeviceConnectTask4RegisterEnding();
250275
}
251276

277+
protected void progressUpdate(String... output) {
278+
if (output[0] != null) {
279+
if (output[0].length() == 2) {
280+
if (output[0].contains("TT")) {
281+
gotInventory = true;
282+
boolean matched = false;
283+
for (int i = 0; i < tagList.size(); i++) {
284+
if (output[1].matches(tagList.get(i))) {
285+
matched = true;
286+
break;
287+
}
288+
}
289+
if (registerTagGot != null) registerTagGot.setText(output[1]);
290+
if (matched == false) tagInventoried = output[1];
291+
} else if (output[0].contains("WW")) {
292+
long timePeriod = (System.currentTimeMillis() - startTimeMillis) / 1000;
293+
if (timePeriod > 0) {
294+
if (registerRunTime != null) registerRunTime.setText(String.format("Run time: %d sec", timePeriod));
295+
}
296+
} else if (taskCancelReason == TaskCancelRReason.NULL) {
297+
if (registerVoltageLevel != null) registerVoltageLevel.setText(MainActivity.mCs108Library4a.getBatteryDisplay(true));
298+
}
299+
} else {
300+
resultError += output[0];
301+
if (true)
302+
MainActivity.mCs108Library4a.appendToLog("output[0]: " + output[0] + ", resultError = " + resultError);
303+
}
304+
} else {
305+
if (registerYield != null) {
306+
if (tagInventoried != null) {
307+
tagList.add(tagInventoried);
308+
tagInventoried = null;
309+
}
310+
registerYield.setText("Unique:" + Integer.toString(tagList.size()));
311+
}
312+
if (registerTotal != null) registerTotal.setText("Total:" + Integer.toString(++total));
313+
}
314+
}
315+
252316
void DeviceConnectTask4RegisterEnding() {
253317
String strErrorMessage = "";
254318
if (false) {
@@ -267,7 +331,7 @@ void DeviceConnectTask4RegisterEnding() {
267331
switch (taskCancelReason) {
268332
case NULL:
269333
if (accessResult == null || (resultError != null && resultError.length() != 0) || (endingMessaage != null && endingMessaage.length() != 0)) strErrorMessage += ("Finish as COMMAND END is received " + (gotInventory ? "WITH" : "WITHOUT") + " tag response");
270-
else Toast.makeText(MainActivity.mContext, R.string.toast_abort_by_SUCCESS, Toast.LENGTH_SHORT).show();
334+
//else Toast.makeText(MainActivity.mContext, R.string.toast_abort_by_SUCCESS, Toast.LENGTH_SHORT).show();
271335
break;
272336
case STOP:
273337
strErrorMessage += "Finish as STOP is pressed. ";
@@ -290,9 +354,12 @@ void DeviceConnectTask4RegisterEnding() {
290354
if (strErrorMessage.length() != 0) endingMessaage = strErrorMessage;
291355
button.setText(buttonText);
292356
if (endingMessaage != null) {
293-
if (endingMessaage.length() != 0) {
294-
CustomPopupWindow customPopupWindow = new CustomPopupWindow(MainActivity.mContext);
295-
customPopupWindow.popupStart(endingMessaage, false);
357+
if (endingMessaage.length() != 0 || true) {
358+
MainActivity.mCs108Library4a.appendToLog("endingMessage=" + endingMessaage);
359+
if (bEnableErrorPopWindow) {
360+
CustomPopupWindow customPopupWindow = new CustomPopupWindow(MainActivity.mContext);
361+
customPopupWindow.popupStart(endingMessaage, false);
362+
}
296363
}
297364
}
298365
}

0 commit comments

Comments
 (0)