[6.6.0]
[局域网内通讯]
This commit is contained in:
@@ -324,12 +324,12 @@ public class OrderModel {
|
||||
|
||||
private final ILanMessageListener taskDetailsMsgListener = new ILanMessageListener<TaskDetailsMsg>(){
|
||||
@Override
|
||||
public Class<TaskDetailsMsg> target() {
|
||||
public Class<TaskDetailsMsg> targetLan() {
|
||||
return TaskDetailsMsg.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(TaskDetailsMsg obj) {
|
||||
public void onLanMsgReceived(TaskDetailsMsg obj) {
|
||||
sendTaskDetailsToClients();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -170,11 +170,11 @@ object OrderModel {
|
||||
}
|
||||
|
||||
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun target(): Class<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> {
|
||||
return TaskDetailsMsg::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(taskDetailsMsg: TaskDetailsMsg?) {
|
||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) {
|
||||
taskDetailsMsg?.let {
|
||||
if (it.msg?.isEmpty() == true){
|
||||
clearLocalRouteResult()
|
||||
|
||||
@@ -22,11 +22,11 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
|
||||
// 接受到客户端注册信息后立即返回业务模式
|
||||
private val registerListener = object : ILanMessageListener<BaseDPMsg> {
|
||||
override fun target(): Class<BaseDPMsg> {
|
||||
override fun targetLan(): Class<BaseDPMsg> {
|
||||
return BaseDPMsg::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(obj: BaseDPMsg?) {
|
||||
override fun onLanMsgReceived(obj: BaseDPMsg?) {
|
||||
println("-------${obj}")
|
||||
if(LoginStatusManager.isLogin()) {
|
||||
FlavorUtils.getEnvCheck()
|
||||
|
||||
@@ -74,11 +74,11 @@ object LoginLanPassengerSocket : IReceivedMsgListener, CallerBase<IOchLanPasseng
|
||||
|
||||
// 环境监测
|
||||
private val checkListener = object : ILanMessageListener<EnvCheck> {
|
||||
override fun target(): Class<EnvCheck> {
|
||||
override fun targetLan(): Class<EnvCheck> {
|
||||
return EnvCheck::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(first: EnvCheck?) {
|
||||
override fun onLanMsgReceived(first: EnvCheck?) {
|
||||
first?.let {
|
||||
val checkEnv = checkEnv(first.projectType, first.envType, first.vehicleType, first.businessType)
|
||||
if (first.sourceScreenType== ScreenType.Driver) {
|
||||
@@ -105,11 +105,11 @@ object LoginLanPassengerSocket : IReceivedMsgListener, CallerBase<IOchLanPasseng
|
||||
|
||||
// 环境监测+业务展示和跳转
|
||||
private val changeBusinessType = object : ILanMessageListener<ChangeBusinessType> {
|
||||
override fun target(): Class<ChangeBusinessType> {
|
||||
override fun targetLan(): Class<ChangeBusinessType> {
|
||||
return ChangeBusinessType::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(first: ChangeBusinessType?) {
|
||||
override fun onLanMsgReceived(first: ChangeBusinessType?) {
|
||||
first?.let {
|
||||
val checkEnv = checkEnv(
|
||||
first.projectType,
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.mogo.och.common.module.manager.socket.lan;
|
||||
|
||||
|
||||
public interface ILanMessageListener<T> {
|
||||
Class<T> target();
|
||||
Class<T> targetLan();
|
||||
|
||||
void onMsgReceived(T obj);
|
||||
void onLanMsgReceived(T obj);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ object LanSocketManager : LanSocketManagerJava() {
|
||||
private const val TAG = "LanSocketManager"
|
||||
|
||||
val commonListener = object : ILanMessageListener<AppConnectMsg> {
|
||||
override fun target(): Class<AppConnectMsg> {
|
||||
override fun targetLan(): Class<AppConnectMsg> {
|
||||
return AppConnectMsg::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(first: AppConnectMsg?) {
|
||||
override fun onLanMsgReceived(first: AppConnectMsg?) {
|
||||
first?.let {
|
||||
if (it.isPlay) { //播报
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
||||
@@ -61,9 +61,9 @@ public class LanSocketManagerJava implements IReceivedMsgListener {
|
||||
List<ILanMessageListener> iLanMessageListenerJavas = mListeners.get(baseMsg.getType());
|
||||
if(iLanMessageListenerJavas!=null){
|
||||
for (ILanMessageListener iLanMessageListenerJava : iLanMessageListenerJavas) {
|
||||
Class<? extends BaseDPMsg> target = iLanMessageListenerJava.target();
|
||||
Class<? extends BaseDPMsg> target = iLanMessageListenerJava.targetLan();
|
||||
BaseDPMsg baseDPMsg = GsonUtils.fromJson(new String(byteArray), target);
|
||||
iLanMessageListenerJava.onMsgReceived(baseDPMsg);
|
||||
iLanMessageListenerJava.onLanMsgReceived(baseDPMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ object RxUtils {
|
||||
return !disposable.isDisposed
|
||||
}
|
||||
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
// The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the excTeption has nowhere to go to begin with
|
||||
// The exception could not be delivered to the consumer because it has already canceled/disposed
|
||||
// the flow or the excTeption has nowhere to go to begin with
|
||||
fun errCatch(){
|
||||
RxJavaPlugins.setErrorHandler(Consumer { e ->
|
||||
if (e is UndeliverableException) {
|
||||
|
||||
@@ -82,11 +82,11 @@ class ExampleUnitTest {
|
||||
fun testLanSocketManager(){
|
||||
LanSocketManager.registerSocketMessageListener(4,object :
|
||||
ILanMessageListener<EnvCheck> {
|
||||
override fun target(): Class<EnvCheck> {
|
||||
override fun targetLan(): Class<EnvCheck> {
|
||||
return EnvCheck::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(obj: EnvCheck?) {
|
||||
override fun onLanMsgReceived(obj: EnvCheck?) {
|
||||
println(obj)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,7 +6,6 @@ import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.weaknet.database.bean.ContrailDataBean
|
||||
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
||||
import io.reactivex.Observable
|
||||
|
||||
@@ -30,7 +29,11 @@ interface TaskDataDao {
|
||||
|
||||
// 查询当天特定线路正在执行的任务
|
||||
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.useing} and line_id = :lineId")
|
||||
fun queryRunningTastByLineId(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
||||
fun queryRunningTaskByLineId(lineId: Long, zeroTime:Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
||||
|
||||
// 查询当天特定线路正在执行的任务
|
||||
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.useing}")
|
||||
fun queryRunningTaskByStatusRx(zeroTime:Long = DateTimeUtil.getCurrentDateZero()): Observable<List<TaskDataBean>?>
|
||||
|
||||
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.unUse} and line_id = :lineId")
|
||||
fun queryUnuseTask(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): Observable<List<TaskDataBean>?>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.mogo.och.weaknet.database.repository
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.weaknet.database.MyDataBase
|
||||
import com.mogo.och.weaknet.database.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.database.dao.LineDataDao
|
||||
import io.reactivex.Observable
|
||||
import rx.Single
|
||||
|
||||
object LineRepository {
|
||||
|
||||
@@ -56,7 +54,7 @@ object LineRepository {
|
||||
// 删除线路对应的站点
|
||||
|
||||
SiteRepository.deleteByLineId(lineId)
|
||||
val runingTask = TaskRepository.queryRunningTastByLineId(lineId)
|
||||
val runingTask = TaskRepository.queryRunningTaskByLineId(lineId)
|
||||
if(runingTask.isNullOrEmpty()){
|
||||
// 删除线路对应的自驾信息
|
||||
|
||||
|
||||
@@ -91,14 +91,18 @@ object TaskRepository {
|
||||
|
||||
}
|
||||
|
||||
fun queryRunningTastByLineId(lineId: Long): List<TaskDataBean>? {
|
||||
return taskDataDao?.queryRunningTastByLineId(lineId)
|
||||
fun queryRunningTaskByLineId(lineId: Long): List<TaskDataBean>? {
|
||||
return taskDataDao?.queryRunningTaskByLineId(lineId)
|
||||
}
|
||||
|
||||
fun deleteByLineId(lineId: Long) {
|
||||
taskDataDao?.deleteByLineId(lineId)
|
||||
}
|
||||
|
||||
fun queryRunningTask(): Observable<List<TaskDataBean>?>? {
|
||||
return taskDataDao?.queryRunningTaskByStatusRx()
|
||||
}
|
||||
|
||||
|
||||
interface TaskStatusCallback{
|
||||
fun startSuccess()
|
||||
|
||||
@@ -39,7 +39,9 @@ object BusLineModel {
|
||||
private var mBusLinesCallback: IBusLinesCallback? = null
|
||||
private const val TAG = "BusLineModel"
|
||||
private const val LoopCarInfo = "LoopCarInfo"
|
||||
// 判断接口是否变化
|
||||
private const val executableChangeMd5 = "EXECUTABLECHANGEMD5"
|
||||
// 展示上一次刷新时间
|
||||
private const val executableChangeTime = "executablechangetime"
|
||||
|
||||
@JvmStatic
|
||||
@@ -167,6 +169,10 @@ object BusLineModel {
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 1、从别的数据库加载任务
|
||||
// 2、本地没有从远端恢复任务
|
||||
fun loadStartedTaskAndDefaultInfo(){
|
||||
TaskRepository.queryRunningTask()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,12 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.cancelAutoPilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIPCDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
@@ -33,7 +31,6 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager.canStartAutoPilot
|
||||
@@ -45,12 +42,10 @@ import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager.setStationPoint
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager.writeChainLog
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager.stopLoopAbnormalFactors
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
|
||||
import com.mogo.och.common.module.manager.socket.cloud.action.OperateAction
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager.sendMsgToClient
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusCacheKey
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
@@ -77,7 +72,6 @@ import com.mogo.och.weaknet.callback.IBusControllerStatusCallback
|
||||
import com.mogo.och.weaknet.callback.IRefreshBusStationsCallback
|
||||
import com.mogo.och.weaknet.callback.ISlidePannelHideCallback
|
||||
import com.mogo.och.weaknet.constant.BusConst
|
||||
import com.mogo.och.weaknet.model.TicketModel.load
|
||||
import com.mogo.och.weaknet.net.OrderServiceManager
|
||||
import com.mogo.och.weaknet.net.OrderServiceManager.endTask
|
||||
import com.mogo.och.weaknet.net.OrderServiceManager.leaveStation
|
||||
@@ -85,10 +79,7 @@ import com.mogo.och.weaknet.util.BusAnalyticsManager
|
||||
import com.mogo.och.weaknet.util.BusSendTripInfoManager
|
||||
import com.mogo.och.weaknet.util.BusSendTripInfoManager.sendBusTripInfo
|
||||
import com.mogo.och.weaknet.util.BusTrajectoryManager
|
||||
import com.mogo.och.weaknet.util.ShuttleVoiceManager.arrivedStationBus
|
||||
import com.mogo.och.weaknet.util.ShuttleVoiceManager.endOrderBus
|
||||
import com.mogo.och.weaknet.util.ShuttleVoiceManager.leaveStationBus
|
||||
import com.mogo.och.weaknet.util.ShuttleVoiceManager.showLeafTime
|
||||
import com.mogo.och.weaknet.util.ShuttleVoiceManager
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -134,49 +125,49 @@ object OrderModel {
|
||||
@JvmStatic
|
||||
fun init() {
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
|
||||
// 加载核销模块
|
||||
TicketModel.load()
|
||||
|
||||
// 定位监听
|
||||
OchLocationManager.addGCJ02Listener(TAG, 5, mMapLocationListener)
|
||||
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener)
|
||||
|
||||
OCHSocketMessageManager.registerSocketMessageListener( //监听运营消息
|
||||
OCHSocketMessageManager.msgMonitorType,
|
||||
OperateAction(true)
|
||||
)
|
||||
|
||||
load()
|
||||
//监听运营消息
|
||||
OCHSocketMessageManager.registerSocketMessageListener(OCHSocketMessageManager.msgMonitorType, OperateAction(true))
|
||||
|
||||
// 长链接监听
|
||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(AbsMogoApplication.getApp())
|
||||
|
||||
//监听乘客屏发来的消息
|
||||
CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener)
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
||||
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
// The exception could not be delivered to the consumer because it has already canceled/disposed
|
||||
// the flow or the excTeption has nowhere to go to begin with
|
||||
RxUtils.errCatch()
|
||||
}
|
||||
|
||||
private val mReceivedMsgListener: IReceivedMsgListener = object : IReceivedMsgListener {
|
||||
override fun onDemoMode(isDemoMode: Boolean) {
|
||||
}
|
||||
@JvmStatic
|
||||
fun release() {
|
||||
// 注销定位监听
|
||||
|
||||
override fun onReceivedServerSn(sn: String?) {
|
||||
}
|
||||
TicketModel.release()
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
d(SceneConstant.M_BUS + BaseDPMsg.TAG, String(byteArray))
|
||||
val msg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
|
||||
if (msg != null) {
|
||||
if (msg.type == DPMsgType.TYPE_TASK_DETAILS.type) {
|
||||
sendTaskDetailsToClients()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null)
|
||||
|
||||
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgMonitorType)
|
||||
|
||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||
//监听乘客屏发来的消息
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
||||
}
|
||||
|
||||
// 乘客屏请求线路信息
|
||||
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> = TaskDetailsMsg::class.java
|
||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) = sendTaskDetailsToClients()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -199,22 +190,6 @@ object OrderModel {
|
||||
this.mControllerStatusCallback = callback
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun release() {
|
||||
// 注销定位监听
|
||||
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null)
|
||||
|
||||
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgMonitorType)
|
||||
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgWriteOffPassengerType)
|
||||
|
||||
stopLoopAbnormalFactors()
|
||||
//监听乘客屏发来的消息
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
private val mAdasStartFailureListener: OchAdasStartFailureCallback =
|
||||
object : OchAdasStartFailureCallback {
|
||||
override fun brakeStatusChanged(isBrakeAvailable: Boolean) {
|
||||
@@ -230,7 +205,7 @@ object OrderModel {
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode) {
|
||||
e(SceneConstant.M_BUS + TAG, "mAdasStartFailureListener = $startFailedMessage")
|
||||
e(M_BUS + TAG, "mAdasStartFailureListener = $startFailedMessage")
|
||||
mADASStatusCallback!!.onStartAdasFailure()
|
||||
}
|
||||
}
|
||||
@@ -507,8 +482,6 @@ object OrderModel {
|
||||
|
||||
leaveTTSTips(nextStation, nextStationKr)
|
||||
|
||||
sendStartStationToClient(nextStation)
|
||||
|
||||
if (busRoutesResult != null) {
|
||||
var isLastStop = false
|
||||
if (leaveIndex + 1 == stationList!!.size - 1) {
|
||||
@@ -545,7 +518,6 @@ object OrderModel {
|
||||
sites[currentIndex - 1] = beanPre
|
||||
}
|
||||
|
||||
//busRoutesResult.setSite(sites);
|
||||
pushCacheTransferData(busRoutesResult!!)
|
||||
|
||||
updateBusStatus(busRoutesResult)
|
||||
@@ -725,9 +697,7 @@ object OrderModel {
|
||||
)
|
||||
}
|
||||
|
||||
arrivedStationBus(arriveStation, arriveStationKr)
|
||||
|
||||
sendArrivedStationToClient(arriveStation)
|
||||
ShuttleVoiceManager.arrivedStationBus(arriveStation, arriveStationKr)
|
||||
|
||||
reBuildCacheRouteData(
|
||||
arrivedStationIndex,
|
||||
@@ -740,13 +710,13 @@ object OrderModel {
|
||||
private fun sendTaskDetailsToClients() {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(SceneConstant.M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
sendMsgToClient(msg)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
|
||||
private fun pushCacheTransferData(result: BusRoutesResult) {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, result)
|
||||
d(SceneConstant.M_BUS + TAG, "pushCacheTransferData = " + GsonUtils.toJson(data))
|
||||
d(M_BUS + TAG, "pushCacheTransferData = " + GsonUtils.toJson(data))
|
||||
CacheDataManager.instance.putCacheData(
|
||||
mContext!!,
|
||||
BusCacheKey.BUS_LINE_CACHE,
|
||||
@@ -754,30 +724,12 @@ object OrderModel {
|
||||
)
|
||||
}
|
||||
|
||||
private fun sendArrivedStationToClient(arriveStation: String) {
|
||||
val arrivedMsg = AppConnectMsg(false, true, ResourcesUtils.getString(R.string.bus_arrived_station_tip,arriveStation), -1)
|
||||
sendMsgToClient(arrivedMsg)
|
||||
}
|
||||
|
||||
private fun sendStartStationToClient(nextStation: String) {
|
||||
val startMsg = AppConnectMsg(false, true, ResourcesUtils.getString(R.string.bus_leave_station_tip,nextStation), -1)
|
||||
UiThreadHandler.postDelayed({ sendMsgToClient(startMsg) }, BusConst.DELAY_10S)
|
||||
}
|
||||
|
||||
private fun sendEndTaskToClient() {
|
||||
val endMsg = AppConnectMsg(false, true, ResourcesUtils.getString(R.string.bus_end_task_tip), -1)
|
||||
sendMsgToClient(endMsg)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
*/
|
||||
fun leaveStation() {
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG,
|
||||
"leaveStation-backgroundCurrentStationIndex = " + currentStationIndex
|
||||
)
|
||||
private fun leaveStation() {
|
||||
d(M_BUS + TAG, "leaveStation-backgroundCurrentStationIndex = $currentStationIndex")
|
||||
if (busRoutesResult == null) {
|
||||
ToastUtils.showLong("数据异常、请稍后再试")
|
||||
return
|
||||
@@ -841,7 +793,7 @@ object OrderModel {
|
||||
//车站10s后播报
|
||||
private fun leaveTTSTips(nextStation: String, nextStationKr: String) {
|
||||
UiThreadHandler.postDelayed({ //延迟10s播报
|
||||
leaveStationBus(nextStation, nextStationKr)
|
||||
ShuttleVoiceManager.leaveStationBus(nextStation, nextStationKr)
|
||||
}, BusConst.DELAY_10S)
|
||||
}
|
||||
|
||||
@@ -998,7 +950,7 @@ object OrderModel {
|
||||
DateTimeUtil.getCurrentTimeStamp(),
|
||||
tips, OCHSocketMessageManager.OPERATION_SYSTEM
|
||||
)
|
||||
showLeafTime(tips)
|
||||
ShuttleVoiceManager.showLeafTime(tips)
|
||||
}
|
||||
|
||||
private var tip1Runnable = Runnable {
|
||||
@@ -1075,8 +1027,7 @@ object OrderModel {
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes() // 重新获取任务
|
||||
removeTipRunnables()
|
||||
endOrderBus()
|
||||
sendEndTaskToClient()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1137,6 +1088,7 @@ object OrderModel {
|
||||
// 登出
|
||||
@JvmStatic
|
||||
fun logout() {
|
||||
// TODO: 检测是否有本地任务没有同步到服务器端
|
||||
LoginStatusManager.loginOut()
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,11 @@ import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.manager.socket.cloud.IOchOnMessageListener
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDevicesMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffMsg
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
@@ -32,7 +35,7 @@ import io.reactivex.ObservableEmitter
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
object TicketModel : IReceivedMsgListener, IOchOnMessageListener<WriteOffPassenger> {
|
||||
object TicketModel : IOchOnMessageListener<WriteOffPassenger>{
|
||||
|
||||
private val TAG = "TicketModel"
|
||||
|
||||
@@ -42,37 +45,32 @@ object TicketModel : IReceivedMsgListener, IOchOnMessageListener<WriteOffPasseng
|
||||
|
||||
private val observable = Observable.create(ObservableOnSubscribe<Int> { emitter -> emitterMain = emitter })
|
||||
|
||||
init {
|
||||
private val writeOffMsg = object : ILanMessageListener<WriteOffMsg> {
|
||||
override fun targetLan(): Class<WriteOffMsg> = WriteOffMsg::class.java
|
||||
override fun onLanMsgReceived(obj: WriteOffMsg?) = receiveWrteOffInfo(obj)
|
||||
}
|
||||
|
||||
//监听乘客屏发来的消息
|
||||
CallerTelematicListenerManager.addListener(TAG, this)
|
||||
OCHSocketMessageManager.registerSocketMessageListener( //监听核销乘客
|
||||
OCHSocketMessageManager.msgWriteOffPassengerType,
|
||||
this
|
||||
)
|
||||
private val writeOfDevicefMsg = object : ILanMessageListener<WriteOffDevicesMsg> {
|
||||
override fun targetLan(): Class<WriteOffDevicesMsg> = WriteOffDevicesMsg::class.java
|
||||
override fun onLanMsgReceived(obj: WriteOffDevicesMsg?) = receiveWrteOffDevicesInfo(obj)
|
||||
}
|
||||
|
||||
fun load(){
|
||||
BizLoopManager.setLoopFunction(
|
||||
SELECTWRITEOFFCOUNT, LoopInfo(3,
|
||||
TicketModel::selectWriteOffCount,scheduler = Schedulers.io()))
|
||||
// 3s轮训站点核销人数
|
||||
BizLoopManager.setLoopFunction(SELECTWRITEOFFCOUNT, LoopInfo(3, TicketModel::selectWriteOffCount,scheduler = Schedulers.io()))
|
||||
// 核销信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_WRITEOFF_INFO.type,writeOffMsg)
|
||||
// 核销设备信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_WRITEOFF_DEVICES_INFO.type,writeOfDevicefMsg)
|
||||
//监听核销乘客
|
||||
OCHSocketMessageManager.registerSocketMessageListener(OCHSocketMessageManager.msgWriteOffPassengerType, this)
|
||||
}
|
||||
|
||||
// 收到局域网的核验信息
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
d(SceneConstant.M_BUS + TAG, "局域网核验"+String(byteArray))
|
||||
val msg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
|
||||
if (msg != null) {
|
||||
if (msg.type == DPMsgType.TYPE_WRITEOFF_INFO.type) {
|
||||
val writeOffMsg = GsonUtils.fromJson(String(byteArray), WriteOffMsg::class.java)
|
||||
receiveWrteOffInfo(writeOffMsg)
|
||||
} else if (msg.type == DPMsgType.TYPE_WRITEOFF_DEVICES_INFO.type) {
|
||||
val writeOffMsg = GsonUtils.fromJson(String(byteArray), WriteOffDevicesMsg::class.java)
|
||||
receiveWrteOffDevicesInfo(writeOffMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
fun release(){
|
||||
BizLoopManager.removeLoopFunction(SELECTWRITEOFFCOUNT)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_WRITEOFF_INFO.type,writeOffMsg)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_WRITEOFF_DEVICES_INFO.type,writeOfDevicefMsg)
|
||||
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgWriteOffPassengerType)
|
||||
}
|
||||
|
||||
override fun target(): Class<WriteOffPassenger> {
|
||||
@@ -169,44 +167,41 @@ object TicketModel : IReceivedMsgListener, IOchOnMessageListener<WriteOffPasseng
|
||||
}
|
||||
}
|
||||
|
||||
private fun receiveWrteOffDevicesInfo(writeOffMsg: WriteOffDevicesMsg) {
|
||||
if (writeOffMsg.isConnectScanner != null) {
|
||||
val reason = if (writeOffMsg.reason == null) "" else writeOffMsg.reason!!
|
||||
if (writeOffMsg.isConnectScanner==true) { // 链接成功
|
||||
saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_NORMAL.poiType,
|
||||
reason,
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_NORMAL.tts,
|
||||
""
|
||||
private fun receiveWrteOffDevicesInfo(writeOffMsg: WriteOffDevicesMsg?) {
|
||||
writeOffMsg?.let {
|
||||
if (writeOffMsg.isConnectScanner != null) {
|
||||
val reason = if (writeOffMsg.reason == null) "" else writeOffMsg.reason!!
|
||||
if (writeOffMsg.isConnectScanner==true) { // 链接成功
|
||||
saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_NORMAL.poiType,
|
||||
reason,
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_NORMAL.tts,
|
||||
""
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
} else { // 核验失败
|
||||
saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_ABNORMAL.poiType,
|
||||
reason,
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_ABNORMAL.tts,
|
||||
""
|
||||
} else { // 核验失败
|
||||
saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_ABNORMAL.poiType,
|
||||
reason,
|
||||
EventTypeEnumNew.TYPE_DEVICE_STATUS_ABNORMAL.tts,
|
||||
""
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun playPassenger(ticketSize: Int,phone:String,ticketName:String,orderNo:String) {
|
||||
|
||||
if (ticketSize > 1) { //多人播报 "x人" ---》x人核验通过
|
||||
ShuttleVoiceManager.sendWriteOffNumToClient(ticketSize.toString() + "人核验通过")
|
||||
} else { //是 1 播放 "滴" 2022.11.09 改为: "核验通过"
|
||||
ShuttleVoiceManager.sendWriteOffNumToClient("核验通过")
|
||||
}
|
||||
ShuttleVoiceManager.writeOffCount(ticketSize)
|
||||
|
||||
var tempPhone = phone
|
||||
|
||||
@@ -4,7 +4,6 @@ import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
@@ -34,10 +33,6 @@ import com.mogo.och.weaknet.model.OrderModel.isRestartAutopilot
|
||||
import com.mogo.och.weaknet.model.OrderModel.onArriveAt
|
||||
import com.mogo.och.weaknet.model.OrderModel.queryBusCacheRoutes
|
||||
import com.mogo.och.weaknet.model.OrderModel.release
|
||||
import com.mogo.och.weaknet.model.OrderModel.setAdasStatusCallback
|
||||
import com.mogo.och.weaknet.model.OrderModel.setControllerStatusCallback
|
||||
import com.mogo.och.weaknet.model.OrderModel.setRefreshBusStationsCallback
|
||||
import com.mogo.och.weaknet.model.OrderModel.setSlidePanelHideCallback
|
||||
import com.mogo.och.weaknet.model.OrderModel.triggerStartServiceEvent
|
||||
import com.mogo.och.weaknet.util.BusTrajectoryManager
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
@@ -73,19 +68,19 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
}
|
||||
|
||||
fun initModelListener() {
|
||||
setRefreshBusStationsCallback(this)
|
||||
setSlidePanelHideCallback(this)
|
||||
setControllerStatusCallback(this)
|
||||
setAdasStatusCallback(this)
|
||||
OrderModel.setRefreshBusStationsCallback(this)
|
||||
OrderModel.setSlidePanelHideCallback(this)
|
||||
OrderModel.setControllerStatusCallback(this)
|
||||
OrderModel.setAdasStatusCallback(this)
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
LoginStatusManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun releaseListener() {
|
||||
setRefreshBusStationsCallback(null)
|
||||
setSlidePanelHideCallback(null)
|
||||
setControllerStatusCallback(null)
|
||||
setAdasStatusCallback(null)
|
||||
OrderModel.setRefreshBusStationsCallback(null)
|
||||
OrderModel.setSlidePanelHideCallback(null)
|
||||
OrderModel.setControllerStatusCallback(null)
|
||||
OrderModel.setAdasStatusCallback(null)
|
||||
OCHAdasAbilityManager.getInstance().release()
|
||||
OchAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
LoginStatusManager.removeListener(TAG)
|
||||
|
||||
@@ -2,8 +2,9 @@ package com.mogo.och.weaknet.util
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager.sendMsgToClient
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.tts.base.LangTtsEntity
|
||||
@@ -11,12 +12,6 @@ import com.mogo.tts.base.LanguageType
|
||||
|
||||
object ShuttleVoiceManager {
|
||||
|
||||
fun sendWriteOffNumToClient(msg: String?) {
|
||||
val passengerMsg = AppConnectMsg(false, true, msg!!, -1)
|
||||
sendMsgToClient(passengerMsg)
|
||||
}
|
||||
|
||||
|
||||
fun arrivedStationBus(siteNameCN: String?, siteNameKR: String?) {
|
||||
val context = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
@@ -36,9 +31,21 @@ object ShuttleVoiceManager {
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
sendArrivedStationToClient(it)
|
||||
}
|
||||
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1,null)
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun sendArrivedStationToClient(arriveStation: String) {
|
||||
val arrivedMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = ResourcesUtils.getString(R.string.bus_arrived_station_tip,arriveStation),
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(arrivedMsg)
|
||||
}
|
||||
|
||||
fun leaveStationBus(siteNameCN: String?, siteNameKR: String?) {
|
||||
@@ -60,11 +67,21 @@ object ShuttleVoiceManager {
|
||||
context.getString(R.string.bus_leave_station_korean_tip, siteNameKR ?: it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
sendStartStationToClient(it)
|
||||
list.add(koreanTTS)
|
||||
}
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1,null)
|
||||
}
|
||||
|
||||
private fun sendStartStationToClient(nextStation: String) {
|
||||
val startMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = ResourcesUtils.getString(R.string.bus_leave_station_tip,nextStation),
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(startMsg)
|
||||
}
|
||||
|
||||
fun endOrderBus() {
|
||||
val context = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
@@ -74,17 +91,40 @@ object ShuttleVoiceManager {
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
sendEndTaskToClient()
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0,null)
|
||||
}
|
||||
|
||||
private fun sendEndTaskToClient() {
|
||||
val endMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = ResourcesUtils.getString(R.string.bus_end_task_tip),
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(endMsg)
|
||||
}
|
||||
|
||||
|
||||
fun writeOffCount(successNum:Int){
|
||||
if(successNum<=1){
|
||||
VoiceNotice.showNotice("核验通过", AIAssist.LEVEL3);
|
||||
VoiceNotice.showNotice("核验通过", AIAssist.LEVEL3)
|
||||
sendWriteOffNumToClient("核验通过")
|
||||
}else{
|
||||
VoiceNotice.showNotice("$successNum 人核验通过", AIAssist.LEVEL3)
|
||||
sendWriteOffNumToClient("$successNum 人核验通过")
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendWriteOffNumToClient(msg: String?) {
|
||||
val passengerMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = msg!!,
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(passengerMsg)
|
||||
}
|
||||
|
||||
|
||||
// 距离发车还有1分钟
|
||||
fun showLeafTime(tips: String) {
|
||||
//语音提示
|
||||
|
||||
Reference in New Issue
Block a user