Skip to content

Commit f749478

Browse files
committed
Updates for v1.13.0
- Changed the access message display for more information - Updated battery percentage checking curves and the battery low threshold - Improved version checking routine
1 parent ad47b69 commit f749478

File tree

48 files changed

+10607
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+10607
-94
lines changed

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
applicationId "com.csl.cs108ademoapp"
77
minSdkVersion 19
88
targetSdkVersion 26
9-
versionCode 17
10-
versionName "1.12.0"
9+
versionCode 18
10+
versionName "1.13.0"
1111
}
1212
compileOptions {
1313
sourceCompatibility JavaVersion.VERSION_1_7
@@ -17,6 +17,6 @@ android {
1717

1818
dependencies {
1919
compile fileTree(include: ['*.jar'], dir: 'libs')
20+
compile project(':cs108library4a')
2021
compile 'com.android.support:design:26.1.0'
21-
implementation project(':cs108library4a-debug')
2222
}

app/libs/cs108library4a-debug.aar

-86.2 KB
Binary file not shown.

app/libs/cs108library4a-release.aar

108 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":17,"versionName":"1.12.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
1+
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":18,"versionName":"1.13.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

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

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public enum TaskCancelRReason {
2121
TextView registerRunTime, registerTagGot, registerVoltageLevel;
2222
TextView registerYield, registerTotal;
2323
boolean invalidRequest;
24-
String tagPcValue; String selectMask; int selectBank, selectOffset;
24+
String selectMask; int selectBank, selectOffset;
2525
String strPassword; int powerLevel;
2626
Cs108Connector.HostCommands hostCommand;
2727

@@ -40,7 +40,7 @@ public enum TaskCancelRReason {
4040
int batteryCountInventory_old;
4141

4242
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest,
43-
String tagPcValue, String selectMask, int selectBank, int selectOffset,
43+
String selectMask, int selectBank, int selectOffset,
4444
String strPassword, int powerLevel, Cs108Connector.HostCommands hostCommand,
4545
int qValue, boolean repeat, boolean nextNew, boolean resetCount,
4646
TextView registerRunTime, TextView registerTagGot, TextView registerVoltageLevel,
@@ -54,7 +54,6 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
5454
this.registerTotal = registerTotalView;
5555

5656
this.invalidRequest = invalidRequest;
57-
this.tagPcValue = tagPcValue;
5857
this.selectMask = selectMask;
5958
this.selectBank = selectBank;
6059
this.selectOffset = selectOffset;
@@ -78,11 +77,16 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
7877
@Override
7978
protected void onPreExecute() {
8079
buttonText = button.getText().toString().trim();
81-
String buttonText1 = null;
82-
if (buttonText.substring(buttonText.length()-1).toUpperCase().matches("E")) buttonText1 = buttonText.substring(0, buttonText.length()-1);
80+
String buttonText1 = null; String strLastChar = buttonText.substring(buttonText.length()-1);
81+
if (strLastChar.toUpperCase().matches("E")) {
82+
buttonText1 = buttonText.substring(0, buttonText.length()-1);
83+
if (strLastChar.matches("E")) buttonText1 += "ING";
84+
else buttonText1 += "ing";
85+
}
8386
if (repeat || buttonText.length() == 0) button.setText("Stop");
84-
else if (buttonText1 != null) button.setText(buttonText1 + "ING");
85-
else button.setText(buttonText + "ING");
87+
else if (buttonText1 != null) button.setText(buttonText1);
88+
else if (Character.isUpperCase(strLastChar.charAt(0))) button.setText(buttonText + "ING");
89+
else button.setText(buttonText + "ing");
8690
if (registerYield != null && tagList.size()==0) registerYield.setText("");
8791
if (registerTotal != null && total == 0) registerTotal.setText("");
8892

@@ -111,8 +115,8 @@ else if (hostCommand == Cs108Connector.HostCommands.CMD_18K6CKILL) {
111115
int matchRep = 0;
112116
if (repeat == false || nextNew) matchRep = 1;
113117
if (powerLevel < 0 || powerLevel > 330) invalidRequest = true;
114-
else if (MainActivity.mCs108Library4a.setSelectedTag(tagPcValue, selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
115-
invalidRequest = true; MainActivity.mCs108Library4a.appendToLog("setSelectedTag is failed with tagPcValue = " + tagPcValue + ", selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
118+
else if (MainActivity.mCs108Library4a.setSelectedTag(null, selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
119+
invalidRequest = true; MainActivity.mCs108Library4a.appendToLog("setSelectedTag is failed with selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
116120
}
117121
}
118122
taskCancelReason = TaskCancelRReason.NULL;
@@ -241,7 +245,7 @@ protected void onPostExecute(String result) {
241245

242246
void DeviceConnectTask4RegisterEnding() {
243247
String strErrorMessage = "";
244-
if (true) {
248+
if (false) {
245249
boolean success = false;
246250
MainActivity.mCs108Library4a.appendToLog("repeat = " + repeat + ", taskCancelReason = " + taskCancelReason.toString()
247251
+ ", backscatterError = " + backscatterError + ", accessError =" + accessError + ", accessResult = " + accessResult + ", resultError = " + resultError);
@@ -253,27 +257,27 @@ void DeviceConnectTask4RegisterEnding() {
253257
playerN.start();
254258
}
255259
} else {
256-
MainActivity.mCs108Library4a.appendToLog("AAA");
257260
strErrorMessage = "";
258261
switch (taskCancelReason) {
259262
case NULL:
260-
strErrorMessage += "Finish as COMMAND END is received";
263+
if (accessResult == null || (resultError != null && resultError.length() != 0) || (endingMessaage != null && endingMessaage.length() != 0)) strErrorMessage += "Finish as COMMAND END is received";
264+
else Toast.makeText(MainActivity.mContext, R.string.toast_abort_by_SUCCESS, Toast.LENGTH_SHORT).show();
261265
break;
262266
case STOP:
263-
strErrorMessage += "Finish as STOP is pressed";
267+
strErrorMessage += "Finish as STOP is pressed. ";
264268
break;
265269
case BUTTON_RELEASE:
266-
strErrorMessage += "Finish as BUTTON is released";
270+
strErrorMessage += "Finish as BUTTON is released. ";
267271
break;
268272
case TIMEOUT:
269-
strErrorMessage += "Finish as TIMEOUT";
273+
strErrorMessage += "TIMEOUT without COMMAND_END. ";
270274
break;
271275
case INVALD_REQUEST:
272-
strErrorMessage += "Invalid sendHostRequest. Operation is cancelled.";
276+
strErrorMessage += "Invalid request. Operation is cancelled. ";
273277
break;
274278
}
275-
MainActivity.mCs108Library4a.appendToLog("resultError = " + resultError + ", taskCancelReason = " + taskCancelReason.toString() + ", strErrorMessage = " + strErrorMessage + ", endingMessaage = " + endingMessaage);
276-
if (resultError.length() != 0) strErrorMessage += " with Error " + resultError;
279+
MainActivity.mCs108Library4a.appendToLog("taskCancelReason = " + taskCancelReason.toString() + ", accessResult = " + (accessResult == null ? "NULL": accessResult) + ", endingMessaage = " + (endingMessaage == null ? "NULL" : endingMessaage) + ", resultError = " + (resultError == null ? "NULL" : resultError));
280+
if (resultError.length() != 0) strErrorMessage += resultError;
277281
if (strErrorMessage.length() != 0) strErrorMessage += ". ";
278282
}
279283
if (endingMessaage != null) if (endingMessaage.length() != 0) strErrorMessage += "Received CommandEND Error = " + endingMessaage;

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,10 @@ else if (taskRequest) {
211211
MainActivity.mCs108Library4a.appendToLog("processTickItems, invalid = " + invalid);
212212
if (bankProcessing++ != 0 && invalid == true) rerunRequest = false;
213213
else {
214-
/* if (restartAccessBank != accessBank) {
215-
restartAccessBank = accessBank;
216-
restartCounter = 3;
217-
}*/
218214
accessTask = new AccessTask(
219215
(operationRead ? buttonRead : buttonWrite), null,
220216
invalid,
221-
null, editTextRWTagID.getText().toString(), 1, 32,
217+
editTextRWTagID.getText().toString(), 1, 32,
222218
editTextAccessRWAccPassword.getText().toString(),
223219
Integer.valueOf(editTextaccessRWAntennaPower.getText().toString()),
224220
(operationRead ? Cs108Connector.HostCommands.CMD_18K6CREAD: Cs108Connector.HostCommands.CMD_18K6CWRITE),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ else if (taskRequest) {
197197
accessTask = new AccessTask(
198198
buttonRead, null,
199199
invalid,
200-
null, selectMask, selectBank, selectOffset,
200+
selectMask, selectBank, selectOffset,
201201
editTextAccessRWAccPassword.getText().toString(),
202202
Integer.valueOf(editTextaccessRWAntennaPower.getText().toString()),
203203
Cs108Connector.HostCommands.CMD_18K6CREAD,

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

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
import android.view.LayoutInflater;
88
import android.view.View;
99
import android.view.ViewGroup;
10+
import android.widget.ArrayAdapter;
1011
import android.widget.Button;
1112
import android.widget.CheckBox;
1213
import android.widget.EditText;
14+
import android.widget.Spinner;
1315
import android.widget.TextView;
1416
import android.widget.Toast;
1517

@@ -21,14 +23,15 @@
2123
import com.csl.cs108library4a.ReaderDevice;
2224

2325
public class AccessReadWriteFragment extends CommonFragment {
24-
EditText editTextRWTagID, editTextAccessRWAccPassword, editTextAccessRWKillPwd, editTextAccessRWAccPwd, editTextAccPc, editTextAccessRWEpc, editTExtAccessRWXpc;
26+
Spinner spinnerSelectBank;
27+
EditText editTextRWSelectOffset, editTextRWTagID, editTextAccessRWAccPassword, editTextAccessRWKillPwd, editTextAccessRWAccPwd, editTextAccPc, editTextAccessRWEpc, editTExtAccessRWXpc;
2528
EditText editTextTidValue, editTextUserValue, editTextEpcValue, editTextaccessRWAntennaPower;
2629
TextView textViewEpcLength;
2730
private Button buttonRead;
2831
private Button buttonWrite;
2932
Handler mHandler = new Handler();
3033

31-
String tagPcValue = ""; String accPcValue = ""; String accEpcValue = ""; String accXpcValue = ""; String accTidValue = ""; String accUserValue = "";
34+
String accPcValue = ""; String accEpcValue = ""; String accXpcValue = ""; String accTidValue = ""; String accUserValue = "";
3235
enum ReadWriteTypes {
3336
NULL, RESERVE, EPC, XPC, TID, USER, EPC1
3437
}
@@ -52,6 +55,12 @@ public void onActivityCreated(Bundle savedInstanceState) {
5255
actionBar.setIcon(R.drawable.dl_access);
5356
actionBar.setTitle(R.string.title_activity_readwrite);
5457

58+
spinnerSelectBank = (Spinner) getActivity().findViewById(R.id.accessRWSelectBank);
59+
ArrayAdapter<CharSequence> targetAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.read_memoryBank_options, R.layout.custom_spinner_layout);
60+
targetAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
61+
spinnerSelectBank.setAdapter(targetAdapter);
62+
editTextRWSelectOffset = (EditText) getActivity().findViewById(R.id.accessRWSelectOffset);
63+
5564
editTextRWTagID = (EditText) getActivity().findViewById(R.id.accessRWTagID);
5665
editTextAccessRWAccPassword = (EditText) getActivity().findViewById(R.id.accessRWAccPasswordValue);
5766
editTextAccessRWAccPassword.addTextChangedListener(new GenericTextWatcher(editTextAccessRWAccPassword, 8));
@@ -115,7 +124,6 @@ public void onClick(View v) {
115124
String header = "PC=";
116125
int index = detail.indexOf(header) + header.length();
117126
String strPCValue = detail.substring(index, index + 4);
118-
tagPcValue = strPCValue;
119127
if (true) {
120128
updatePCEpc(strPCValue, strEpcValue);
121129
} else {
@@ -172,18 +180,22 @@ public void run() {
172180
}
173181
if (processResult()) { rerunRequest = true; }
174182
else if (taskRequest) {
183+
bcheckBoxAll = false;
175184
boolean invalid = processTickItems();
176-
if (bankProcessing++ != 0 && invalid == true) rerunRequest = false;
185+
if (bankProcessing == 0 && bcheckBoxAll) rerunRequest = false;
186+
else if (bankProcessing++ != 0 && invalid == true) rerunRequest = false;
177187
else {
178188
if (restartAccessBank != accessBank) {
179189
restartAccessBank = accessBank;
180190
restartCounter = 3;
181191
}
182192
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("AccessReadWriteFragment().InventoryRfidTask(): tagID=" + editTextRWTagID.getText() + ", operationrRead=" + operationRead + ", accessBank=" + accessBank + ", accOffset=" + accOffset + ", accSize=" + accSize);
193+
int selectOffset = 0;
194+
selectOffset = Integer.parseInt(editTextRWSelectOffset.getText().toString());
183195
accessTask = new AccessTask(
184196
(operationRead ? buttonRead : buttonWrite), null,
185197
invalid,
186-
tagPcValue, editTextRWTagID.getText().toString(), 1, 32,
198+
editTextRWTagID.getText().toString(), spinnerSelectBank.getSelectedItemPosition() + 1, selectOffset,
187199
editTextAccessRWAccPassword.getText().toString(),
188200
Integer.valueOf(editTextaccessRWAntennaPower.getText().toString()),
189201
(operationRead ? Cs108Connector.HostCommands.CMD_18K6CREAD: Cs108Connector.HostCommands.CMD_18K6CWRITE),
@@ -197,7 +209,12 @@ else if (taskRequest) {
197209
mHandler.postDelayed(updateRunnable, 500);
198210
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("AccessReadWriteFragment().updateRunnable(): Restart");
199211
}
200-
else updating = false;
212+
else {
213+
if (bankProcessing == 0 && bcheckBoxAll) {
214+
Toast.makeText(MainActivity.mContext, "no choice selected yet", Toast.LENGTH_SHORT).show();
215+
}
216+
updating = false;
217+
}
201218
}
202219
};
203220

@@ -312,6 +329,7 @@ boolean processResult() {
312329
return true;
313330
}
314331
}
332+
boolean bcheckBoxAll = false;
315333
boolean processTickItems() {
316334
String writeData = "";
317335
boolean invalidRequest1 = false;
@@ -349,10 +367,8 @@ boolean processTickItems() {
349367
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("processTickItems(): start EPC operation");
350368
if (operationRead) {
351369
String detail = editTextAccPc.getText().toString();
352-
if (detail.length() != 4) {
353-
accOffset = 1;
354-
accSize = 1;
355-
} else {
370+
if (detail.length() != 4) accSize = 1;
371+
else {
356372
String detail2 = detail.substring(0, 1);
357373
int number2 = Integer.valueOf(detail2, 16) * 2;
358374
String detail3 = detail.substring(1, 2);
@@ -364,21 +380,24 @@ boolean processTickItems() {
364380
}
365381
} else {
366382
String strValue = editTextAccPc.getText().toString();
367-
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("processTickItems(): strValue = " + strValue + ", accPcValue = " + accPcValue);
368-
if (strValue.length() == 4 && strValue.matches(accPcValue) == false) {
369-
// accOffset = 1;
370-
accSize = 1;
371-
writeData = strValue;
372-
editTextAccessRWEpc.setText("");
373-
} else strValue = "";
374383
String strValue1 = editTextAccessRWEpc.getText().toString();
375-
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("processTickItems(): strValue1 = " + strValue1 + ", accEpcValue = " + accEpcValue);
376-
if (strValue1.length() >= 4 && strValue1.matches(accEpcValue) == false) {
377-
if (strValue.length() == 0) accOffset = 2;
384+
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("TestDebug111(): strValue = " + strValue + ", accPcValue = " + accPcValue);
385+
if (strValue1.length() == 0) {
386+
if (strValue.length() != 4) invalidRequest1 = true;
387+
else {
388+
accSize = 1;
389+
writeData = strValue;
390+
}
391+
} else {
378392
accSize += strValue1.length() / 4;
379393
if (strValue1.length() % 4 != 0) accSize++;
380-
writeData = strValue + strValue1;
381-
if (DEBUG) MainActivity.mCs108Library4a.appendToLog("processTickItems(): accOffset = " + accOffset + ", accSize = " + accSize);
394+
if (strValue.length() == 4) {
395+
accSize++;
396+
writeData = strValue + strValue1;
397+
} else {
398+
accOffset = 2;
399+
writeData = strValue1;
400+
}
382401
}
383402
}
384403
} else if (checkBoxTid.isChecked() == true) {
@@ -464,6 +483,7 @@ boolean processTickItems() {
464483
}
465484
} else {
466485
invalidRequest1 = true;
486+
bcheckBoxAll = true;
467487
}
468488

469489
if (restartAccessBank == accessBank) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void startAccessTask() {
380380
MainActivity.mCs108Library4a.appendToLog("selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", selectOffset1= " + selectOffset1 + ", invalidRequest1 = " + invalidRequest1);
381381

382382
accessTask = new AccessTask(buttonWrite, textViewWriteCount, invalidRequest1,
383-
"", selectMask, selectBank + 1, (selectBank == 0 ? selectOffset + 32 : selectOffset),
383+
selectMask, selectBank + 1, (selectBank == 0 ? selectOffset + 32 : selectOffset),
384384
password, antennaPower, Cs108Connector.HostCommands.CMD_18K6CWRITE, selectQValue, checkBoxAutoRun.isChecked(), checkBoxNewBarcode.isChecked(), resetCount,
385385
textViewRunTime, textViewTagGot, textViewVoltageLevel,
386386
textViewYield, textViewTotal);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void startAccessTask() {
123123
String strTagID = editTextTagID.getText().toString();
124124
String strPassword = editTextPassword.getText().toString();
125125
int powerLevel = Integer.valueOf(editTextAntennaPower.getText().toString());
126-
accessTask = new AccessTask(button, null, invalidRequest, "", strTagID, 1, 32, strPassword, powerLevel, Cs108Connector.HostCommands.CMD_18K6CKILL, 0, false, false, true, null, null, null, null, null);
126+
accessTask = new AccessTask(button, null, invalidRequest, strTagID, 1, 32, strPassword, powerLevel, Cs108Connector.HostCommands.CMD_18K6CKILL, 0, false, false, true, null, null, null, null, null);
127127
accessTask.execute();
128128
}
129129
}

0 commit comments

Comments
 (0)