@@ -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 ;
0 commit comments