|
@@ -7,6 +7,7 @@ import com.gg.reader.api.protocol.gx.*;
|
|
|
import com.zd.common.core.exception.ServiceException;
|
|
import com.zd.common.core.exception.ServiceException;
|
|
|
import com.zd.netty.service.ISendService;
|
|
import com.zd.netty.service.ISendService;
|
|
|
import com.zd.netty.service.IService;
|
|
import com.zd.netty.service.IService;
|
|
|
|
|
+import com.zd.netty.thread.ThreadPoolTaskConfig;
|
|
|
import com.zd.system.api.domain.InventoryTag;
|
|
import com.zd.system.api.domain.InventoryTag;
|
|
|
import com.zd.system.api.laboratory.domain.RemoteLabHardware;
|
|
import com.zd.system.api.laboratory.domain.RemoteLabHardware;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -28,6 +29,9 @@ public class DeJuRFIDService implements IService {
|
|
|
|
|
|
|
|
private final Map<String, GClient> clientMap = new ConcurrentHashMap<>();
|
|
private final Map<String, GClient> clientMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ThreadPoolTaskConfig threadPoolTaskConfig;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void start(RemoteLabHardware hardware) {
|
|
public void start(RemoteLabHardware hardware) {
|
|
|
GClient client;
|
|
GClient client;
|
|
@@ -41,7 +45,6 @@ public class DeJuRFIDService implements IService {
|
|
|
if (client.openTcp(ipAddress + ":8160", 2000)) {
|
|
if (client.openTcp(ipAddress + ":8160", 2000)) {
|
|
|
// 订阅标签上报事件
|
|
// 订阅标签上报事件
|
|
|
subscribeHandler(client);
|
|
subscribeHandler(client);
|
|
|
-
|
|
|
|
|
// 功率配置, 将4个天线功率都设置为30dBm.
|
|
// 功率配置, 将4个天线功率都设置为30dBm.
|
|
|
Integer uniformPower = hardware.getUniformPower();
|
|
Integer uniformPower = hardware.getUniformPower();
|
|
|
MsgBaseGetPower msgBaseGetPower = new MsgBaseGetPower();
|
|
MsgBaseGetPower msgBaseGetPower = new MsgBaseGetPower();
|
|
@@ -69,17 +72,19 @@ public class DeJuRFIDService implements IService {
|
|
|
log.info("Power configuration error.");
|
|
log.info("Power configuration error.");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- MsgAppSetBeep msgAppSetBeep = new MsgAppSetBeep();
|
|
|
|
|
- msgAppSetBeep.setBeepMode(hardware.getSessionIndex() > 1 ? 1 : 0);
|
|
|
|
|
- msgAppSetBeep.setBeepStatus(1);
|
|
|
|
|
- client.sendSynMsg(msgAppSetBeep);
|
|
|
|
|
|
|
+ //蜂鸣器设置
|
|
|
|
|
+// MsgAppSetBeep msgAppSetBeep = new MsgAppSetBeep();
|
|
|
|
|
+// msgAppSetBeep.setBeepMode(hardware.getSessionIndex() > 1 ? 1 : 0);
|
|
|
|
|
+// msgAppSetBeep.setBeepStatus(1);
|
|
|
|
|
+// client.sendSynMsg(msgAppSetBeep);
|
|
|
|
|
+//
|
|
|
|
|
+// if (0 == msgAppSetBeep.getRtCode()) {
|
|
|
|
|
+// log.info("Beep epc successful.");
|
|
|
|
|
+// } else {
|
|
|
|
|
+// log.info("Beep epc error.");
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
- if (0 == msgAppSetBeep.getRtCode()) {
|
|
|
|
|
- log.info("Beep epc successful.");
|
|
|
|
|
- } else {
|
|
|
|
|
- log.info("Beep epc error.");
|
|
|
|
|
- }
|
|
|
|
|
- // 4个天线读卡, 读取EPC数据区以及TID数据区
|
|
|
|
|
|
|
+ //天线读卡, 读取EPC数据区以及TID数据区
|
|
|
MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc();
|
|
MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc();
|
|
|
switch (hardware.getChannels()) {
|
|
switch (hardware.getChannels()) {
|
|
|
case 4:
|
|
case 4:
|
|
@@ -134,10 +139,43 @@ public class DeJuRFIDService implements IService {
|
|
|
*/
|
|
*/
|
|
|
private void subscribeHandler(GClient client) {
|
|
private void subscribeHandler(GClient client) {
|
|
|
client.onTagEpcLog = (s, logBaseEpcInfo) -> {
|
|
client.onTagEpcLog = (s, logBaseEpcInfo) -> {
|
|
|
|
|
+ //灯带设置
|
|
|
|
|
+ MsgAppSetGpo msgAppSetGpo=new MsgAppSetGpo();
|
|
|
|
|
+ msgAppSetGpo.setGpo1(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo2(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo3(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo4(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo5(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo6(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo7(1);
|
|
|
|
|
+ msgAppSetGpo.setGpo8(1);
|
|
|
|
|
+ client.sendSynMsg(msgAppSetGpo);
|
|
|
|
|
+ if (0 == msgAppSetGpo.getRtCode()) {
|
|
|
|
|
+ log.info("Gpo epc successful.");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("Gpo epc error.");
|
|
|
|
|
+ }
|
|
|
if (logBaseEpcInfo.getResult() == 0) {
|
|
if (logBaseEpcInfo.getResult() == 0) {
|
|
|
InventoryTag tag = new InventoryTag();
|
|
InventoryTag tag = new InventoryTag();
|
|
|
BeanUtils.copyProperties(logBaseEpcInfo, tag);
|
|
BeanUtils.copyProperties(logBaseEpcInfo, tag);
|
|
|
sendService.send(tag);
|
|
sendService.send(tag);
|
|
|
|
|
+ threadPoolTaskConfig.getAsyncExecutor().execute(() -> {
|
|
|
|
|
+ MsgAppSetGpo msgAppSetGpo1 =new MsgAppSetGpo();
|
|
|
|
|
+ msgAppSetGpo1.setGpo1(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo2(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo3(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo4(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo5(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo6(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo7(0);
|
|
|
|
|
+ msgAppSetGpo1.setGpo8(0);
|
|
|
|
|
+ client.sendSynMsg(msgAppSetGpo1);
|
|
|
|
|
+ if (0 == msgAppSetGpo1.getRtCode()) {
|
|
|
|
|
+ log.info("Gpo epc successful.");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("Gpo epc error.");
|
|
|
|
|
+ }
|
|
|
|
|
+ },10000);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|