Skip to content

Develop #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdk 23
targetSdk 35
versionCode 42
versionName "2.14.31"
versionName "2.14.38"
}
}

Expand Down
Binary file not shown.
20 changes: 12 additions & 8 deletions app/src/main/java/com/csl/cs108ademoapp/AccessTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum TaskCancelRReason {
Button button; String buttonText;
TextView registerRunTime, registerTagGot, registerVoltageLevel;
TextView registerYield, registerTotal;
boolean invalidRequest;
boolean invalidRequest, selectOne = false;
String selectMask; int selectBank, selectOffset;
String strPassword; int powerLevel;
RfidReaderChipData.HostCommands hostCommand;
Expand All @@ -49,7 +49,7 @@ public enum TaskCancelRReason {
int batteryCountInventory_old;
boolean bSkipClearFilter = false;

public AccessTask(Button button, boolean invalidRequest,
public AccessTask(Button button, boolean invalidRequest, boolean selectOne,
String selectMask, int selectBank, int selectOffset,
String strPassword, int powerLevel, RfidReaderChipData.HostCommands hostCommand,
boolean bEnableErrorPopWindow, Runnable updateRunnable) {
Expand All @@ -58,6 +58,7 @@ public AccessTask(Button button, boolean invalidRequest,
this.registerVoltageLevel = registerVoltageLevel;

this.invalidRequest = invalidRequest; MainActivity.csLibrary4A.appendToLog("invalidRequest = " + invalidRequest);
this.selectOne = selectOne;
this.selectMask = selectMask;
this.selectBank = selectBank;
this.selectOffset = selectOffset;
Expand All @@ -72,7 +73,7 @@ public AccessTask(Button button, boolean invalidRequest,
}
preExecute();
}
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest,
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest, boolean selectOne,
String selectMask, int selectBank, int selectOffset,
String strPassword, int powerLevel, RfidReaderChipData.HostCommands hostCommand,
int qValue, int repeat, boolean resetCount, boolean bSkipClearFilter,
Expand All @@ -86,6 +87,7 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
this.registerTotal = registerTotalView;

this.invalidRequest = invalidRequest; MainActivity.csLibrary4A.appendToLog("invalidRequest = " + invalidRequest);
this.selectOne = selectOne;
this.selectMask = selectMask;
this.selectBank = selectBank;
this.selectOffset = selectOffset;
Expand All @@ -96,6 +98,7 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
if (repeat > 255) repeat = 255;
this.repeat = repeat;
this.bSkipClearFilter = bSkipClearFilter;
if (bSkipClearFilter) this.selectOne = false;
if (resetCount) {
total = 0;
tagList.clear();
Expand Down Expand Up @@ -151,19 +154,18 @@ else if (hostCommand == RfidReaderChipData.HostCommands.CMD_18K6CKILL) {
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setAccessRetry is failed");
}
}
MainActivity.csLibrary4A.appendToLog("setSelectCriteria: invalidRequest = " + invalidRequest + ", repeat = " + repeat + ", bSkipClearFilter = " + bSkipClearFilter + ", powerLevel = " + powerLevel + ", skipSelect = " + skipSelect);
if (invalidRequest == false) {
if (DEBUG) MainActivity.csLibrary4A.appendToLog("AccessTask(): powerLevel = " + powerLevel);
int matchRep = 1;
if (repeat > 1) matchRep = repeat;
if (bSkipClearFilter == false) {
if (false && bSkipClearFilter == false) {
MainActivity.csLibrary4A.appendToLog("Going to setSelectCriteria disable");
MainActivity.csLibrary4A.setSelectCriteriaDisable(-1);
}
if (powerLevel < 0 || powerLevel > 330) invalidRequest = true;
else if (skipSelect == false) {
MainActivity.csLibrary4A.appendToLog("setSelectCriteria: Going to setSelectTag");
if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
MainActivity.csLibrary4A.appendToLog("AccessTask.preExecute goes to setSelectTag");
if (MainActivity.csLibrary4A.setSelectedTag(selectOne, selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setSelectedTag is failed with selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
}
}
Expand All @@ -178,6 +180,7 @@ else if (skipSelect == false) {
if (MainActivity.csLibrary4A.checkHostProcessorVersion(MainActivity.csLibrary4A.getMacVer(), 2, 6, 8)) {
MainActivity.csLibrary4A.setInvModeCompact(false);
}
//MainActivity.csLibrary4A.setTagRead(0);
MainActivity.csLibrary4A.sendHostRegRequestHST_CMD(hostCommand);
}
}
Expand Down Expand Up @@ -226,6 +229,7 @@ else if (rx000pkgData != null) {
if (rx000pkgData.decodedError != null) { endingMessaage = rx000pkgData.decodedError; ending = true; }
else if (repeat > 0 && resultError.length() == 0) {
resultError = "";
if (true) MainActivity.csLibrary4A.appendToLog("Debug_InvCfg: AccessTask.doInBackground goes to setMatchRep with repeat = " + repeat);
MainActivity.csLibrary4A.setMatchRep(repeat);
MainActivity.csLibrary4A.sendHostRegRequestHST_CMD(hostCommand);
} else {
Expand Down Expand Up @@ -319,7 +323,7 @@ protected void onPostExecute(String result) {
}

void DeviceConnectTask4RegisterEnding() {
MainActivity.csLibrary4A.setAccessCount(0);
//MainActivity.csLibrary4A.setAccessCount(0);
String strErrorMessage = "";
if (false) {
boolean success = false;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/csl/cs108ademoapp/AccessTask1.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void setup() {
}
MainActivity.csLibrary4A.appendToLog("HelloA: accOffset=" + accOffset + ", accSizeNow=" + accSizeNow + ", accSize=" + accSize);
MainActivity.csLibrary4A.appendToLog("HelloK: invalidRequest=" + invalidRequest);
accessTask = new AccessTask(button, invalidRequest,
accessTask = new AccessTask(button, invalidRequest, true,
selectMask, selectBank, selectOffset,
strPassword, powerLevel, hostCommand, tryCount==tryCountMax, updateRunnable);
}
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/csl/cs108ademoapp/CustomIME.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ else if (MainActivity.sharedObjects == null || MainActivity.csLibrary4A == null)
String strSgtin = null;
if (MainActivity.csLibrary4A.getWedgeOutput() == 1) {
strSgtin = MainActivity.csLibrary4A.getUpcSerial(strEpc);
MainActivity.csLibrary4A.appendToLog("strSgtin = " + (strSgtin == null ? "null" : strSgtin));
appendToLog("strSgtin = " + (strSgtin == null ? "null" : strSgtin));
if (strSgtin == null) strEpc = null;
}
boolean matched = false;
Expand All @@ -164,7 +164,7 @@ else if (MainActivity.sharedObjects == null || MainActivity.csLibrary4A == null)
strValue = MainActivity.csLibrary4A.getWedgePrefix() + strValue;
if (MainActivity.csLibrary4A.getWedgeSuffix() != null)
strValue += MainActivity.csLibrary4A.getWedgeSuffix();
MainActivity.csLibrary4A.appendToLog("CustomIME, serviceRunnable: wedgeDelimiter = " + MainActivity.csLibrary4A.getWedgeDelimiter());
appendToLog("CustomIME, serviceRunnable: wedgeDelimiter = " + MainActivity.csLibrary4A.getWedgeDelimiter());
switch (MainActivity.csLibrary4A.getWedgeDelimiter()) {
default:
strValue += "\n";
Expand All @@ -181,7 +181,7 @@ else if (MainActivity.sharedObjects == null || MainActivity.csLibrary4A == null)
case -1:
break;
}
MainActivity.csLibrary4A.appendToLog("CustomIME BtData to Keyboard: " + strValue);
appendToLog("CustomIME BtData to Keyboard: " + strValue);
ic.commitText(strValue, 1);
}
}
Expand All @@ -190,7 +190,7 @@ else if (MainActivity.sharedObjects == null || MainActivity.csLibrary4A == null)
}
int iDelayms = 500;
if (inventoring) iDelayms = 100;
MainActivity.csLibrary4A.appendToLog("CustomIME BtData set next time as " + iDelayms);
appendToLog("CustomIME BtData set next time as " + iDelayms);
mHandler.postDelayed(serviceRunnable, iDelayms);
}
};
Expand All @@ -215,6 +215,7 @@ void startStopHandler() {
inventoryBarcodeTask.execute();
} else {
MainActivity.csLibrary4A.setPowerLevel(MainActivity.csLibrary4A.getWedgePower());
MainActivity.csLibrary4A.appendToLog("Debug_Compact: CustomIME.startStopHandler");
MainActivity.csLibrary4A.startOperation(RfidReaderChipData.OperationTypes.TAG_INVENTORY_COMPACT);
inventoryRfidTask = new InventoryRfidTask();
inventoryRfidTask.execute();
Expand Down
24 changes: 17 additions & 7 deletions app/src/main/java/com/csl/cs108ademoapp/InventoryRfidTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public enum TaskCancelRReason {
Handler handler = new Handler(); boolean bValidVibrateNewAll = false; boolean bUseVibrateMode0 = false;

void inventoryHandler_setup() {
MainActivity.csLibrary4A.appendToLog("InventoryRfidTask.inventoryHandler_setup set runningInventoryRfidTask as true ");
MainActivity.sharedObjects.runningInventoryRfidTask = true;
total = 0; allTotal = 0; yield = 0;
if (tagsList != null) {
Expand Down Expand Up @@ -165,6 +166,7 @@ protected String doInBackground(Void... a) {
if (rx000pkgData.decodedError != null) endingMessaage = rx000pkgData.decodedError;
if (continousRequest) {
MainActivity.csLibrary4A.batteryLevelRequest();
MainActivity.csLibrary4A.appendToLog("Debug_Compact: InventoryRfidTask.doInBackground");
MainActivity.csLibrary4A.startOperation(RfidReaderChipData.OperationTypes.TAG_INVENTORY_COMPACT);
} else ending = true;
}
Expand Down Expand Up @@ -293,14 +295,15 @@ void tagHandler() {
if (DEBUG) MainActivity.csLibrary4A.appendToLog("InventoryRfidTask: !!! rx000pkgData.Pc length = " + strPc.length());
continue;
}
int extraLength = 0;
/*int extraLength = 0;
if (extra1Bank != -1 && rx000pkgData.decodedData1 != null) extraLength += rx000pkgData.decodedData1.length;
if (extra2Bank != -1 && rx000pkgData.decodedData2 != null) extraLength += rx000pkgData.decodedData2.length;
if (extraLength != 0) {
byte[] decodedEpcNew = new byte[rx000pkgData.decodedEpc.length - extraLength];
System.arraycopy(rx000pkgData.decodedEpc, 0, decodedEpcNew, 0, decodedEpcNew.length);
rx000pkgData.decodedEpc = decodedEpcNew;
}
}*/
MainActivity.csLibrary4A.appendToLog("ApData: decodedEpc = " + MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedEpc) + ", data1,2 = " + MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedData1) + ", " + MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedData2));
String strEpc = MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedEpc);
if (DEBUG) MainActivity.csLibrary4A.appendToLog("HelloC: decodePc = " + strPc + ", decodedEpc = " + strEpc + ", iFlags = " + String.format("%2X", iFlag));
portstatus = INVALID_CODEVALUE; backport1 = INVALID_CODEVALUE; backport2 = INVALID_CODEVALUE; codeSensor = INVALID_CODEVALUE; codeRssi = INVALID_CODEVALUE; codeTempC = INVALID_CODEVALUE; brand = null;
Expand Down Expand Up @@ -335,15 +338,19 @@ void tagHandler() {
}

boolean bFastId = false; boolean bTempId = false;
MainActivity.csLibrary4A.appendToLog("bFastId is false with MainActivity.mDid = " + MainActivity.mDid + ", getFastId = " + MainActivity.csLibrary4A.getFastId());
if (MainActivity.mDid != null) {
MainActivity.csLibrary4A.appendToLog("mDid = " + MainActivity.mDid);
if (MainActivity.mDid.indexOf("E28011") == 0) {
int iValue = Integer.valueOf(MainActivity.mDid.substring("E28011".length()), 16);
MainActivity.csLibrary4A.appendToLog(String.format("iValue = 0x%02X", iValue));
if ((iValue & 0x20) != 0) bFastId = true;
if ((iValue & 0x20) != 0) {
bFastId = true; MainActivity.csLibrary4A.appendToLog("bFastId is true");
}
if (DEBUG) MainActivity.csLibrary4A.appendToLog("HelloK: iValue = " + String.format("%02X", iValue));
}
} else if (MainActivity.csLibrary4A.getFastId() > 0) bFastId = true;
} else if (MainActivity.csLibrary4A.getFastId() > 0) {
bFastId = true; MainActivity.csLibrary4A.appendToLog("bFastId is true");
}
if (DEBUG) MainActivity.csLibrary4A.appendToLog("HelloK: strMdid = " + strMdid + ", MainMdid = " + MainActivity.mDid + ", bFastId = " + bFastId);

int iPc = Integer.parseInt(strPc, 16);
Expand Down Expand Up @@ -549,13 +556,14 @@ else if (readerDevice.getstrExtra2() != null) {
if (ALLOW_WEDGE) MainActivity.sharedObjects.serviceArrayList.add(strEpc);

boolean bAddDevice = true; String strValue = null;
MainActivity.csLibrary4A.appendToLog("bProtectOnly = " + bProtectOnly);
if (bSgtinOnly) {
strValue = MainActivity.csLibrary4A.getUpcSerial(strEpc);
MainActivity.csLibrary4A.appendToLog("bSgtinOnly = " + bSgtinOnly + ", strValue = " + (strValue == null ? "null" : strValue));
if (strValue == null) bAddDevice = false;
} else if (bProtectOnly) {
bAddDevice = false;
if (strExtra1 != null) {
bAddDevice = false;
strValue = strExtra1.substring(strExtra1.length() - 1);
int iValue = Integer.parseInt(strValue, 16);
MainActivity.csLibrary4A.appendToLog("bProtectOnly = " + bProtectOnly + ", strExtra1 = " + (strExtra1 == null ? "null" : strExtra1) + ", iValue = " + iValue);
Expand Down Expand Up @@ -833,7 +841,9 @@ void DeviceConnectTask4InventoryEnding(TaskCancelRReason taskCancelReason) {
MainActivity.csLibrary4A.appendToLog("INVENDING: Toasting");
if (mytoast != null) mytoast.show();
}
if (button != null) button.setText("Start"); MainActivity.sharedObjects.runningInventoryRfidTask = false;
if (button != null) button.setText("Start");
MainActivity.csLibrary4A.appendToLog("InventoryRfidTask.DeviceConnectTask4InventoryEnding set runningInventoryRfidTask as false ");
MainActivity.sharedObjects.runningInventoryRfidTask = false;
if (endingMessaage != null) {
CustomPopupWindow customPopupWindow = new CustomPopupWindow(MainActivity.mContext);
customPopupWindow.popupStart(endingMessaage, false);
Expand Down
17 changes: 12 additions & 5 deletions app/src/main/java/com/csl/cs108ademoapp/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.csl.cs108ademoapp;

import static com.csl.cslibrary4a.RfidReader.TagType.TAG_ALIEN;
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_ASYGNTAG;
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_CTESIUS;
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_EM_BAP;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
Expand Down Expand Up @@ -48,6 +53,7 @@
import com.csl.cs108ademoapp.fragments.UcodeFragment;
import com.csl.cslibrary4a.Cs108Library4A;
import com.csl.cslibrary4a.ReaderDevice;
import com.csl.cslibrary4a.RfidReader;

public class MainActivity extends AppCompatActivity {
final boolean DEBUG = false; final String TAG = "Hello";
Expand All @@ -73,6 +79,7 @@ public class MainActivity extends AppCompatActivity {
Handler mHandler = new Handler();

public static String mDid; public static int selectHold; public static int selectFor;
public static RfidReader.TagType tagType;
public static class Config {
public String configPassword, configPower, config0, config1, config2, config3;
};
Expand Down Expand Up @@ -199,7 +206,7 @@ private void selectItem(DrawerPositions position) {
fragment = new InventoryRfidSearchFragment(false);
break;
case MULTIBANK:
fragment = InventoryRfidiMultiFragment.newInstance(true, null);
fragment = InventoryRfidiMultiFragment.newInstance(true, null, null);
break;
case SIMINVENTORY:
fragment = InventoryRfidSimpleFragment.newInstance(false, null);
Expand All @@ -224,7 +231,7 @@ private void selectItem(DrawerPositions position) {
fragment = new ImpinjM775Fragment();
break;
case ALIEN:
fragment = InventoryRfidiMultiFragment.newInstance(true, "E2003");
fragment = InventoryRfidiMultiFragment.newInstance(true, TAG_ALIEN, "E2003");
break;
case UCODE8:
fragment = new Ucode8Fragment();
Expand All @@ -233,7 +240,7 @@ private void selectItem(DrawerPositions position) {
fragment = new UcodeFragment();
break;
case BAPCARD:
fragment = InventoryRfidiMultiFragment.newInstance(true, "E200B0");
fragment = InventoryRfidiMultiFragment.newInstance(true, TAG_EM_BAP, "E200B0");
break;
case COLDCHAIN:
fragment = new ColdChainFragment();
Expand All @@ -257,10 +264,10 @@ private void selectItem(DrawerPositions position) {
fragment = new FdmicroFragment();
break;
case CTESIUS:
fragment = InventoryRfidiMultiFragment.newInstance(true, "E203510");
fragment = InventoryRfidiMultiFragment.newInstance(true, TAG_CTESIUS, "E203510");
break;
case ASYGNTAG:
fragment = InventoryRfidiMultiFragment.newInstance(true, "E283A");
fragment = InventoryRfidiMultiFragment.newInstance(true, TAG_ASYGNTAG, "E283A");
break;

case REGISTER:
Expand Down
Loading