|
@ -420,14 +420,14 @@ public class OxUDP { |
|
|
if (responseArr.length > 28) { |
|
|
if (responseArr.length > 28) { |
|
|
String aStateValue = responseArr[28]; |
|
|
String aStateValue = responseArr[28]; |
|
|
gateAState = "01".equals(aStateValue); // 01表示开启,00表示关闭 |
|
|
gateAState = "01".equals(aStateValue); // 01表示开启,00表示关闭 |
|
|
Log.d(TAG, "A门状态值: " + aStateValue + " -> " + (gateAState ? "开启" : "关闭")); |
|
|
|
|
|
|
|
|
Log.d(TAG, "A门状态值parseGateState: " + aStateValue + " -> " + (gateAState ? "开启" : "关闭")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 解析B门状态(第29位,数组索引29) |
|
|
// 解析B门状态(第29位,数组索引29) |
|
|
if (responseArr.length > 29) { |
|
|
if (responseArr.length > 29) { |
|
|
String bStateValue = responseArr[29]; |
|
|
String bStateValue = responseArr[29]; |
|
|
gateBState = "01".equals(bStateValue); // 01表示开启,00表示关闭 |
|
|
gateBState = "01".equals(bStateValue); // 01表示开启,00表示关闭 |
|
|
Log.d(TAG, "B门状态值: " + bStateValue + " -> " + (gateBState ? "开启" : "关闭")); |
|
|
|
|
|
|
|
|
Log.d(TAG, "B门状态值parseGateState: " + bStateValue + " -> " + (gateBState ? "开启" : "关闭")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 记录完整的响应数据用于调试 |
|
|
// 记录完整的响应数据用于调试 |
|
@ -443,6 +443,7 @@ public class OxUDP { |
|
|
// Log.d(TAG, "门禁状态 - A门: " + (gateAState ? "开启" : "关闭") + |
|
|
// Log.d(TAG, "门禁状态 - A门: " + (gateAState ? "开启" : "关闭") + |
|
|
// ", B门: " + (gateBState ? "开启" : "关闭")); |
|
|
// ", B门: " + (gateBState ? "开启" : "关闭")); |
|
|
|
|
|
|
|
|
|
|
|
Log.e(TAG, "parseGateState: isFirstStateUpdate:"+isFirstStateUpdate +" |lastGateAState:"+lastGateAState+" |lastGateBState:"+lastGateBState); |
|
|
// 检查状态是否发生变化,只有变化时才通知监听器 |
|
|
// 检查状态是否发生变化,只有变化时才通知监听器 |
|
|
if (isFirstStateUpdate || gateAState != lastGateAState || gateBState != lastGateBState) { |
|
|
if (isFirstStateUpdate || gateAState != lastGateAState || gateBState != lastGateBState) { |
|
|
Log.i(TAG, "门禁状态变化 - A门: " + (lastGateAState ? "开启" : "关闭") + " -> " + (gateAState ? "开启" : "关闭") + |
|
|
Log.i(TAG, "门禁状态变化 - A门: " + (lastGateAState ? "开启" : "关闭") + " -> " + (gateAState ? "开启" : "关闭") + |
|
|