|
@@ -37,7 +37,6 @@ public class DeJuRFIDService implements IService {
|
|
|
client = new GClient();
|
|
client = new GClient();
|
|
|
clientMap.put(ipAddress,client);
|
|
clientMap.put(ipAddress,client);
|
|
|
}
|
|
}
|
|
|
- Integer port = hardware.getPort();
|
|
|
|
|
if (client.openTcp(ipAddress+":8160", 2000)) {
|
|
if (client.openTcp(ipAddress+":8160", 2000)) {
|
|
|
// 订阅标签上报事件
|
|
// 订阅标签上报事件
|
|
|
subscribeHandler(client);
|
|
subscribeHandler(client);
|
|
@@ -64,11 +63,6 @@ public class DeJuRFIDService implements IService {
|
|
|
msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4);
|
|
msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4);
|
|
|
msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory);
|
|
msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory);
|
|
|
|
|
|
|
|
- //ParamEpcReadTid tid = new ParamEpcReadTid();
|
|
|
|
|
- //tid.setMode(EnumG.ParamTidMode_Auto);
|
|
|
|
|
- //tid.setLen(6);
|
|
|
|
|
- //msgBaseInventoryEpc.setReadTid(tid);
|
|
|
|
|
-
|
|
|
|
|
client.sendSynMsg(msgBaseInventoryEpc);
|
|
client.sendSynMsg(msgBaseInventoryEpc);
|
|
|
if (0 == msgBaseInventoryEpc.getRtCode()) {
|
|
if (0 == msgBaseInventoryEpc.getRtCode()) {
|
|
|
log.info("Inventory epc successful.");
|
|
log.info("Inventory epc successful.");
|
|
@@ -99,23 +93,19 @@ public class DeJuRFIDService implements IService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //订阅6c标签信息上报
|
|
|
|
|
- private static void subscribeHandler(GClient client) {
|
|
|
|
|
- client.onTagEpcLog = new HandlerTagEpcLog() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void log(String s, LogBaseEpcInfo logBaseEpcInfo) {
|
|
|
|
|
- log.error("=======================>"+logBaseEpcInfo.getEpc());
|
|
|
|
|
- if (logBaseEpcInfo.getResult() == 0) {
|
|
|
|
|
- System.out.println(logBaseEpcInfo);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订阅6c标签信息上报
|
|
|
|
|
+ * @param client 客户端
|
|
|
|
|
+ */
|
|
|
|
|
+ private void subscribeHandler(GClient client) {
|
|
|
|
|
+ client.onTagEpcLog = (s, logBaseEpcInfo) -> {
|
|
|
|
|
+ if (logBaseEpcInfo.getResult() == 0) {
|
|
|
|
|
+ InventoryTag tag=new InventoryTag();
|
|
|
|
|
+ BeanUtils.copyProperties(logBaseEpcInfo,tag);
|
|
|
|
|
+ sendService.send(tag);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- client.onTagEpcOver = new HandlerTagEpcOver() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void log(String s, LogBaseEpcOver logBaseEpcOver) {
|
|
|
|
|
- System.out.println("HandlerTagEpcOver");
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ client.onTagEpcOver = (s, logBaseEpcOver) -> log.info("HandlerTagEpcOver");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|