|
|
@ -649,31 +649,51 @@ public class OxUDP { |
|
|
|
// 通知方法 |
|
|
|
private void notifyGateStateUpdate(boolean gateAState, boolean gateBState, String rawData) { |
|
|
|
if (stateListener != null) { |
|
|
|
mainHandler.post(() -> stateListener.onGateStateUpdate(gateAState, gateBState, rawData)); |
|
|
|
mainHandler.post(() -> { |
|
|
|
if (stateListener != null) { |
|
|
|
stateListener.onGateStateUpdate(gateAState, gateBState, rawData); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void notifyGateOpenResult(String gateType, boolean success) { |
|
|
|
if (stateListener != null) { |
|
|
|
mainHandler.post(() -> stateListener.onGateOpenResult(gateType, success)); |
|
|
|
mainHandler.post(() -> { |
|
|
|
if (stateListener != null) { |
|
|
|
stateListener.onGateOpenResult(gateType, success); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void notifyUDPError(String error) { |
|
|
|
if (stateListener != null) { |
|
|
|
mainHandler.post(() -> stateListener.onUDPError(error)); |
|
|
|
mainHandler.post(() -> { |
|
|
|
if (stateListener != null) { |
|
|
|
stateListener.onUDPError(error); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void notifyDeviceInfoUpdate(String deviceInfo) { |
|
|
|
if (deviceListener != null) { |
|
|
|
mainHandler.post(() -> deviceListener.onDeviceInfoUpdate(deviceInfo)); |
|
|
|
mainHandler.post(() -> { |
|
|
|
if (deviceListener != null) { |
|
|
|
deviceListener.onDeviceInfoUpdate(deviceInfo); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void notifyDeviceConnectionChange(boolean connected) { |
|
|
|
if (deviceListener != null) { |
|
|
|
mainHandler.post(() -> deviceListener.onDeviceConnectionChange(connected)); |
|
|
|
mainHandler.post(() -> { |
|
|
|
if (deviceListener != null) { |
|
|
|
deviceListener.onDeviceConnectionChange(connected); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |