| | |
| | | try { |
| | | pollingThread = new Thread(new PollingTask(), "CardSlot-Polling-Thread"); |
| | | pollingThread.setDaemon(true); |
| | | pollingThread.start(); |
| | | if (DEBUG_ENABLED) { |
| | | //System.out.println("轮询查询已启动,间隔: " + pollingInterval + "ms"); |
| | | } |
| | | pollingThread.start(); |
| | | return true; |
| | | } catch (Exception e) { |
| | | System.err.println("启动轮询查询线程时发生异常: " + e.getMessage()); |
| | |
| | | } else { |
| | | consecutiveFailures++; |
| | | if (consecutiveFailures >= MAX_CONSECUTIVE_FAILURES) { |
| | | System.err.println("连续失败次数过多,暂停轮询"); |
| | | System.err.println("lunxun连续失败次数过多,暂停轮询"); |
| | | pausePolling(); |
| | | break; |
| | | } |
| | |
| | | if (sendResult) { |
| | | // 只在调试时输出,避免频繁打印 |
| | | if (DEBUG_ENABLED) { |
| | | SystemDebugDialog.appendAsciiData(String.format("Slot %d Send query (hasCard !=1)", slotNumber)); |
| | | SystemDebugDialog.appendAsciiData(String.format("Slot %d Send query (hasCard !=1)\n", slotNumber)); |
| | | } |
| | | return true; |
| | | } else { |