赵明涛 3 days ago
parent
commit
cdf959f278
  1. 16
      app/src/main/java/com/ouxuan/oxface/device/OxUDP.java

16
app/src/main/java/com/ouxuan/oxface/device/OxUDP.java

@ -284,7 +284,7 @@ public class OxUDP {
DatagramPacket sendPacket = new DatagramPacket( DatagramPacket sendPacket = new DatagramPacket(
sendData, sendData.length, serverAddress, UDP_SEND_PORT); sendData, sendData.length, serverAddress, UDP_SEND_PORT);
Log.d(TAG, "发送UDP命令到 " + UDP_IP + ":" + UDP_SEND_PORT + " - " + command);
// Log.d(TAG, "发送UDP命令到 " + UDP_IP + ":" + UDP_SEND_PORT + " - " + command);
// 发送数据 // 发送数据
socket.send(sendPacket); socket.send(sendPacket);
@ -299,7 +299,7 @@ public class OxUDP {
System.arraycopy(receiveData, 0, responseBytes, 0, receivePacket.getLength()); System.arraycopy(receiveData, 0, responseBytes, 0, receivePacket.getLength());
String response = bytesToHexString(responseBytes); String response = bytesToHexString(responseBytes);
Log.d(TAG, "收到UDP响应: " + response);
// Log.d(TAG, "收到UDP响应: " + response);
return response; return response;
} catch (Exception e) { } catch (Exception e) {
@ -410,17 +410,17 @@ public class OxUDP {
} }
// 记录完整的响应数据用于调试 // 记录完整的响应数据用于调试
Log.d(TAG, "完整UDP响应: " + response);
Log.d(TAG, "响应数组长度: " + responseArr.length);
// Log.d(TAG, "完整UDP响应: " + response);
// Log.d(TAG, "响应数组长度: " + responseArr.length);
if (responseArr.length > 28) { if (responseArr.length > 28) {
Log.d(TAG, "第28位(A门): " + responseArr[28]);
// Log.d(TAG, "第28位(A门): " + responseArr[28]);
} }
if (responseArr.length > 29) { if (responseArr.length > 29) {
Log.d(TAG, "第29位(B门): " + responseArr[29]);
// Log.d(TAG, "第29位(B门): " + responseArr[29]);
} }
Log.d(TAG, "门禁状态 - A门: " + (gateAState ? "开启" : "关闭") +
", B门: " + (gateBState ? "开启" : "关闭"));
// Log.d(TAG, "门禁状态 - A门: " + (gateAState ? "开启" : "关闭") +
// ", B门: " + (gateBState ? "开启" : "关闭"));
notifyGateStateUpdate(gateAState, gateBState, response); notifyGateStateUpdate(gateAState, gateBState, response);

Loading…
Cancel
Save