6
6
import android .widget .TextView ;
7
7
import android .widget .Toast ;
8
8
9
- import com .csl .cs108library4a . Cs108Library4A ;
9
+ import com .csl .cslibrary4a . RfidReaderChipData ;
10
10
11
11
import java .util .ArrayList ;
12
12
@@ -18,6 +18,7 @@ public enum TaskCancelRReason {
18
18
}
19
19
public TaskCancelRReason taskCancelReason ;
20
20
public String accessResult ;
21
+ public String accessTagEpc ;
21
22
Handler mHandler = new Handler ();
22
23
Runnable updateRunnable = null ;
23
24
@@ -27,7 +28,7 @@ public enum TaskCancelRReason {
27
28
boolean invalidRequest ;
28
29
String selectMask ; int selectBank , selectOffset ;
29
30
String strPassword ; int powerLevel ;
30
- Cs108Library4A .HostCommands hostCommand ;
31
+ RfidReaderChipData .HostCommands hostCommand ;
31
32
32
33
CustomMediaPlayer playerO , playerN ;
33
34
@@ -46,10 +47,11 @@ public enum TaskCancelRReason {
46
47
47
48
boolean gotInventory ;
48
49
int batteryCountInventory_old ;
50
+ boolean bSkipClearFilter = false ;
49
51
50
52
public AccessTask (Button button , boolean invalidRequest ,
51
53
String selectMask , int selectBank , int selectOffset ,
52
- String strPassword , int powerLevel , Cs108Library4A .HostCommands hostCommand ,
54
+ String strPassword , int powerLevel , RfidReaderChipData .HostCommands hostCommand ,
53
55
boolean bEnableErrorPopWindow , Runnable updateRunnable ) {
54
56
this .button = button ;
55
57
this .registerTagGot = registerTagGot ;
@@ -72,10 +74,9 @@ public AccessTask(Button button, boolean invalidRequest,
72
74
}
73
75
public AccessTask (Button button , TextView textViewWriteCount , boolean invalidRequest ,
74
76
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 ) {
79
80
this .button = button ;
80
81
this .registerTotal = textViewWriteCount ;
81
82
this .registerRunTime = registerRunTime ;
@@ -94,6 +95,7 @@ public AccessTask(Button button, TextView textViewWriteCount, boolean invalidReq
94
95
this .qValue = qValue ;
95
96
if (repeat > 255 ) repeat = 255 ;
96
97
this .repeat = repeat ;
98
+ this .bSkipClearFilter = bSkipClearFilter ;
97
99
if (resetCount ) {
98
100
total = 0 ;
99
101
tagList .clear ();
@@ -105,7 +107,7 @@ public void setRunnable(Runnable updateRunnable) {
105
107
}
106
108
107
109
void preExecute () {
108
- accessResult = null ;
110
+ accessResult = null ; MainActivity . csLibrary4A . appendToLog ( "accessResult is set null" );
109
111
playerO = MainActivity .sharedObjects .playerO ;
110
112
playerN = MainActivity .sharedObjects .playerN ;
111
113
//playerN.start();
@@ -135,7 +137,7 @@ void preExecute() {
135
137
136
138
if (invalidRequest == false ) {
137
139
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 ) {
139
141
if (MainActivity .csLibrary4A .setRx000KillPassword (strPassword ) == false ) {
140
142
invalidRequest = true ; MainActivity .csLibrary4A .appendToLog ("setRx000KillPassword is failed" );
141
143
}
@@ -149,14 +151,21 @@ else if (hostCommand == Cs108Library4A.HostCommands.CMD_18K6CKILL) {
149
151
invalidRequest = true ; MainActivity .csLibrary4A .appendToLog ("setAccessRetry is failed" );
150
152
}
151
153
}
154
+ MainActivity .csLibrary4A .appendToLog ("setSelectCriteria: invalidRequest = " + invalidRequest + ", repeat = " + repeat + ", bSkipClearFilter = " + bSkipClearFilter + ", powerLevel = " + powerLevel + ", skipSelect = " + skipSelect );
152
155
if (invalidRequest == false ) {
153
156
if (DEBUG ) MainActivity .csLibrary4A .appendToLog ("AccessTask(): powerLevel = " + powerLevel );
154
157
int matchRep = 1 ;
155
158
if (repeat > 1 ) matchRep = repeat ;
159
+ if (bSkipClearFilter == false ) {
160
+ MainActivity .csLibrary4A .appendToLog ("Going to setSelectCriteria disable" );
161
+ MainActivity .csLibrary4A .setSelectCriteriaDisable (-1 );
162
+ }
156
163
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
+ }
160
169
}
161
170
}
162
171
gotInventory = false ;
@@ -173,10 +182,13 @@ else if (MainActivity.csLibrary4A.setSelectedTag(selectMask, selectBank, selectO
173
182
}
174
183
}
175
184
185
+ boolean accessCompleteReceived = false ;
186
+
176
187
@ Override
177
188
protected String doInBackground (Void ... a ) {
178
189
boolean ending = false ;
179
190
int iTimeOut = 5000 ;
191
+ accessCompleteReceived = false ;
180
192
181
193
while (MainActivity .csLibrary4A .isBleConnected () && isCancelled () == false && ending == false ) {
182
194
int batteryCount = MainActivity .csLibrary4A .getBatteryCount ();
@@ -189,12 +201,13 @@ protected String doInBackground(Void... a) {
189
201
publishProgress ("WW" );
190
202
}
191
203
byte [] notificationData = MainActivity .csLibrary4A .onNotificationEvent ();
192
- Cs108Library4A .Rx000pkgData rx000pkgData = MainActivity .csLibrary4A .onRFIDEvent ();
204
+ RfidReaderChipData .Rx000pkgData rx000pkgData = MainActivity .csLibrary4A .onRFIDEvent ();
193
205
if (MainActivity .csLibrary4A .mrfidToWriteSize () != 0 ) timeMillis = System .currentTimeMillis ();
194
206
else if (rx000pkgData != null ) {
195
207
if (rx000pkgData .responseType == null ) {
196
208
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 ;
198
211
MainActivity .csLibrary4A .appendToLog ("rx000pkgData.dataValues = " + MainActivity .csLibrary4A .byteArrayToString (rx000pkgData .dataValues ));
199
212
if (rx000pkgData .decodedError == null ) {
200
213
if (done == false ) {
@@ -207,7 +220,8 @@ else if (rx000pkgData != null) {
207
220
done = true ;
208
221
} else publishProgress (rx000pkgData .decodedError );
209
222
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 = "" ;
211
225
MainActivity .csLibrary4A .appendToLog ("BtData: repeat = " + repeat + ", decodedError = " + rx000pkgData .decodedError + ", resultError = " + resultError );
212
226
if (rx000pkgData .decodedError != null ) { endingMessaage = rx000pkgData .decodedError ; ending = true ; }
213
227
else if (repeat > 0 && resultError .length () == 0 ) {
@@ -218,7 +232,8 @@ else if (repeat > 0 && resultError.length() == 0) {
218
232
endingMessaage = "" ;
219
233
ending = true ;
220
234
}
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 );
222
237
done = false ;
223
238
publishProgress ("TT" , MainActivity .csLibrary4A .byteArrayToString (rx000pkgData .decodedEpc ));
224
239
} else {
0 commit comments