Skip to content

Commit bcc1290

Browse files
authored
Merge pull request #22 from cslrfid/develop-eng
Develop eng
2 parents 54291b6 + 89be77e commit bcc1290

38 files changed

+1165
-2508
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
minSdkVersion 19
88
targetSdkVersion 30
99
versionCode 31
10-
versionName "2.1.15"
10+
versionName "2.1.30"
1111
}
1212
}
1313

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public enum TaskCancelRReason {
3434
long timeMillis, startTimeMillis, runTimeMillis;
3535
int accessError, backscatterError;
3636
boolean timeoutError, crcError;
37-
String resultError = "";
37+
public String resultError = "";
3838
boolean success;
3939
boolean done = false;
4040
boolean ending = false;
@@ -233,7 +233,7 @@ else if (repeat && (nextNew == false || resultError.length() != 0)) {
233233
else if (notificationData != null) {
234234
//MainActivity.mCs108Library4a.appendToLog("resultError=" + MainActivity.mCs108Library4a.byteArrayToString(notificationData));
235235
publishProgress("Received notification uplink event 0xA101 with error code=" + MainActivity.mCs108Library4a.byteArrayToString(notificationData));
236-
taskCancelReason = TaskCancelRReason.TIMEOUT;
236+
taskCancelReason = TaskCancelRReason.ERROR;
237237
}
238238
if (System.currentTimeMillis() - timeMillis > iTimeOut) {
239239
//MainActivity.mCs108Library4a.appendToLog("endingMessage: iTimeout = " + iTimeOut);

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

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ protected String doInBackground(Void... a) {
198198
long firstTimeOld = 0, timeMillisSound = 0; int totalOld = 0;
199199
@Override
200200
protected void onProgressUpdate(String... output) {
201+
if (false) MainActivity.mCs108Library4a.appendToLog("InventoryRfidTask: output[0] = " + output[0]);
201202
if (output[0] != null) {
202203
if (output[0].length() == 1) inventoryHandler_endReason();
203204
else if (output[0].length() == 2) {
@@ -307,7 +308,7 @@ void inventoryHandler_tag() {
307308
MainActivity.mCs108Library4a.appendToLog("HelloK: strMdid = " + strMdid + ", MainMdid = " + MainActivity.mDid + ", bFastId = " + bFastId);
308309

309310
int iPc = Integer.parseInt(strPc, 16);
310-
String strXpc = null; int iSensorData = ReaderDevice.INVALID_SENSORDATA; if ((iPc & 0x0200) != 0) {
311+
String strXpc = null; int iSensorData = ReaderDevice.INVALID_SENSORDATA; if ((iPc & 0x0200) != 0 && strEpc != null && strEpc.length() >= 8) {
311312
int iXpcw1 = Integer.parseInt(strEpc.substring(0, 4), 16);
312313
if ((iXpcw1 & 0x8000) != 0) {
313314
strXpc = strEpc.substring(0, 8);
@@ -349,32 +350,72 @@ void inventoryHandler_tag() {
349350
}
350351
if (bValidFastId == false) return;
351352
MainActivity.mCs108Library4a.appendToLog("HelloK: Doing IMPINJ Inventory with strMdid = " + strMdid + ", strEpc1 = " + strEpc1 + ":, strTid = " + strTid);
352-
} else if (strMdid != null && MainActivity.mDid != null) {
353+
} else if (MainActivity.mDid != null) {
354+
MainActivity.mCs108Library4a.appendToLog("HelloK: MainActivity.mDid = " + MainActivity.mDid);
353355
if (MainActivity.mDid.matches("E2806894B")) {
354356
if (strEpc.length() >= 24) {
355357
String strEpc1 = strEpc.substring(0, strEpc.length() - 24);
356358
String strTid = strEpc.substring(strEpc.length() - 24, strEpc.length());
359+
MainActivity.mCs108Library4a.appendToLog("HelloK: matched E2806894B with strEpc = " + strEpc + ", strEpc1 = " + strEpc1 + ", strTid = " + strTid + ", strExtra1 = " + strExtra1);
360+
boolean matched = true;
357361
if (strExtra1 != null) {
358-
if (strExtra1.length() == 8 && strTid.contains(strExtra1)) {
359-
strEpc = strEpc1; strAddresss = strEpc;
360-
strExtra2 = strTid;
361-
extra2Bank = 2;
362-
data2_offset = 0;
363-
}
362+
if (!(strExtra1.length() == 8 && strTid.contains(strExtra1))) matched = false;
363+
}
364+
if (matched) {
365+
strEpc = strEpc1;
366+
strAddresss = strEpc;
367+
strExtra2 = strTid;
368+
extra2Bank = 2;
369+
data2_offset = 0;
364370
}
371+
/*if (strTid.contains("E2806894") == false) {
372+
MainActivity.mCs108Library4a.appendToLog("HelloK: Skip the record without strExtra1 E2806894: " + strEpc);
373+
return;
374+
}*/
365375
}
366-
} else if (MainActivity.mDid.matches("E2806894C")) {
367-
if (strExtra1 != null && strEpc.length() >= 4) {
368-
if (strExtra1.contains("E2806894")) {
369-
String strEpc1 = strEpc.substring(0, strEpc.length() - 4);
370-
String strTid = strEpc.substring(strEpc.length() - 4, strEpc.length());
376+
} else if (MainActivity.mDid.matches("E2806894C") || MainActivity.mDid.matches("E2806894d")) {
377+
if (strEpc.length() >= 4) {
378+
String strEpc1 = strEpc.substring(0, strEpc.length() - 4);
379+
String strBrand = strEpc.substring(strEpc.length() - 4, strEpc.length());
380+
MainActivity.mCs108Library4a.appendToLog("HelloK: matched E2806894B with strEpc = " + strEpc + ", strEpc1 = " + strEpc1 + ", strBrand = " + strBrand + ", strExtra1 = " + strExtra1);
381+
boolean matched = true;
382+
if (strExtra1 != null || MainActivity.mDid.matches("E2806894d")) {
383+
if (!(strExtra1 != null && strExtra1.length() == 8 && strExtra1.contains("E2806894"))) {
384+
matched = false;
385+
/*if (MainActivity.mDid.matches("E2806894d")) {
386+
MainActivity.mCs108Library4a.appendToLog("HelloK: Skip the record without strExtra1 E2806894: " + strEpc);
387+
return;
388+
}*/
389+
}
390+
}
391+
if (matched) {
371392
strEpc = strEpc1; strAddresss = strEpc;
372-
brand = strTid;
393+
brand = strBrand;
373394
MainActivity.mCs108Library4a.appendToLog("HelloK: brand 1 = " + brand + ", strEpc = " + strEpc);
374395
}
375396
}
376397
}
377398
}
399+
400+
MainActivity.mCs108Library4a.appendToLog("strTidCompared = " + strMdid + ", MainActivity.mDid = " + MainActivity.mDid + ", strExtra1 = " + strExtra1 + ", strExtra2 = " + strExtra2);
401+
if (strMdid != null) {
402+
String strTidCompared = strMdid;
403+
if (strTidCompared.indexOf("E28011") == 0) strTidCompared = "E28011";
404+
if (strTidCompared.matches("E282402")) { }
405+
else if (strTidCompared.matches("E282403")) { }
406+
else if (strTidCompared.matches("E282405")) { }
407+
else if (strTidCompared.matches("E2806894") && MainActivity.mDid.matches("E2806894C")) { }
408+
else { //if (strMdid.matches("E280B0"))
409+
boolean bMatched = false;
410+
if (strExtra1 != null && strExtra1.indexOf(strTidCompared) == 0) {
411+
bMatched = true; MainActivity.mCs108Library4a.appendToLog("strExtra1 contains strTidCompared");
412+
} else if (strExtra2 != null && strExtra2.indexOf(strTidCompared) == 0) {
413+
bMatched = true; MainActivity.mCs108Library4a.appendToLog("strEXTRA2 contains strTidCompared");
414+
}
415+
if (bMatched == false) return;
416+
}
417+
}
418+
378419
rssi = rx000pkgData.decodedRssi;
379420
phase = rx000pkgData.decodedPhase;
380421
chidx = rx000pkgData.decodedChidx;
@@ -429,7 +470,14 @@ void inventoryHandler_tag() {
429470
readerDevice.setBrand(brand);
430471
readerDevice.setCodeTempC(codeTempC);
431472
readerDevice.setSensorData(iSensorData);
432-
readerDevice.setExtra(strExtra1, extra1Bank, data1_offset, strExtra2, extra2Bank, data2_offset);
473+
if (strExtra1 != null) readerDevice.setExtra1(strExtra1, extra1Bank, data1_offset);
474+
else if (readerDevice.getstrExtra1() != null) {
475+
MainActivity.mCs108Library4a.appendToLog("HelloK: no null replacement of StrExtra1");
476+
}
477+
if (strExtra2 != null) readerDevice.setExtra2(strExtra2, extra2Bank, data2_offset);
478+
else if (readerDevice.getstrExtra2() != null) {
479+
MainActivity.mCs108Library4a.appendToLog("HelloK: no null replacement of StrExtra2");
480+
}
433481
tagsList.set(iMatchItem, readerDevice);
434482
match = true;
435483
updated = true;

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,6 @@ public void run() {
174174
CustomProgressDialog progressDialog;
175175
private void selectItem(DrawerPositions position) {
176176
Log.i(TAG, "MainActivity.selectItem: position = " + position);
177-
if (false && position != DrawerPositions.MAIN && position != DrawerPositions.ABOUT && position != DrawerPositions.CONNECT && mCs108Library4a != null) {
178-
if (MainActivity.mCs108Library4a.isRfidFailure() == false && mCs108Library4a.mrfidToWriteSize() != 0) {
179-
if (configureDisplaying == false) {
180-
progressDialog = new CustomProgressDialog(this, "Initializing reader. Please wait.");
181-
progressDialog.show();
182-
mHandler.post(configureRunnable);
183-
}
184-
return;
185-
}
186-
}
187177
if (true && position != DrawerPositions.MAIN && position != DrawerPositions.ABOUT && position != DrawerPositions.CONNECT && mCs108Library4a.isBleConnected() == false) {
188178
Toast.makeText(MainActivity.mContext, "Bluetooth Disconnected. Please Connect.", Toast.LENGTH_SHORT).show();
189179
return;
@@ -208,7 +198,6 @@ private void selectItem(DrawerPositions position) {
208198
fragment = new InventoryRfidSearchFragment();
209199
break;
210200
case MULTIBANK:
211-
mDid = null;
212201
fragment = InventoryRfidiMultiFragment.newInstance(true, null);
213202
break;
214203
case SETTING:

0 commit comments

Comments
 (0)