Skip to content

Commit 57b2f26

Browse files
authored
Merge pull request #38 from cslrfid/release-2.6.0
Release 2.6.0
2 parents 4ddcf89 + 85386ac commit 57b2f26

31 files changed

+663
-386
lines changed

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 31
9-
versionCode 35
10-
versionName "2.4.0"
9+
versionCode 37
10+
versionName "2.6.0"
1111
}
1212
}
1313

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

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

Lines changed: 20 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public enum TaskCancelRReason {
4141
private String endingMessaage;
4242

4343
int qValue=0;
44-
boolean repeat=false, nextNew=false;
44+
int repeat=0;
4545
boolean bEnableErrorPopWindow=true;
4646

4747
boolean gotInventory;
@@ -73,7 +73,7 @@ public AccessTask(Button button, boolean invalidRequest,
7373
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest,
7474
String selectMask, int selectBank, int selectOffset,
7575
String strPassword, int powerLevel, Cs108Connector.HostCommands hostCommand,
76-
int qValue, boolean repeat, boolean nextNew, boolean resetCount,
76+
int qValue, int repeat, boolean resetCount,
7777
TextView registerRunTime, TextView registerTagGot, TextView registerVoltageLevel,
7878
TextView registerYieldView, TextView registerTotalView) {
7979
this.button = button;
@@ -92,8 +92,8 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
9292
this.powerLevel = powerLevel;
9393
this.hostCommand = hostCommand;
9494
this.qValue = qValue;
95+
if (repeat > 255) repeat = 255;
9596
this.repeat = repeat;
96-
this.nextNew = nextNew;
9797
if (resetCount) {
9898
total = 0;
9999
tagList.clear();
@@ -121,7 +121,7 @@ void preExecute() {
121121
buttonText1 += buttonText1.substring(buttonText.length() - 1);
122122
} else buttonText1 = buttonText;
123123
}
124-
if (repeat || buttonText.length() == 0) button.setText("Stop");
124+
if (repeat > 1 || buttonText.length() == 0) button.setText("Stop");
125125
else {
126126
if (Character.isUpperCase(strLastChar.charAt(0))) button.setText(buttonText1 + "ING");
127127
else button.setText(buttonText1 + "ing");
@@ -151,8 +151,8 @@ else if (hostCommand == Cs108Connector.HostCommands.CMD_18K6CKILL) {
151151
}
152152
if (invalidRequest == false) {
153153
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("AccessTask(): powerLevel = " + powerLevel);
154-
int matchRep = 0;
155-
if (repeat == false || nextNew) matchRep = 1;
154+
int matchRep = 1;
155+
if (repeat > 1) matchRep = repeat;
156156
if (powerLevel < 0 || powerLevel > 330) invalidRequest = true;
157157
else if (skipSelect) { }
158158
else if (MainActivity.mCs108Library4a.setSelectedTag(selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
@@ -192,38 +192,32 @@ protected String doInBackground(Void... a) {
192192
Cs108Connector.Rx000pkgData rx000pkgData = MainActivity.mCs108Library4a.onRFIDEvent();
193193
if (MainActivity.mCs108Library4a.mrfidToWriteSize() != 0) timeMillis = System.currentTimeMillis();
194194
else if (rx000pkgData != null) {
195-
//MainActivity.mCs108Library4a.appendToLog("rx000pkgData.responseType = " + rx000pkgData.responseType.toString());
196195
if (rx000pkgData.responseType == null) {
197196
publishProgress("null response");
198197
} else if (rx000pkgData.responseType == Cs108Connector.HostCmdResponseTypes.TYPE_18K6C_TAG_ACCESS) {
199-
if (true) {
200-
if (rx000pkgData.decodedError == null) {
201-
if (done == false) {
202-
accessResult = rx000pkgData.decodedResult;
203-
//MainActivity.mCs108Library4a.appendToLog("StreamOut, accResult=" + accessResult);
204-
if (updateRunnable != null) {
205-
//MainActivity.mCs108Library4a.appendToLog("StreamOut: start updateRunnable");
206-
mHandler.post(updateRunnable);
207-
}
208-
}
209-
done = true;
198+
if (rx000pkgData.decodedError == null) {
199+
if (done == false) {
200+
accessResult = rx000pkgData.decodedResult;
201+
if (repeat > 0) repeat--;
202+
if (updateRunnable != null) mHandler.post(updateRunnable);
210203
publishProgress(null, rx000pkgData.decodedResult);
211-
} else {
212-
//MainActivity.mCs108Library4a.appendToLog("decodeError = " + rx000pkgData.decodedError + ", length = " + rx000pkgData.decodedError.length());
213-
publishProgress(rx000pkgData.decodedError);
214204
}
215-
iTimeOut = 1000;
216-
}
205+
done = true;
206+
} else publishProgress(rx000pkgData.decodedError);
207+
iTimeOut = 1000;
217208
} else if (rx000pkgData.responseType == Cs108Connector.HostCmdResponseTypes.TYPE_COMMAND_END) {
209+
MainActivity.mCs108Library4a.appendToLog("BtData: repeat = " + repeat + ", decodedError = " + rx000pkgData.decodedError + ", resultError = " + resultError);
218210
if (rx000pkgData.decodedError != null) { endingMessaage = rx000pkgData.decodedError; ending = true; }
219-
else if (repeat && (nextNew == false || resultError.length() != 0)) {
211+
else if (repeat > 0 && resultError.length() == 0) {
220212
resultError = "";
213+
MainActivity.mCs108Library4a.setMatchRep(repeat);
221214
MainActivity.mCs108Library4a.sendHostRegRequestHST_CMD(hostCommand);
222215
} else {
223216
endingMessaage = "";
224217
ending = true;
225218
}
226219
} else if (rx000pkgData.responseType == Cs108Connector.HostCmdResponseTypes.TYPE_18K6C_INVENTORY) {
220+
done = false;
227221
publishProgress("TT", MainActivity.mCs108Library4a.byteArrayToString(rx000pkgData.decodedEpc));
228222
} else {
229223
publishProgress("Unhandled Response: " + rx000pkgData.responseType.toString());
@@ -252,8 +246,7 @@ else if (notificationData != null) {
252246
String tagInventoried = null;
253247
@Override
254248
protected void onProgressUpdate(String... output) {
255-
if (true) progressUpdate(output);
256-
else if (output[0] != null) {
249+
if (output[0] != null) {
257250
MainActivity.mCs108Library4a.appendToLog("onProgressUpdate output[0] = " + output[0]);
258251
if (output[0].length() == 2) {
259252
if (output[0].contains("TT")) {
@@ -279,7 +272,6 @@ else if (output[0] != null) {
279272
resultError += output[0];
280273
if (true)
281274
MainActivity.mCs108Library4a.appendToLog("output[0]: " + output[0] + ", resultError = " + resultError);
282-
taskCancelReason = TaskCancelRReason.ERROR;
283275
}
284276
} else {
285277
MainActivity.mCs108Library4a.appendToLog("onProgressUpdate output[1] = " + output[1]);
@@ -298,7 +290,6 @@ else if (output[0] != null) {
298290
protected void onCancelled() {
299291
super.onCancelled();
300292
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("endingMesssage: taskCancelReason = " + taskCancelReason);
301-
//if (taskCancelReason != TaskCancelRReason.NULL) MainActivity.mCs108Library4a.abortOperation1(); else
302293
MainActivity.mCs108Library4a.abortOperation();
303294
if (taskCancelReason == TaskCancelRReason.NULL) taskCancelReason = TaskCancelRReason.DESTORY;
304295
DeviceConnectTask4RegisterEnding();
@@ -307,58 +298,16 @@ protected void onCancelled() {
307298
@Override
308299
protected void onPostExecute(String result) {
309300
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("AccessSecurityLockFragment.InventoryRfidTask.onPostExecute(): " + result);
310-
311301
DeviceConnectTask4RegisterEnding();
312302
}
313303

314-
protected void progressUpdate(String... output) {
315-
if (output[0] != null) {
316-
MainActivity.mCs108Library4a.appendToLog("onProgressUpdate output[0] = " + output[0]);
317-
if (output[0].length() == 2) {
318-
if (output[0].contains("TT")) {
319-
gotInventory = true;
320-
boolean matched = false;
321-
for (int i = 0; i < tagList.size(); i++) {
322-
if (output[1].matches(tagList.get(i))) {
323-
matched = true;
324-
break;
325-
}
326-
}
327-
if (registerTagGot != null) registerTagGot.setText(output[1]);
328-
if (matched == false) tagInventoried = output[1];
329-
} else if (output[0].contains("WW")) {
330-
long timePeriod = (System.currentTimeMillis() - startTimeMillis) / 1000;
331-
if (timePeriod > 0) {
332-
if (registerRunTime != null) registerRunTime.setText(String.format("Run time: %d sec", timePeriod));
333-
}
334-
} else if (taskCancelReason == TaskCancelRReason.NULL) {
335-
if (registerVoltageLevel != null) registerVoltageLevel.setText(MainActivity.mCs108Library4a.getBatteryDisplay(true));
336-
}
337-
} else {
338-
resultError += output[0];
339-
if (true)
340-
MainActivity.mCs108Library4a.appendToLog("output[0]: " + output[0] + ", resultError = " + resultError);
341-
}
342-
} else {
343-
MainActivity.mCs108Library4a.appendToLog("onProgressUpdate output[1] = " + output[1]);
344-
if (registerYield != null) {
345-
if (tagInventoried != null) {
346-
tagList.add(tagInventoried);
347-
tagInventoried = null;
348-
}
349-
registerYield.setText("Unique:" + Integer.toString(tagList.size()));
350-
}
351-
if (registerTotal != null) registerTotal.setText("Total:" + Integer.toString(++total));
352-
}
353-
}
354-
355304
void DeviceConnectTask4RegisterEnding() {
356305
String strErrorMessage = "";
357306
if (false) {
358307
boolean success = false;
359308
MainActivity.mCs108Library4a.appendToLog("repeat = " + repeat + ", taskCancelReason = " + taskCancelReason.toString()
360309
+ ", backscatterError = " + backscatterError + ", accessError =" + accessError + ", accessResult = " + accessResult + ", resultError = " + resultError);
361-
if ((repeat == false && taskCancelReason != TaskCancelRReason.NULL) || backscatterError != 0 || accessError != 0 || accessResult == null || resultError.length() != 0) {
310+
if ((repeat <= 1 && taskCancelReason != TaskCancelRReason.NULL) || backscatterError != 0 || accessError != 0 || accessResult == null || resultError.length() != 0) {
362311
MainActivity.mCs108Library4a.appendToLog("FAILURE"); Toast.makeText(MainActivity.mContext, R.string.toast_abort_by_FAILURE, Toast.LENGTH_SHORT).show();
363312
playerO.start();
364313
} else {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.os.Build;
1111
import android.os.Environment;
1212
import android.provider.Settings;
13+
import android.widget.Toast;
1314

1415
import com.csl.cs108library4a.Cs108Library4A;
1516
import com.csl.cs108library4a.ReaderDevice;
@@ -380,6 +381,7 @@ public String save2File(String messageStr, boolean requestPermission) {
380381
if (requestPermission) {
381382
mCs108Library4a.appendToLog("requestPermissions WRITE_EXTERNAL_STORAGE 1");
382383
MainActivity.permissionRequesting = true; requestPermissions((Activity) mContext, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
384+
Toast.makeText(mContext, com.csl.cs108library4a.R.string.toast_permission_not_granted, Toast.LENGTH_SHORT).show();
383385
return null;
384386
}
385387
} else mCs108Library4a.appendToLog("WRITE_EXTERNAL_STORAGE Permission is GRANTED !!!");

app/src/main/java/com/csl/cs108ademoapp/fragments/AccessAuraSenseFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ else if (taskRequest) {
178178
selectTag.editTextAccessRWAccPassword.getText().toString(),
179179
Integer.valueOf(selectTag.editTextaccessRWAntennaPower.getText().toString()),
180180
(operationRead ? Cs108Connector.HostCommands.CMD_18K6CREAD: Cs108Connector.HostCommands.CMD_18K6CWRITE),
181-
0, false, false,true,
181+
0, 0, true,
182182
null, null, null, null, null);
183183
accessTask.execute();
184184
rerunRequest = true;

0 commit comments

Comments
 (0)