Skip to content

Commit 7e1c02e

Browse files
authored
Merge pull request #48 from cslrfid/develop
Develop
2 parents 782f766 + 5b881ba commit 7e1c02e

File tree

221 files changed

+32468
-13892
lines changed

Some content is hidden

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

221 files changed

+32468
-13892
lines changed

app/build.gradle

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 33
4+
namespace 'com.csl.cs108ademoapp'
5+
buildFeatures {
6+
buildConfig true
7+
}
8+
9+
compileSdk 34
510
defaultConfig {
611
applicationId "com.csl.cs108ademoapp"
7-
minSdkVersion 19
8-
targetSdkVersion 33
9-
versionCode 38
10-
versionName "2.8.22"
12+
minSdk 21
13+
targetSdk 34
14+
versionCode 41
15+
versionName "2.14.0"
1116
}
1217
}
1318

1419
dependencies {
1520
implementation fileTree(include: ['*.jar'], dir: 'libs')
21+
implementation 'com.google.android.material:material:1.11.0'
1622
implementation project(':cs108library4a')
17-
implementation 'com.google.android.material:material:1.9.0'
23+
implementation project(':cslibrary4a')
1824
}
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-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 38,
15-
"versionName": "2.8.22",
14+
"versionCode": 39,
15+
"versionName": "2.10.5",
1616
"outputFile": "app-release.apk"
1717
}
1818
],

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.csl.cs108ademoapp">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
65
<uses-permission android:name="android.permission.INTERNET" />
@@ -18,7 +17,7 @@
1817
android:requestLegacyExternalStorage="true"
1918
android:theme="@style/AppTheme">
2019

21-
<service android:name=".CustomIME"
20+
<service android:name="CustomIME"
2221
android:label="@string/app_ime"
2322
android:exported="true"
2423
android:permission="android.permission.BIND_INPUT_METHOD">
@@ -29,7 +28,7 @@
2928
</service>
3029

3130
<activity
32-
android:name=".MainActivity"
31+
android:name="MainActivity"
3332
android:exported="true"
3433
android:screenOrientation="portrait">
3534
<intent-filter>

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

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import android.widget.TextView;
77
import android.widget.Toast;
88

9-
import com.csl.cs108library4a.Cs108Library4A;
9+
import com.csl.cslibrary4a.RfidReaderChipData;
1010

1111
import java.util.ArrayList;
1212

@@ -18,6 +18,7 @@ public enum TaskCancelRReason {
1818
}
1919
public TaskCancelRReason taskCancelReason;
2020
public String accessResult;
21+
public String accessTagEpc;
2122
Handler mHandler = new Handler();
2223
Runnable updateRunnable = null;
2324

