diff --git a/app/build.gradle b/app/build.gradle
index eb82f06..0172683 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -15,11 +15,11 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- ndk {
- // 设置支持的SO库架构
- //noinspection ChromeOsAbiSupport
- abiFilters 'arm64-v8a','armeabi' , 'armeabi-v7a'
- }
+// ndk {
+// // 设置支持的SO库架构
+// //noinspection ChromeOsAbiSupport
+// abiFilters 'arm64-v8a','armeabi' , 'armeabi-v7a'
+// }
}
buildTypes {
@@ -43,21 +43,14 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
-// implementation files('libs\\c5106\\App_Demo_API.jar')
-// implementation files('libs\\c5106\\DeviceAPIver20150204.jar')
-// implementation files('libs\\c5106\\logutil-1.5.1.1.jar')
implementation files('libs\\c5106\\ModuleAPI_1.jar')
implementation files('libs\\c5106\\uhfr_v1.8.jar')
-// implementation files('libs\\c5106\\reader(1).jar')
-// implementation files('libs\\c5106\\UHF67_v3.6.jar')
-
-// implementation files('libs\\ModuleAPI_J.jar')
+ implementation files('libs\\auto9u\\uhf.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.google.code.gson:gson:2.10.1'
- // https://mvnrepository.com/artifact/com.lzy.net/okgo
implementation 'com.lzy.net:okgo:3.0.4'
implementation 'org.litepal.guolindev:core:3.2.3'
diff --git a/app/libs/auto9u/uhf.jar b/app/libs/auto9u/uhf.jar
new file mode 100644
index 0000000..c00836d
Binary files /dev/null and b/app/libs/auto9u/uhf.jar differ
diff --git a/app/libs/c5106/App_Demo_API.jar b/app/libs/c5106/App_Demo_API.jar
deleted file mode 100644
index 86e2275..0000000
Binary files a/app/libs/c5106/App_Demo_API.jar and /dev/null differ
diff --git a/app/libs/c5106/DeviceAPIver20150204.jar b/app/libs/c5106/DeviceAPIver20150204.jar
deleted file mode 100644
index defdeb1..0000000
Binary files a/app/libs/c5106/DeviceAPIver20150204.jar and /dev/null differ
diff --git a/app/libs/c5106/UHF67_v3.6.jar b/app/libs/c5106/UHF67_v3.6.jar
deleted file mode 100644
index d88dc29..0000000
Binary files a/app/libs/c5106/UHF67_v3.6.jar and /dev/null differ
diff --git a/app/libs/c5106/logutil-1.5.1.1.jar b/app/libs/c5106/logutil-1.5.1.1.jar
deleted file mode 100644
index 59b3c16..0000000
Binary files a/app/libs/c5106/logutil-1.5.1.1.jar and /dev/null differ
diff --git a/app/libs/c5106/reader(1).jar b/app/libs/c5106/reader(1).jar
deleted file mode 100644
index 8179d15..0000000
Binary files a/app/libs/c5106/reader(1).jar and /dev/null differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0668cd2..9439152 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,17 +15,18 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/logo"
android:supportsRtl="true"
- android:usesCleartextTraffic="true"
android:theme="@style/Theme.JinYuRFID"
+ android:usesCleartextTraffic="true"
tools:targetApi="31">
+
+
+
-
-
-
-
-
+
+ android:exported="true">
+
+
+
+
+
diff --git a/app/src/main/java/com/example/jinyu_rfid/AutoIDReadActivity.java b/app/src/main/java/com/example/jinyu_rfid/AutoIDReadActivity.java
new file mode 100644
index 0000000..bc19b13
--- /dev/null
+++ b/app/src/main/java/com/example/jinyu_rfid/AutoIDReadActivity.java
@@ -0,0 +1,89 @@
+package com.example.jinyu_rfid;
+
+import android.annotation.SuppressLint;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.example.jinyu_rfid.adapter.ResultAdapter;
+import com.example.jinyu_rfid.base.BaseActivity;
+import com.example.jinyu_rfid.been.ReadTyreNoResult;
+import com.example.jinyu_rfid.callback.DataReturnCall;
+import com.example.jinyu_rfid.databinding.ActivityAutoidReadBinding;
+import com.example.jinyu_rfid.databinding.ActivityAutoidReadBindingImpl;
+import com.example.jinyu_rfid.databinding.ActivityReadBinding;
+import com.example.jinyu_rfid.rfid.AutoID9UDevice;
+import com.example.jinyu_rfid.rfid.RFIDModel;
+import com.example.jinyu_rfid.uitls.ASCIIUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AutoIDReadActivity extends BaseActivity implements DataReturnCall {
+ private ResultAdapter adapter;
+ private RFIDModel rfidModel;
+ private String[] stringArray;
+ private List list;
+ private ActivityAutoidReadBinding binding;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_autoid_read);
+ binding.setTitle(getString(R.string.go_read));
+ adapter = new ResultAdapter(this);
+ list = new ArrayList<>(11);
+ adapter.setList(list);
+ binding.setAdapter(adapter);
+ // 名称
+ stringArray = getResources().getStringArray(R.array.project_list);
+ // rfidModel = new C5106Device(this,this);
+ rfidModel = new AutoID9UDevice(this, this);
+
+ }
+
+
+ // 读取user区
+ public void readInfo(View view) {
+ rfidModel.sanUser(80);
+ }
+
+ public void readEPCInfo(View view) {
+ rfidModel.sanEpc(6);
+ }
+
+
+ @Override
+ public void readEpcCodeInfo(String info, boolean state, String stateInfo) {
+ if (state) {
+ binding.readTextEpc.setText(info);
+ music.start();
+ return;
+ }
+ binding.readTextEpc.setText(null);
+ }
+
+ @SuppressLint("NotifyDataSetChanged")
+ @Override
+ public void readUserInfo(String user, boolean state, String stateInfo) {
+ list.clear();
+ if (state) {
+ binding.readText.setText(user);
+ music.start();
+ String info = ASCIIUtil.hex2Str(user);
+ Log.e("TAG", "readUserInfo:" + user);
+ var infos = info.split("~");
+ for (int i = 0; i < 12; i++) {
+ list.add(new ReadTyreNoResult(i, stringArray[i], infos[i]));
+ }
+ } else {
+ binding.readText.setText(null);
+ }
+ adapter.notifyDataSetChanged();
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/jinyu_rfid/ReadActivity.java b/app/src/main/java/com/example/jinyu_rfid/ReadActivity.java
index 1a689ee..a08d480 100644
--- a/app/src/main/java/com/example/jinyu_rfid/ReadActivity.java
+++ b/app/src/main/java/com/example/jinyu_rfid/ReadActivity.java
@@ -24,6 +24,7 @@ import com.example.jinyu_rfid.base.MyResult;
import com.example.jinyu_rfid.been.ReadTyreNoResult;
import com.example.jinyu_rfid.callback.DataReturnCall;
import com.example.jinyu_rfid.databinding.ActivityReadBinding;
+import com.example.jinyu_rfid.rfid.AutoID9UDevice;
import com.example.jinyu_rfid.rfid.C5106Device;
import com.example.jinyu_rfid.rfid.RFIDModel;
import com.example.jinyu_rfid.uitls.ASCIIUtil;
@@ -63,7 +64,8 @@ public class ReadActivity extends BaseActivity implements DataReturnCall {
binding.setAdapter(adapter);
// 名称
stringArray = getResources().getStringArray(R.array.project_list);
- rfidModel = new C5106Device(this);
+ rfidModel = new C5106Device(this,this);
+ // rfidModel=new AutoID9UDevice(this,this);
}
diff --git a/app/src/main/java/com/example/jinyu_rfid/ReadBlueToothActivity.java b/app/src/main/java/com/example/jinyu_rfid/ReadBlueToothActivity.java
index 32d433a..ba674f9 100644
--- a/app/src/main/java/com/example/jinyu_rfid/ReadBlueToothActivity.java
+++ b/app/src/main/java/com/example/jinyu_rfid/ReadBlueToothActivity.java
@@ -180,7 +180,7 @@ public class ReadBlueToothActivity extends BaseActivity {
return;
}
user += receivedData.substring(2).trim();
- Log.e("TAG", "handleMessage-:" + "4532383036463132303030303030303234314632323541337E33323433323034303634307E4A494E59557E3338352F36355232322E357E4A593539387E323450527E3338352F36355232322E35203136344B2032345052204A5935393820424C34454A597E4B7E3136347E3535352E307E5F7E5F7E");
+ // Log.e("TAG", "handleMessage-:" + "4532383036463132303030303030303234314632323541337E33323433323034303634307E4A494E59557E3338352F36355232322E357E4A593539387E323450527E3338352F36355232322E35203136344B2032345052204A5935393820424C34454A597E4B7E3136347E3535352E307E5F7E5F7E");
Log.e("TAG", "handleMessage2:" + user);
readUserInfo(user);
user = null;
@@ -225,8 +225,7 @@ public class ReadBlueToothActivity extends BaseActivity {
finish();
}
}
-
- @SuppressLint("NotifyDataSetChanged")
+ @SuppressLint("NotifyDataSetChanged")
public void readEpcCodeInfo(String info) {
music.start();
list.clear();
diff --git a/app/src/main/java/com/example/jinyu_rfid/WriteUserActivity.java b/app/src/main/java/com/example/jinyu_rfid/WriteUserActivity.java
index 5a7d0fa..ac0de94 100644
--- a/app/src/main/java/com/example/jinyu_rfid/WriteUserActivity.java
+++ b/app/src/main/java/com/example/jinyu_rfid/WriteUserActivity.java
@@ -4,7 +4,6 @@ import androidx.databinding.DataBindingUtil;
import android.annotation.SuppressLint;
import android.content.Intent;
-import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
@@ -18,9 +17,9 @@ import com.example.jinyu_rfid.base.MyRecultCall;
import com.example.jinyu_rfid.base.MyResult;
import com.example.jinyu_rfid.been.ConfigurationTable;
import com.example.jinyu_rfid.been.ReadTyreNoResult;
-import com.example.jinyu_rfid.broadcast.ScanERCodeReceiver;
import com.example.jinyu_rfid.callback.DataReturnCall;
import com.example.jinyu_rfid.databinding.ActivityWriteUserBinding;
+import com.example.jinyu_rfid.rfid.AutoID9UDevice;
import com.example.jinyu_rfid.rfid.C5106Device;
import com.example.jinyu_rfid.rfid.RFIDModel;
import com.example.jinyu_rfid.uitls.ASCIIUtil;
@@ -54,14 +53,13 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
binding = DataBindingUtil.setContentView(this, R.layout.activity_write_user);
intent1 = new Intent(this, ReadActivity.class);
intent2 = new Intent(this, ConfigurationTableActivity.class);
- ScanERCodeReceiver scanERCodeReceiver = new ScanERCodeReceiver(this);
- registerReceiver(scanERCodeReceiver, new IntentFilter("com.rfid.SCAN"));
adapter = new ResultAdapter(this);
binding.setAdapter(adapter);
popupMenu = new PopupMenu(this, binding.writeMenu);
popupMenu.setOnMenuItemClickListener(this);
getMenuInflater().inflate(R.menu.activity_menu, popupMenu.getMenu());
- rfidModel = new C5106Device(this);
+ rfidModel = new C5106Device(this,this);
+ // rfidModel=new AutoID9UDevice(this,this);
}
@@ -85,7 +83,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
if (epcStr.isEmpty()) return;
// EPC编码~胎号~品牌~规格~花纹~层级~轮胎名称~速度级别~负荷指数~轮辋直径~扁平比~销售区域
List tagList = LitePal.findAll(ConfigurationTable.class);
- StringBuilder tagUserStr = new StringBuilder(tagList.get(0).isState() ? epcStr : "_");
+ StringBuilder tagUserStr = new StringBuilder(tagList.get(0).isState() ? epcStr:"_");
tagUserStr.append("~");
for (int i = 1; i < 12; i++) {
var configuration = tagList.get(i);
@@ -123,11 +121,12 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
writeUserState = true;
return;
}
+
tipDialog.shouDialog(false, body.getSaveMessage());
}
});
- }
+ } //writeUserState = true;
if (writeUserState){
Log.e("TAG", "写入");
var writeState = rfidModel.writeUser(validateDataLength(user), epcStr);
@@ -143,6 +142,7 @@ public class WriteUserActivity extends BaseActivity implements DataReturnCall, P
}
+
public String validateDataLength(String data) {
int length = data.length();
int remainder = length % 4;
diff --git a/app/src/main/java/com/example/jinyu_rfid/broadcast/ScanERCodeReceiver.java b/app/src/main/java/com/example/jinyu_rfid/broadcast/ScanERCodeReceiver.java
deleted file mode 100644
index 4f6328f..0000000
--- a/app/src/main/java/com/example/jinyu_rfid/broadcast/ScanERCodeReceiver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.example.jinyu_rfid.broadcast;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-import com.example.jinyu_rfid.callback.DataReturnCall;
-
-public class ScanERCodeReceiver extends BroadcastReceiver {
- private DataReturnCall call;
-
- public ScanERCodeReceiver() {
- }
-
- public ScanERCodeReceiver(DataReturnCall call) {
- this.call = call;
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- byte[] data = intent.getByteArrayExtra("data");
- if (data != null) {
- String barcode = new String(data);
- Log.e("", "onReceive, data:" + barcode);
- call.readerCodeInfo(barcode);
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/jinyu_rfid/rfid/AutoID9UDevice.java b/app/src/main/java/com/example/jinyu_rfid/rfid/AutoID9UDevice.java
new file mode 100644
index 0000000..3a50850
--- /dev/null
+++ b/app/src/main/java/com/example/jinyu_rfid/rfid/AutoID9UDevice.java
@@ -0,0 +1,128 @@
+package com.example.jinyu_rfid.rfid;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
+
+import com.example.jinyu_rfid.callback.DataReturnCall;
+import com.example.jinyu_rfid.uitls.ASCIIUtil;
+import com.seuic.uhf.EPC;
+import com.seuic.uhf.UHFService;
+
+import cn.pda.serialport.Tools;
+
+/**
+ * @author wanghao
+ * @date 2024/6/7 13:36
+ */
+public class AutoID9UDevice implements RFIDModel {
+
+ private DataReturnCall call;
+ private UHFService uhfService;
+ private byte[] password = AutoID9UUtil.getHexByteArray("00000000");
+ private AutoIDdeviceScanERCodeReceiver scanERCodeReceiver;
+ private Context context;
+
+
+ @SuppressLint("UnspecifiedRegisterReceiverFlag")
+ public AutoID9UDevice(DataReturnCall call, Context context) {
+ this.call = call;
+ this.context = context;
+ uhfService = UHFService.getInstance();
+ uhfService.setParameters(UHFService.PARAMETER_INVENTORY_SESSION,0);
+ if (!uhfService.isopen()) {
+ uhfService.open();
+ }
+
+ Log.e("TAG", "上电:" + uhfService.isopen());
+ Log.e("TAG", "功率:" + uhfService.getPower());
+ scanERCodeReceiver = new AutoIDdeviceScanERCodeReceiver();
+ context.registerReceiver(scanERCodeReceiver, new IntentFilter("com.android.server.scannerservice.broadcast"));
+ }
+
+ @Override
+ public void sanEpc(int len) {
+ EPC epc = new EPC();
+ var result = uhfService.inventoryOnce(epc, 100);
+ Log.e("TAG", "sanEpc:" + result);
+ String info = null;
+ if (result) {
+ var id = epc.getId();
+ Log.e("TAG", "sanEpc:" + id);
+ var length = id.length();
+ var i = len * 4;
+ if (i < length) {
+ id = id.substring(0, i);
+ } else if (i > length) {
+ var tag = i - length;
+ for (int j = 0; j < tag; j++) {
+ id += "0";
+ }
+
+ }
+ info = id;
+ }
+ call.readEpcCodeInfo(info, result, null);
+ }
+
+
+ @Override
+ public boolean writeUser(String writeStr, String tagEpc) {
+
+ var bytes = AutoID9UUtil.getHexByteArray(writeStr);
+ Log.e("TAG", "writeUser:" + tagEpc);
+ var b = uhfService.writeTagData(AutoID9UUtil.getHexByteArray(tagEpc), password,
+ 3, 0, bytes.length, bytes);
+ return b;
+ }
+
+ String id = null;
+
+ @Override
+ public void sanUser(int len) {
+ var power = uhfService.getPower();
+ Log.e("TAG", "设备功率:" + power);
+
+ String info = null;
+ EPC epc=new EPC();
+ var result = uhfService.inventoryOnce(epc, 100);
+ Log.e("TAG", "epcid:" + epc.getId());
+ if (result) {
+ var i = len * 2;
+ byte[] data = new byte[i];
+ result = uhfService.readTagData(AutoID9UUtil.getHexByteArray(epc.getId()), password, 3, 0, i, data);
+ Log.e("TAG", "按长度读取:" + result);
+ if (result) {
+ info = Tools.Bytes2HexString(data, data.length);
+ }
+ }
+ call.readUserInfo(info,result,null);
+ }
+
+ @Override
+ public void close() {
+ uhfService.close();
+ context.unregisterReceiver(scanERCodeReceiver);
+ }
+ //
+ // @Override
+ // public void loading() {
+ // uhfService.close();
+ // uhfService.open();
+ // Log.e("TAG", "loading:" + uhfService.getPower());
+ // }
+
+ class AutoIDdeviceScanERCodeReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String data = intent.getStringExtra("scannerdata");
+ if (data != null) {
+ call.readerCodeInfo(data);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/jinyu_rfid/rfid/AutoID9UUtil.java b/app/src/main/java/com/example/jinyu_rfid/rfid/AutoID9UUtil.java
new file mode 100644
index 0000000..2678e2e
--- /dev/null
+++ b/app/src/main/java/com/example/jinyu_rfid/rfid/AutoID9UUtil.java
@@ -0,0 +1,121 @@
+package com.example.jinyu_rfid.rfid;
+
+public class AutoID9UUtil {
+
+ /**
+ * Copy the array at the specified location
+ */
+ public static void memcpy(byte[] bytesTo, byte[] bytesFrom, int len) {
+ memcpy(bytesTo, 0, bytesFrom, 0, len);
+ }
+
+ /**
+ *
+ */
+ public static void memcpy(byte[] bytesTo, int startIndexTo, byte[] bytesFrom, int startIndexFrom, int len) {
+ while (len-- > 0) {
+ bytesTo[startIndexTo++] = bytesFrom[startIndexFrom++];
+ }
+ }
+
+ /**
+ * Copy the array from the start
+ */
+ public static boolean memcmp(byte[] bytes1, byte[] bytes2, int len) {
+
+ if (len < 1) {
+ return false;
+ }
+
+ int startIndex = 0;
+ while (len-- > 0) {
+ if (bytes1[startIndex] != bytes2[startIndex]) {
+ return false;
+ }
+ startIndex++;
+ }
+ return true;
+ }
+
+ /**
+ * byte array to hexadecimal string
+ */
+ public static String getHexString(byte[] b, int length) {
+ return getHexString(b, length, "");
+ }
+
+ /**
+ * Convert the specified splitter
+ */
+ public static String getHexString(byte[] b, int length, String split) {
+ StringBuilder hex = new StringBuilder("");
+ String temp = null;
+ for (int i = 0; i < length; i++) {
+ temp = Integer.toHexString(b[i] & 0xFF);
+ if (temp.length() == 1) {
+ temp = '0' + temp;
+ }
+ hex.append(temp + split);
+ }
+ return hex.toString().trim().toUpperCase();
+ }
+
+ /**
+ * String to hexadecimal array
+ */
+ public static byte[] getHexByteArray(String hexString) {
+ byte[] buffer = new byte[hexString.length() / 2];
+ if (hexString == null || hexString.equals("")) {
+ return null;
+ }
+ hexString = hexString.toUpperCase();
+ int length = hexString.length() / 2;
+ char[] hexChars = hexString.toCharArray();
+ for (int i = 0; i < length; i++) {
+ int pos = i * 2;
+ buffer[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ }
+ return buffer;
+ }
+
+ /**
+ * String to hexadecimal array (Specified length)
+ */
+ public static int getHexByteArray(String hexString, byte[] buffer, int nSize) {
+
+ hexString.replace(" ", "");
+ if (nSize > hexString.length() / 2) {
+ nSize = hexString.length() / 2;
+ if (hexString.length() == 1) {
+ nSize = 1;
+ String str = "0";
+ hexString = str + hexString;
+ }
+ }
+ char[] hexChars = hexString.toCharArray();
+ for (int i = 0; i < nSize; i++) {
+ int pos = i * 2;
+ buffer[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ }
+ return nSize;
+ }
+
+ /**
+ *
+ */
+ private static byte charToByte(char c) {
+ return (byte) "0123456789ABCDEF".indexOf(c);
+ }
+
+ /**
+ * byte array to hexadecimal string
+ */
+ public static String ByteArrayToString(byte[] bt_ary) {
+ StringBuilder sb = new StringBuilder();
+ if (bt_ary != null)
+ for (byte b : bt_ary) {
+ sb.append(String.format("%02X ", b));
+ }
+ return sb.toString();
+ }
+}
diff --git a/app/src/main/java/com/example/jinyu_rfid/rfid/C5106Device.java b/app/src/main/java/com/example/jinyu_rfid/rfid/C5106Device.java
index 1872c55..04b7ca2 100644
--- a/app/src/main/java/com/example/jinyu_rfid/rfid/C5106Device.java
+++ b/app/src/main/java/com/example/jinyu_rfid/rfid/C5106Device.java
@@ -1,5 +1,9 @@
package com.example.jinyu_rfid.rfid;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.util.Log;
import com.example.jinyu_rfid.callback.DataReturnCall;
@@ -18,10 +22,15 @@ public class C5106Device implements RFIDModel {
private UHFRManager uhfrManager;
private DataReturnCall call;
public byte[] accessBytes = Tools.HexString2Bytes("00000000");
+ private Context context;
+ private ScanERCodeReceiver scanERCodeReceiver;
- public C5106Device(DataReturnCall call) {
+ public C5106Device(DataReturnCall call, Context context) {
uhfrManager = UHFRManager.getInstance();
this.call = call;
+ this.context = context;
+ scanERCodeReceiver = new ScanERCodeReceiver();
+ context.registerReceiver(scanERCodeReceiver, new IntentFilter("com.rfid.SCAN"));
}
@@ -79,5 +88,19 @@ public class C5106Device implements RFIDModel {
public void close() {
if (uhfrManager != null)
uhfrManager.close();
+ context.unregisterReceiver(scanERCodeReceiver);
+ }
+
+ class ScanERCodeReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ byte[] data = intent.getByteArrayExtra("data");
+ if (data != null) {
+ String barcode = new String(data);
+ Log.e("", "onReceive, data:" + barcode);
+ call.readerCodeInfo(barcode);
+ }
+ }
}
}
diff --git a/app/src/main/res/layout/activity_autoid_read.xml b/app/src/main/res/layout/activity_autoid_read.xml
new file mode 100644
index 0000000..0d35d37
--- /dev/null
+++ b/app/src/main/res/layout/activity_autoid_read.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_read.xml b/app/src/main/res/layout/activity_read.xml
index ba46cf6..58b80a7 100644
--- a/app/src/main/res/layout/activity_read.xml
+++ b/app/src/main/res/layout/activity_read.xml
@@ -55,6 +55,8 @@
android:padding="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
+
+