|
@ -8,6 +8,9 @@ import com.ouxuan.oxface.network.NetworkConfig; |
|
|
import com.ouxuan.oxface.network.api.PadApiService; |
|
|
import com.ouxuan.oxface.network.api.PadApiService; |
|
|
import com.ouxuan.oxface.network.model.ApiResponse; |
|
|
import com.ouxuan.oxface.network.model.ApiResponse; |
|
|
import com.ouxuan.oxface.utils.LogManager; |
|
|
import com.ouxuan.oxface.utils.LogManager; |
|
|
|
|
|
import com.ouxuan.oxface.utils.VenueSceneUtils; |
|
|
|
|
|
import com.ouxuan.oxface.device.voice.VoicePlayerManager; |
|
|
|
|
|
import com.ouxuan.oxface.device.voice.VoiceType; |
|
|
import java.util.concurrent.ExecutorService; |
|
|
import java.util.concurrent.ExecutorService; |
|
|
import java.util.concurrent.Executors; |
|
|
import java.util.concurrent.Executors; |
|
|
import retrofit2.Call; |
|
|
import retrofit2.Call; |
|
@ -51,6 +54,9 @@ public class GateABController { |
|
|
// 网络API服务 |
|
|
// 网络API服务 |
|
|
private PadApiService acControlApiService; |
|
|
private PadApiService acControlApiService; |
|
|
|
|
|
|
|
|
|
|
|
// 添加VoicePlayerManager实例 |
|
|
|
|
|
private VoicePlayerManager voicePlayerManager; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* AB门状态类 |
|
|
* AB门状态类 |
|
|
* 记录AB门的开关状态,用于触发门禁不可用弹窗 |
|
|
* 记录AB门的开关状态,用于触发门禁不可用弹窗 |
|
@ -219,6 +225,14 @@ public class GateABController { |
|
|
this.context = context; |
|
|
this.context = context; |
|
|
this.deviceDataManager = DeviceSelectDataManager.getInstance(context); |
|
|
this.deviceDataManager = DeviceSelectDataManager.getInstance(context); |
|
|
|
|
|
|
|
|
|
|
|
// 初始化语音播放管理器 |
|
|
|
|
|
try { |
|
|
|
|
|
voicePlayerManager = VoicePlayerManager.getInstance(); |
|
|
|
|
|
LogManager.logInfo(TAG, "GateABController语音播放管理器初始化完成"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
LogManager.logError(TAG, "GateABController语音播放管理器初始化失败", e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 初始化485通信模块 |
|
|
// 初始化485通信模块 |
|
|
ox485.initialize(context); |
|
|
ox485.initialize(context); |
|
|
|
|
|
|
|
@ -245,6 +259,21 @@ public class GateABController { |
|
|
public void openGateAB(GateControlCallback callback) { |
|
|
public void openGateAB(GateControlCallback callback) { |
|
|
LogManager.logInfo(TAG, "开始执行AB门开门操作"); |
|
|
LogManager.logInfo(TAG, "开始执行AB门开门操作"); |
|
|
|
|
|
|
|
|
|
|
|
// 播放开门提示语音 |
|
|
|
|
|
if (voicePlayerManager != null && context != null) { |
|
|
|
|
|
// 根据场景判断播放进场还是离场语音 |
|
|
|
|
|
boolean isLeaveScene = VenueSceneUtils.isLeaveScene(context); |
|
|
|
|
|
if (isLeaveScene) { |
|
|
|
|
|
voicePlayerManager.playVoice(VoiceType.VERIFICATION_SUCCESS_LEAVE); |
|
|
|
|
|
LogManager.logInfo(TAG, "播放离场开门语音提示"); |
|
|
|
|
|
} else { |
|
|
|
|
|
voicePlayerManager.playVoice(VoiceType.VERIFICATION_SUCCESS_ENTRY); |
|
|
|
|
|
LogManager.logInfo(TAG, "播放进场开门语音提示"); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
LogManager.logWarning(TAG, "语音播放管理器未初始化或上下文为空,跳过语音播放"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
executorService.execute(new Runnable() { |
|
|
executorService.execute(new Runnable() { |
|
|
@Override |
|
|
@Override |
|
|
public void run() { |
|
|
public void run() { |
|
|