@@ -27,7 +28,7 @@ public enum TaskCancelRReason {
2728
boolean invalidRequest;
2829
String selectMask; int selectBank, selectOffset;
2930
String strPassword; int powerLevel;
30-
Cs108Library4A.HostCommands hostCommand;
31+
RfidReaderChipData.HostCommands hostCommand;
3132

3233
CustomMediaPlayer playerO, playerN;
3334

@@ -46,10 +47,11 @@ public enum TaskCancelRReason {
4647

4748
boolean gotInventory;
4849
int batteryCountInventory_old;
50+
boolean bSkipClearFilter = false;
4951

5052
public AccessTask(Button button, boolean invalidRequest,
5153
String selectMask, int selectBank, int selectOffset,
52-
String strPassword, int powerLevel, Cs108Library4A.HostCommands hostCommand,
54+
String strPassword, int powerLevel, RfidReaderChipData.HostCommands hostCommand,
5355
boolean bEnableErrorPopWindow, Runnable updateRunnable) {
5456
this.button = button;
5557
this.registerTagGot = registerTagGot;
@@ -72,10 +74,9 @@ public AccessTask(Button button, boolean invalidRequest,
7274
}
7375
public AccessTask(Button button, TextView textViewWriteCount, boolean invalidRequest,
7476
String selectMask, int selectBank, int selectOffset,
75-
String strPassword, int powerLevel, Cs108Library4A.HostCommands hostCommand,
76-
int qValue, int repeat, boolean resetCount,
77-
TextView registerRunTime, TextView registerTagGot, TextView registerVoltageLevel,
78-
TextView registerYieldView, TextView registerTotalView) {
77+
String strPassword, int powerLevel, RfidReaderChipData.HostCommands hostCommand,
78+
int qValue, int repeat, boolean resetCount, boolean bSkipClearFilter,
79+
TextView registerRunTime, TextView registerTagGot, TextView registerVoltageLevel, TextView registerYieldView, TextView registerTotalView) {
7980
this.button = button;
8081
this.registerTotal = textViewWriteCount;
8182
this.registerRunTime = registerRunTime;
@@ -94,6 +95,7 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
9495
this.qValue = qValue;
9596
if (repeat > 255) repeat = 255;
9697
this.repeat = repeat;
98+
this.bSkipClearFilter = bSkipClearFilter;
9799
if (resetCount) {
98100
total = 0;
99101
tagList.clear();
@@ -105,7 +107,7 @@ public void setRunnable(Runnable updateRunnable) {
105107
}
106108

107109
void preExecute() {
108-
accessResult = null;
110+
accessResult = null; MainActivity.csLibrary4A.appendToLog("accessResult is set null");
109111
playerO = MainActivity.sharedObjects.playerO;
110112
playerN = MainActivity.sharedObjects.playerN;
111113
//playerN.start();
@@ -135,7 +137,7 @@ void preExecute() {
135137

136138
if (invalidRequest == false) {
137139
if (strPassword.length() != 8) { invalidRequest = true; MainActivity.csLibrary4A.appendToLog("strPassword.length = " + strPassword.length() + " (not 8)."); }
138-
else if (hostCommand == Cs108Library4A.HostCommands.CMD_18K6CKILL) {
140+
else if (hostCommand == RfidReaderChipData.HostCommands.CMD_18K6CKILL) {
139141
if (MainActivity.csLibrary4A.setRx000KillPassword(strPassword) == false) {
140142
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setRx000KillPassword is failed");
141143
}
@@ -149,14 +151,21 @@ else if (hostCommand == Cs108Library4A.HostCommands.CMD_18K6CKILL) {
149151
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setAccessRetry is failed");
150152
}
151153
}
154+
MainActivity.csLibrary4A.appendToLog("setSelectCriteria: invalidRequest = " + invalidRequest + ", repeat = " + repeat + ", bSkipClearFilter = " + bSkipClearFilter + ", powerLevel = " + powerLevel + ", skipSelect = " + skipSelect);
152155
if (invalidRequest == false) {
153156
if (DEBUG) MainActivity.csLibrary4A.appendToLog("AccessTask(): powerLevel = " + powerLevel);
154157
int matchRep = 1;
155158
if (repeat > 1) matchRep = repeat;
159+
if (bSkipClearFilter == false) {
160+
MainActivity.csLibrary4A.appendToLog("Going to setSelectCriteria disable");
161+
MainActivity.csLibrary4A.setSelectCriteriaDisable(-1);
162+
}
156163
if (powerLevel < 0 || powerLevel > 330) invalidRequest = true;
157-
else if (skipSelect) { }
158-
else if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
159-
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setSelectedTag is failed with selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
164+
else if (skipSelect == false) {
165+
MainActivity.csLibrary4A.appendToLog("setSelectCriteria: Going to setSelectTag");
166+
if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectOffset, powerLevel, qValue, matchRep) == false) {
167+
invalidRequest = true; MainActivity.csLibrary4A.appendToLog("setSelectedTag is failed with selectMask = " + selectMask + ", selectBank = " + selectBank + ", selectOffset = " + selectOffset + ", powerLevel = " + powerLevel);
168+
}
160169
}
161170
}
162171
gotInventory = false;
@@ -173,10 +182,13 @@ else if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectO
173182
}
174183
}
175184

185+
boolean accessCompleteReceived = false;
186+
176187
@Override
177188
protected String doInBackground(Void... a) {
178189
boolean ending = false;
179190
int iTimeOut = 5000;
191+
accessCompleteReceived = false;
180192

181193
while (MainActivity.csLibrary4A.isBleConnected() && isCancelled() == false && ending == false) {
182194
int batteryCount = MainActivity.csLibrary4A.getBatteryCount();
@@ -189,12 +201,13 @@ protected String doInBackground(Void... a) {
189201
publishProgress("WW");
190202
}
191203
byte[] notificationData = MainActivity.csLibrary4A.onNotificationEvent();
192-
Cs108Library4A.Rx000pkgData rx000pkgData = MainActivity.csLibrary4A.onRFIDEvent();
204+
RfidReaderChipData.Rx000pkgData rx000pkgData = MainActivity.csLibrary4A.onRFIDEvent();
193205
if (MainActivity.csLibrary4A.mrfidToWriteSize() != 0) timeMillis = System.currentTimeMillis();
194206
else if (rx000pkgData != null) {
195207
if (rx000pkgData.responseType == null) {
196208
publishProgress("null response");
197-
} else if (rx000pkgData.responseType == Cs108Library4A.HostCmdResponseTypes.TYPE_18K6C_TAG_ACCESS) {
209+
} else if (rx000pkgData.responseType == RfidReaderChipData.HostCmdResponseTypes.TYPE_18K6C_TAG_ACCESS) {
210+
accessCompleteReceived = true;
198211
MainActivity.csLibrary4A.appendToLog("rx000pkgData.dataValues = " + MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.dataValues));
199212
if (rx000pkgData.decodedError == null) {
200213
if (done == false) {
@@ -207,7 +220,8 @@ else if (rx000pkgData != null) {
207220
done = true;
208221
} else publishProgress(rx000pkgData.decodedError);
209222
iTimeOut = 1000;
210-
} else if (rx000pkgData.responseType == Cs108Library4A.HostCmdResponseTypes.TYPE_COMMAND_END) {
223+
} else if (rx000pkgData.responseType == RfidReaderChipData.HostCmdResponseTypes.TYPE_COMMAND_END) {
224+
if (hostCommand == RfidReaderChipData.HostCommands.CMD_18K6CKILL && accessCompleteReceived == false) accessResult = "";
211225
MainActivity.csLibrary4A.appendToLog("BtData: repeat = " + repeat + ", decodedError = " + rx000pkgData.decodedError + ", resultError = " + resultError);
212226
if (rx000pkgData.decodedError != null) { endingMessaage = rx000pkgData.decodedError; ending = true; }
213227
else if (repeat > 0 && resultError.length() == 0) {
@@ -218,7 +232,8 @@ else if (repeat > 0 && resultError.length() == 0) {
218232
endingMessaage = "";
219233
ending = true;
220234
}
221-
} else if (rx000pkgData.responseType == Cs108Library4A.HostCmdResponseTypes.TYPE_18K6C_INVENTORY) {
235+
} else if (rx000pkgData.responseType == RfidReaderChipData.HostCmdResponseTypes.TYPE_18K6C_INVENTORY) {
236+
accessTagEpc = MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedEpc);
222237
done = false;
223238
publishProgress("TT", MainActivity.csLibrary4A.byteArrayToString(rx000pkgData.decodedEpc));
224239
} else {

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import android.widget.Button;
55
import android.widget.Toast;
66

7-
import com.csl.cs108library4a.Cs108Library4A;
7+
import com.csl.cslibrary4a.RfidReaderChipData;
88

99
public class AccessTask1 {
1010
Button button;
@@ -14,24 +14,24 @@ public class AccessTask1 {
1414
int selectBank, selectOffset;
1515
String strPassword;
1616
int powerLevel;
17-
Cs108Library4A.HostCommands hostCommand;
17+
RfidReaderChipData.HostCommands hostCommand;
1818
Runnable updateRunnable = null;
1919

2020
AccessTask accessTask;
2121
public AccessTask1(Button button, boolean invalidRequest,
2222
int accBank, int accOffset, int accSize, int accBlockCount, String accWriteData,
2323
String selectMask, int selectBank, int selectOffset,
24-
String strPassword, int powerLevel, Cs108Library4A.HostCommands hostCommand, Runnable updateRunnable) {
24+
String strPassword, int powerLevel, RfidReaderChipData.HostCommands hostCommand, Runnable updateRunnable) {
2525
this.button = button;
2626
this.invalidRequest = invalidRequest;
2727
MainActivity.csLibrary4A.appendToLog("HelloK: invalidRequest=" + invalidRequest);
2828
this.accBank = accBank;
2929
this.accOffset = accOffset;
30-
if (hostCommand == Cs108Library4A.HostCommands.CMD_18K6CWRITE) { if (accBlockCount > 16) accBlockCount = 16; }
30+
if (hostCommand == RfidReaderChipData.HostCommands.CMD_18K6CWRITE) { if (accBlockCount > 16) accBlockCount = 16; }
3131
else if (accBlockCount > 255) accBlockCount = 255;
3232
this.accBlockCount = accBlockCount;
3333
if (accWriteData == null) accWriteData = "";
34-
if (hostCommand == Cs108Library4A.HostCommands.CMD_18K6CWRITE) {
34+
if (hostCommand == RfidReaderChipData.HostCommands.CMD_18K6CWRITE) {
3535
MainActivity.csLibrary4A.appendToLog("strOut: accWriteData=" + accWriteData);
3636
accWriteData = deformatWriteAccessData(accWriteData);
3737
if (accWriteData.length() < accSize * 4) {
@@ -96,7 +96,7 @@ else if (accessTask.getStatus() != AsyncTask.Status.FINISHED) { }
9696
else if (button.getText().toString().indexOf("ING") > 0) { }
9797
else if (isResultReady == false) {
9898
String strAccessResult = "";
99-
if (hostCommand != Cs108Library4A.HostCommands.CMD_18K6CREAD || accBank != 3) strAccessResult = accessTask.accessResult;
99+
if (hostCommand != RfidReaderChipData.HostCommands.CMD_18K6CREAD || accBank != 3) strAccessResult = accessTask.accessResult;
100100
else {
101101
int word4line = 7;
102102
for (int i = 0; i < accSizeNow; i=i+word4line) {
@@ -144,10 +144,19 @@ else if (isResultReady == false) {
144144
}
145145
public String accessResult;
146146
public String getResult() {
147-
MainActivity.csLibrary4A.appendToLog("HelloA: accessResult=" + accessResult);
148-
if (accessTask == null) return null;
149-
if (accessTask.getStatus() != AsyncTask.Status.FINISHED) return null;
150-
if (button.getText().toString().indexOf("ING") > 0) return null;
147+
MainActivity.csLibrary4A.appendToLog("HelloA: accessResult = " + accessResult);
148+
if (accessTask == null) {
149+
MainActivity.csLibrary4A.appendToLog("accessTask is null");
150+
return null;
151+
}
152+
if (accessTask.getStatus() != AsyncTask.Status.FINISHED) {
153+
MainActivity.csLibrary4A.appendToLog("accessTask.getStatus is not finished");
154+
return null;
155+
}
156+
if (button.getText().toString().indexOf("ING") > 0) {
157+
MainActivity.csLibrary4A.appendToLog("button is still ing");
158+
return null;
159+
}
151160
return accessResult;
152161
}
153162

@@ -178,7 +187,7 @@ void setup() {
178187
}
179188
}
180189
}
181-
if (invalidRequest == false && hostCommand == Cs108Library4A.HostCommands.CMD_18K6CWRITE) {
190+
if (invalidRequest == false && hostCommand == RfidReaderChipData.HostCommands.CMD_18K6CWRITE) {
182191
if (accWriteData.length() > accSizeNow * 4) accWriteDataNow = accWriteData.substring(0, accSizeNow*4);
183192
else accWriteDataNow = accWriteData;
184193
if (MainActivity.csLibrary4A.setAccessWriteData(accWriteDataNow) == false) {

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import android.view.View;
1111
import android.view.inputmethod.InputConnection;
1212

13-
import com.csl.cs108library4a.Cs108Library4A;
13+
import com.csl.cslibrary4a.RfidReaderChipData;
1414

1515
import java.util.ArrayList;
1616

@@ -29,9 +29,9 @@ public View onCreateInputView() {
2929
super.onCreateInputView();;
3030
mHandler.post(serviceRunnable);
3131
KeyboardView keyboardView = null;
32-
if (false) {
32+
if (true) {
3333
keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
34-
Keyboard keyboard = new Keyboard(this, R.xml.number_pad);
34+
Keyboard keyboard = new Keyboard(this, R.xml.number_pad1);
3535
keyboardView.setKeyboard(keyboard);
3636
//keyboardView.setOnKeyboardActionListener(this);
3737
}
@@ -51,8 +51,9 @@ public void onDestroy() {
5151
@Override
5252
public void run() {
5353
String strCurrentIME = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
54-
appendToLog("CustomIME Debug 0 with " + strCurrentIME);
55-
if (strCurrentIME.contains("com.csl.cs108ademoapp") == false) return;
54+
String strCompare = getPackageName();
55+
appendToLog("CustomIME Debug 0 with strCurrentIME = " + strCurrentIME + ", strCompare = " + strCompare);
56+
if (strCurrentIME.contains(strCompare) == false) return;
5657

5758
mHandler.postDelayed(serviceRunnable, 1000);
5859
if (MainActivity.sharedObjects == null) return;
@@ -86,8 +87,8 @@ public void run() {
8687
if (matched == false && strEpc != null) {
8788
epcArrayList.add(strEpc);
8889
InputConnection ic = getCurrentInputConnection();
89-
strEpc = (MainActivity.wedgePrefix != null ? MainActivity.wedgePrefix : "") + strEpc
90-
+ (MainActivity.wedgeSuffix != null ? MainActivity.wedgeSuffix : "");
90+
if (MainActivity.wedgePrefix != null) strEpc = MainActivity.wedgePrefix + strEpc;
91+
if (MainActivity.wedgeSuffix != null) strEpc += MainActivity.wedgeSuffix;
9192
switch (MainActivity.wedgeDelimiter) {
9293
default:
9394
strEpc += "\n";
@@ -124,7 +125,7 @@ void startStopHandler() {
124125
if ((started && MainActivity.csLibrary4A.getTriggerButtonStatus()) || (started == false && MainActivity.csLibrary4A.getTriggerButtonStatus() == false)) return;
125126
if (started == false) {
126127
appendToLog("CustomIME Debug 11");
127-
MainActivity.csLibrary4A.startOperation(Cs108Library4A.OperationTypes.TAG_INVENTORY);
128+
MainActivity.csLibrary4A.startOperation(RfidReaderChipData.OperationTypes.TAG_INVENTORY);
128129
inventoryRfidTask = new InventoryRfidTask();
129130
inventoryRfidTask.execute();
130131
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public void popupStart(String message, boolean wait) {
2525
popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
2626
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
2727
TextView textViewDismiss = (TextView)popupView.findViewById(R.id.dismissMessage);
28-
int iLenghtMax = 300;
29-
if (message.length() > iLenghtMax) message = message.substring(0, iLenghtMax) + " .....";
28+
//int iLenghtMax = 300;
29+
//if (message.length() > iLenghtMax) message = message.substring(0, iLenghtMax) + " .....";
3030
csLibrary4A.appendToLog("SaveList2ExternalTask: popupStart message = " + message);
3131
textViewDismiss.setText(message);
3232
Button btnDismiss = (Button)popupView.findViewById(R.id.dismiss);

0 commit comments

Comments
 (0)