|
|
@ -142,15 +142,6 @@ public class A8kCanBusService { |
|
|
|
return new A8kPacket(buffer.array()); |
|
|
|
} |
|
|
|
|
|
|
|
private void setTxPacketContext(A8kPacket packet) { |
|
|
|
txPacketContext = packet; |
|
|
|
} |
|
|
|
|
|
|
|
synchronized private A8kPacket getTxPacketContext() { |
|
|
|
return txPacketContext; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public byte[] a8kIdcardReaderReadRaw() throws AppException { |
|
|
|
int i = 0; |
|
|
|
byte[] result = new byte[0]; |
|
|
@ -165,98 +156,13 @@ public class A8kCanBusService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void plateCodeScanerPushCardAndScan(MId id, Integer finalStopPos) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.plate_code_scaner_push_card_and_scan.toInt(), finalStopPos); |
|
|
|
} |
|
|
|
|
|
|
|
public void plateCodeScanerPushCardAndScanBlock(MId id, Integer finalStopPos, Integer actionOvertime) throws AppException { |
|
|
|
plateCodeScanerPushCardAndScan(id, finalStopPos); |
|
|
|
waitForMod(id, actionOvertime); |
|
|
|
} |
|
|
|
|
|
|
|
public void plateCodeScanerStopScan(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.plate_code_scaner_stop_scan.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
public List<Integer> plateCodeScanerReadRawResult(MId id) throws AppException { |
|
|
|
int i = 0; |
|
|
|
List<Integer> result = new ArrayList<>(); |
|
|
|
while (true) { |
|
|
|
var rxPacket = callcmd(id.toInt(), CmdId.plate_code_scaner_read_result.toInt(), i++); |
|
|
|
if (rxPacket.getCmdContent().length == 0) { |
|
|
|
break; |
|
|
|
} |
|
|
|
var rawdata = ByteArray.readU16bitArray(rxPacket.getCmdContent()); |
|
|
|
result.addAll(Arrays.asList(rawdata)); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public PlateInfo plateCodeScannerReadCode(MId mid) throws AppException { |
|
|
|
var receipt = callcmd(mid.toInt(), CmdId.plate_code_scaner_read_code.toInt()); |
|
|
|
PlateInfo plateInfo = new PlateInfo(); |
|
|
|
plateInfo.rawcode = Integer.toBinaryString(receipt.getContentI32(0)); |
|
|
|
plateInfo.legal = receipt.getContentI32(1) != 0; |
|
|
|
plateInfo.lot = receipt.getContentI32(2); |
|
|
|
plateInfo.item = receipt.getContentI32(3); |
|
|
|
return plateInfo; |
|
|
|
} |
|
|
|
|
|
|
|
public void plateCodeScanerOpenLaser(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.plate_code_scaner_open_laser.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
public void plateCodeScanerCloseLaser(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.plate_code_scaner_close_laser.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Integer plateCodeScanerAdcReadRaw(MId id) throws AppException { |
|
|
|
var packet = callcmd(id.toInt(), CmdId.plate_code_scaner_adc_readraw.toInt()); |
|
|
|
return packet.getContentI32(0); |
|
|
|
} |
|
|
|
// public void fanControlerSetSpeed(MId id, int speed) throws AppException { |
|
|
|
// callcmd(id.toInt(), CmdId.fan_controler_set_speed.toInt(), speed); |
|
|
|
// } |
|
|
|
// |
|
|
|
|
|
|
|
|
|
|
|
public void fanControlerSetSpeed(MId id, int speed) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.fan_controler_set_speed.toInt(), speed); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void codeScanerStartScan(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.code_scaner_start_scan.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
public void codeScanerStopScan(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.code_scaner_stop_scan.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
public String codeScanerReadScanerResult(MId id) throws AppException { |
|
|
|
A8kPacket ack = callcmd(id.toInt(), CmdId.code_scaner_read_scaner_result.toInt()); |
|
|
|
var contentBytes = ack.getCmdContent(); |
|
|
|
return new String(contentBytes); |
|
|
|
} |
|
|
|
|
|
|
|
public Boolean codeScanerResultIsReady(MId id) throws AppException { |
|
|
|
var packet = callcmd(id.toInt(), CmdId.code_scaner_result_is_ready.toInt()); |
|
|
|
return packet.getContentI32(0) != 0; |
|
|
|
} |
|
|
|
|
|
|
|
public String codeScanerWaittingForResult(MId mid, Integer acitionOvertime) throws AppException { |
|
|
|
long startedAt = System.currentTimeMillis(); |
|
|
|
do { |
|
|
|
if (codeScanerResultIsReady(mid)) |
|
|
|
break; |
|
|
|
long now = System.currentTimeMillis(); |
|
|
|
if (now - startedAt > acitionOvertime) { |
|
|
|
codeScanerStopScan(mid); |
|
|
|
return null; |
|
|
|
} |
|
|
|
OS.hsleep(100); |
|
|
|
} while (true); |
|
|
|
codeScanerStopScan(mid); |
|
|
|
return codeScanerReadScanerResult(mid); |
|
|
|
} |
|
|
|
|
|
|
|
// |
|
|
|
// module opeation |
|
|
|
// |
|
|
@ -274,9 +180,6 @@ public class A8kCanBusService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void moduleSetReg(MId id, RegIndex regindex, Integer reg) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.module_set_reg.toInt(), regindex.index, reg); |
|
|
|
} |
|
|
@ -291,14 +194,6 @@ public class A8kCanBusService { |
|
|
|
return A8kEcode.fromInt(packet.getContentI32(0)); |
|
|
|
} |
|
|
|
|
|
|
|
public void moduleClearError(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.module_clear_error.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
public void moduleActiveCfg(MId id) throws AppException { |
|
|
|
callcmd(id.toInt(), CmdId.module_active_cfg.toInt()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Boolean priGetIOState(IOId ioid) throws AppException { |
|
|
|
if (ioid.mtype == ModuleType.kboard) { |
|
|
|