Skip to content

Develop eng #47

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 2 commits into from
Feb 26, 2024
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
18 changes: 12 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33
namespace 'com.csl.cs108ademoapp'
buildFeatures {
buildConfig true
}

compileSdk 34
defaultConfig {
applicationId "com.csl.cs108ademoapp"
minSdkVersion 19
targetSdkVersion 33
versionCode 38
versionName "2.8.22"
minSdk 21
targetSdk 34
versionCode 39
versionName "2.10.2"
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.material:material:1.11.0'
implementation project(':cs108library4a')
implementation 'com.google.android.material:material:1.9.0'
implementation project(':cslibrary4a')
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 3 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.csl.cs108ademoapp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -18,7 +17,7 @@
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme">

<service android:name=".CustomIME"
<service android:name="CustomIME"
android:label="@string/app_ime"
android:exported="true"
android:permission="android.permission.BIND_INPUT_METHOD">
Expand All @@ -29,7 +28,7 @@
</service>

<activity
android:name=".MainActivity"
android:name="MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
Expand Down
29 changes: 22 additions & 7 deletions app/src/main/java/com/csl/cs108ademoapp/AccessTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum TaskCancelRReason {
}
public TaskCancelRReason taskCancelReason;
public String accessResult;
public String accessTagEpc;
Handler mHandler = new Handler();
Runnable updateRunnable = null;

Expand Down Expand Up @@ -46,6 +47,7 @@ public enum TaskCancelRReason {

boolean gotInventory;
int batteryCountInventory_old;
boolean bSkipClearFilter = false;

public AccessTask(Button button, boolean invalidRequest,
String selectMask, int selectBank, int selectOffset,
Expand Down Expand Up @@ -73,9 +75,8 @@ public AccessTask(Button button, boolean invalidRequest,
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest,
String selectMask, int selectBank, int selectOffset,
String strPassword, int powerLevel, Cs108Library4A.HostCommands hostCommand,
int qValue, int repeat, boolean resetCount,
TextView registerRunTime, TextView registerTagGot, TextView registerVoltageLevel,
TextView registerYieldView, TextView registerTotalView) {
int qValue, int repeat, boolean resetCount, boolean bSkipClearFilter,
TextView registerRunTime, TextView registerTagGot, TextView registerVoltageLevel, TextView registerYieldView, TextView registerTotalView) {
this.button = button;
this.registerTotal = textViewWriteCount;
this.registerRunTime = registerRunTime;
Expand All @@ -94,6 +95,7 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
this.qValue = qValue;
if (repeat > 255) repeat = 255;
this.repeat = repeat;
this.bSkipClearFilter = bSkipClearFilter;
if (resetCount) {
total = 0;
tagList.clear();
Expand All @@ -105,7 +107,7 @@ public void setRunnable(Runnable updateRunnable) {
}

void preExecute() {
accessResult = null;
accessResult = null; MainActivity.csLibrary4A.appendToLog("accessResult is set null");
playerO = MainActivity.sharedObjects.playerO;
playerN = MainActivity.sharedObjects.playerN;
//playerN.start();
Expand Down Expand Up @@ -149,14 +151,21 @@ else if (hostCommand == Cs108Library4A.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) {
MainActivity.csLibrary4A.appendToLog("Going to setSelectCriteria disable");
MainActivity.csLibrary4A.setSelectCriteriaDisable(-1);
}
if (powerLevel < 0 || powerLevel > 330) invalidRequest = true;
else if (skipSelect) { }
else if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setSelectedTag is failed with selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
else if (skipSelect == false) {
MainActivity.csLibrary4A.appendToLog("setSelectCriteria: Going to setSelectTag");
if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setSelectedTag is failed with selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
}
}
}
gotInventory = false;
Expand All @@ -173,10 +182,13 @@ else if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectO
}
}

boolean accessCompleteReceived = false;

@Override
protected String doInBackground(Void... a) {
boolean ending = false;
int iTimeOut = 5000;
accessCompleteReceived = false;

while (MainActivity.csLibrary4A.isBleConnected() && isCancelled() == false && ending == false) {
int batteryCount = MainActivity.csLibrary4A.getBatteryCount();
Expand All @@ -195,6 +207,7 @@ else if (rx000pkgData != null) {
if (rx000pkgData.responseType == null) {
publishProgress("null response");
} else if (rx000pkgData.responseType == Cs108Library4A.HostCmdResponseTypes.TYPE_18K6C_TAG_ACCESS) {
accessCompleteReceived = true;
MainActivity.csLibrary4A.appendToLog("rx000pkgData.dataValues = " + MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.dataValues));
if (rx000pkgData.decodedError == null) {
if (done == false) {
Expand All @@ -208,6 +221,7 @@ else if (rx000pkgData != null) {
} else publishProgress(rx000pkgData.decodedError);
iTimeOut = 1000;
} else if (rx000pkgData.responseType == Cs108Library4A.HostCmdResponseTypes.TYPE_COMMAND_END) {
if (hostCommand == Cs108Library4A.HostCommands.CMD_18K6CKILL && accessCompleteReceived == false) accessResult = "";
MainActivity.csLibrary4A.appendToLog("BtData: repeat = " + repeat + ", decodedError = " + rx000pkgData.decodedError + ", resultError = " + resultError);
if (rx000pkgData.decodedError != null) { endingMessaage = rx000pkgData.decodedError; ending = true; }
else if (repeat > 0 && resultError.length() == 0) {
Expand All @@ -219,6 +233,7 @@ else if (repeat > 0 && resultError.length() == 0) {
ending = true;
}
} else if (rx000pkgData.responseType == Cs108Library4A.HostCmdResponseTypes.TYPE_18K6C_INVENTORY) {
accessTagEpc = MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedEpc);
done = false;
publishProgress("TT", MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedEpc));
} else {
Expand Down
17 changes: 13 additions & 4 deletions app/src/main/java/com/csl/cs108ademoapp/AccessTask1.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,19 @@ else if (isResultReady == false) {
}
public String accessResult;
public String getResult() {
MainActivity.csLibrary4A.appendToLog("HelloA: accessResult=" + accessResult);
if (accessTask == null) return null;
if (accessTask.getStatus() != AsyncTask.Status.FINISHED) return null;
if (button.getText().toString().indexOf("ING") > 0) return null;
MainActivity.csLibrary4A.appendToLog("HelloA: accessResult = " + accessResult);
if (accessTask == null) {
MainActivity.csLibrary4A.appendToLog("accessTask is null");
return null;
}
if (accessTask.getStatus() != AsyncTask.Status.FINISHED) {
MainActivity.csLibrary4A.appendToLog("accessTask.getStatus is not finished");
return null;
}
if (button.getText().toString().indexOf("ING") > 0) {
MainActivity.csLibrary4A.appendToLog("button is still ing");
return null;
}
return accessResult;
}

Expand Down
13 changes: 7 additions & 6 deletions app/src/main/java/com/csl/cs108ademoapp/CustomIME.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public View onCreateInputView() {
super.onCreateInputView();;
mHandler.post(serviceRunnable);
KeyboardView keyboardView = null;
if (false) {
if (true) {
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
Keyboard keyboard = new Keyboard(this, R.xml.number_pad);
Keyboard keyboard = new Keyboard(this, R.xml.number_pad1);
keyboardView.setKeyboard(keyboard);
//keyboardView.setOnKeyboardActionListener(this);
}
Expand All @@ -51,8 +51,9 @@ public void onDestroy() {
@Override
public void run() {
String strCurrentIME = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
appendToLog("CustomIME Debug 0 with " + strCurrentIME);
if (strCurrentIME.contains("com.csl.cs108ademoapp") == false) return;
String strCompare = getPackageName();
appendToLog("CustomIME Debug 0 with strCurrentIME = " + strCurrentIME + ", strCompare = " + strCompare);
if (strCurrentIME.contains(strCompare) == false) return;

mHandler.postDelayed(serviceRunnable, 1000);
if (MainActivity.sharedObjects == null) return;
Expand Down Expand Up @@ -86,8 +87,8 @@ public void run() {
if (matched == false && strEpc != null) {
epcArrayList.add(strEpc);
InputConnection ic = getCurrentInputConnection();
strEpc = (MainActivity.wedgePrefix != null ? MainActivity.wedgePrefix : "") + strEpc
+ (MainActivity.wedgeSuffix != null ? MainActivity.wedgeSuffix : "");
if (MainActivity.wedgePrefix != null) strEpc = MainActivity.wedgePrefix + strEpc;
if (MainActivity.wedgeSuffix != null) strEpc += MainActivity.wedgeSuffix;
switch (MainActivity.wedgeDelimiter) {
default:
strEpc += "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public void popupStart(String message, boolean wait) {
popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
TextView textViewDismiss = (TextView)popupView.findViewById(R.id.dismissMessage);
int iLenghtMax = 300;
if (message.length() > iLenghtMax) message = message.substring(0, iLenghtMax) + " .....";
//int iLenghtMax = 300;
//if (message.length() > iLenghtMax) message = message.substring(0, iLenghtMax) + " .....";
csLibrary4A.appendToLog("SaveList2ExternalTask: popupStart message = " + message);
textViewDismiss.setText(message);
Button btnDismiss = (Button)popupView.findViewById(R.id.dismiss);
Expand Down
73 changes: 38 additions & 35 deletions app/src/main/java/com/csl/cs108ademoapp/DrawerListContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ public enum DrawerPositions {
SETTING, FILTER, READWRITE, SECURITY,

IMPINVENTORY, IMP775, IMPAUTOTUNE,
ALIEN,
UCODE8, UCODEDNA,
BAPCARD, COLDCHAIN, AURASENSE,
KILOWAY,
LONGJING,
AXZON, RFMICRON,
FDMICRO,
CTESIUS,
ASYGNTAG, LEDTAG,
ASYGNTAG,

REGISTER, READWRITEUSER, WEDGE, DIRECTWEDGE, SIMINVENTORY,
BLANK;
Expand All @@ -46,22 +49,24 @@ public static DrawerPositions toDrawerPosition(int x) {
case 9: return SECURITY;

case 10: return IMPINVENTORY;
case 11: return UCODE8;
case 12: return UCODEDNA;
case 13: return BAPCARD;
case 14: return COLDCHAIN;
case 15: return AURASENSE;
case 16: return AXZON;
case 11: return ALIEN;
case 12: return UCODE8;
case 13: return UCODEDNA;
case 14: return BAPCARD;
case 15: return COLDCHAIN;
case 16: return AURASENSE;
case 17: return KILOWAY;
case 18: return LONGJING;
case 19: return AXZON;
//case 15: return RFMICRON;
case 17: return FDMICRO;
case 18: return CTESIUS;
case 19: return ASYGNTAG;
case 20: return LEDTAG;

case 21: return REGISTER;
case 22: return READWRITEUSER;
case 23: return WEDGE;
case 24: return DIRECTWEDGE;
case 20: return FDMICRO;
case 21: return CTESIUS;
case 22: return ASYGNTAG;

case 23: return REGISTER;
case 24: return READWRITEUSER;
case 25: return WEDGE;
case 26: return DIRECTWEDGE;
}
return null;
}
Expand All @@ -80,25 +85,23 @@ public static DrawerPositions toDrawerPosition(int x) {
addItem(new DrawerItem("8", "Read/Write", R.drawable.dl_access));
addItem(new DrawerItem("9", "Security", R.drawable.dl_access));

addItem(new DrawerItem("10", "Impinj", R.drawable.dl_loc));
//addItem(new DrawerItem("10", "Impinj M775", R.drawable.dl_loc));
//addItem(new DrawerItem("11", "Impinj Autotune", R.drawable.dl_loc));
addItem(new DrawerItem("11", "NXP UCODE 8", R.drawable.dl_loc));
addItem(new DrawerItem("12", "NXP UCODE DNA", R.drawable.dl_loc));
addItem(new DrawerItem("13", "uEm CS9010 BAP ID Card", R.drawable.dl_loc));
addItem(new DrawerItem("14", "uEm Cold Chain CS8300", R.drawable.dl_loc));
addItem(new DrawerItem("15", "uEm Aura-sense", R.drawable.dl_loc));
addItem(new DrawerItem("16", "Axzon", R.drawable.dl_loc));
//addItem(new DrawerItem("17", "Axzon Magnus", R.drawable.dl_loc));
addItem(new DrawerItem("17", "FM13DT160", R.drawable.dl_loc));
addItem(new DrawerItem("18", "Johar CTESIUS", R.drawable.dl_loc));
addItem(new DrawerItem("19", "Asygn AS321x", R.drawable.dl_loc));
addItem(new DrawerItem("20", "Led Tag", R.drawable.dl_rr));

addItem(new DrawerItem("21", "Register Tag", R.drawable.dl_rr));
addItem(new DrawerItem("22", "Large sized memory read/write", R.drawable.dl_rr));
addItem(new DrawerItem("23", "Wedge", R.drawable.dl_rr));
addItem(new DrawerItem("24", "Direct Wedge", R.drawable.dl_rr));
addItem(new DrawerItem("10", "Impinj Special Features", R.drawable.dl_loc));
addItem(new DrawerItem("11", "Alien", R.drawable.dl_loc));
addItem(new DrawerItem("12", "NXP UCODE 8", R.drawable.dl_loc));
addItem(new DrawerItem("13", "NXP UCODE DNA", R.drawable.dl_loc));
addItem(new DrawerItem("14", "uEm CS9010 BAP ID Card", R.drawable.dl_loc));
addItem(new DrawerItem("15", "uEm Cold Chain CS8300", R.drawable.dl_loc));
addItem(new DrawerItem("16", "uEm Aura-sense", R.drawable.dl_loc));
addItem(new DrawerItem("17", "Kiloway KX2005X-BL", R.drawable.dl_rr));
addItem(new DrawerItem("18", "Axzon", R.drawable.dl_loc));
addItem(new DrawerItem("19", "FM13DT160", R.drawable.dl_loc));
addItem(new DrawerItem("20", "Landa CTESIUS", R.drawable.dl_loc));
addItem(new DrawerItem("21", "Asygn AS321x", R.drawable.dl_loc));

addItem(new DrawerItem("22", "Register Tag", R.drawable.dl_rr));
addItem(new DrawerItem("23", "Large sized memory read/write", R.drawable.dl_rr));
addItem(new DrawerItem("24", "Wedge", R.drawable.dl_rr));
addItem(new DrawerItem("25", "Direct Wedge", R.drawable.dl_rr));
}

private static void addItem(DrawerItem item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import android.widget.Toast;

import com.csl.cs108ademoapp.adapters.ReaderListAdapter;
import com.csl.cs108library4a.ReaderDevice;
import com.csl.cslibrary4a.ReaderDevice;

import java.util.ArrayList;

Expand Down
Loading