[6.6.0]
[shuttle] [乘客屏适配]
This commit is contained in:
@@ -52,6 +52,14 @@ public class BusRoutesResult {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskTime(long taskTime) {
|
||||
this.taskTime = taskTime;
|
||||
}
|
||||
|
||||
public void setTaskId(int taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,11 @@ object TaskRepository {
|
||||
return taskDataDao?.queryRunningTaskByStatus()
|
||||
}
|
||||
|
||||
fun queryTaskById(taskId: Long): TaskDataBean? {
|
||||
return taskDataDao?.queryTaskByTaskIdOne(taskId)
|
||||
}
|
||||
|
||||
|
||||
fun endTask(taskId: Long) {
|
||||
DbThreadUtils.runInIoThread{
|
||||
taskDataDao?.endTask(taskId)
|
||||
|
||||
@@ -11,15 +11,22 @@ import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse
|
||||
import com.mogo.och.weaknet.bean.BusQueryLinesResponse
|
||||
@@ -66,6 +73,9 @@ object BusLineModel {
|
||||
// 当前任务的站点列表
|
||||
var stationList:MutableList<BusStationBean>? = mutableListOf<BusStationBean>()
|
||||
|
||||
@JvmStatic
|
||||
val busRoutesResult: BusRoutesResult = BusRoutesResult()
|
||||
|
||||
|
||||
private val isRequesting = AtomicBoolean(false)
|
||||
private val loopQueryInfo = object :Runnable{
|
||||
@@ -333,19 +343,34 @@ object BusLineModel {
|
||||
override fun onSuccess(response: BusRoutesResponse?) {
|
||||
response?.data?.let {
|
||||
if (!it.sites.isNullOrEmpty()&&it.sites.size>1) {
|
||||
OchChainLogManager.writeChainLogDb("业务数据","本地没有正在运行的数据,服务器端有")
|
||||
LineRepository.saveRunningInfo(it.lineId,it.name,it.sites.last().name)
|
||||
TaskRepository.saveRunningInfo(it.lineId,it.taskId,it.taskTime)
|
||||
ContraiRepository.saveRunningInfo(
|
||||
it.lineId,
|
||||
it.csvFileMd5,
|
||||
it.csvFileUrl,
|
||||
it.txtFileUrl,
|
||||
it.txtFileMd5,
|
||||
it.contrailSaveTime
|
||||
)
|
||||
BusRoutesResponse.bean2Db(it.sites,it.lineId.toLong(),it.name,it.taskId.toLong())
|
||||
OrderModel.queryBusRoutes()
|
||||
val queryTaskById = TaskRepository.queryTaskById(it.taskId.toLong())
|
||||
if(queryTaskById==null||queryTaskById.status!=TaskDataBean.used) {
|
||||
OchChainLogManager.writeChainLogDb(
|
||||
"业务数据",
|
||||
"本地没有正在运行的数据,服务器端有"
|
||||
)
|
||||
LineRepository.saveRunningInfo(
|
||||
it.lineId,
|
||||
it.name,
|
||||
it.sites.last().name
|
||||
)
|
||||
TaskRepository.saveRunningInfo(it.lineId, it.taskId, it.taskTime)
|
||||
ContraiRepository.saveRunningInfo(
|
||||
it.lineId,
|
||||
it.csvFileMd5,
|
||||
it.csvFileUrl,
|
||||
it.txtFileUrl,
|
||||
it.txtFileMd5,
|
||||
it.contrailSaveTime
|
||||
)
|
||||
BusRoutesResponse.bean2Db(
|
||||
it.sites,
|
||||
it.lineId.toLong(),
|
||||
it.name,
|
||||
it.taskId.toLong()
|
||||
)
|
||||
OrderModel.queryBusRoutes()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -470,7 +495,6 @@ object BusLineModel {
|
||||
LineManager.lineInfos?.lineName?.let {lineName->
|
||||
EventRepository.saveEventTaskEnd(task.taskId!!,task.lineId!!,task.taskStartTime,lineName)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,5 +531,24 @@ object BusLineModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun sendTaskDetailsToClients() {
|
||||
if (LineManager.lineInfos==null||currentTask==null||stationList.isNullOrEmpty()) {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, null)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}else{
|
||||
busRoutesResult.setSite(stationList)
|
||||
busRoutesResult.lineId = LineManager.lineInfos!!.lineId.toInt()
|
||||
busRoutesResult.name = LineManager.lineInfos!!.lineName
|
||||
busRoutesResult.taskId = currentTask!!.taskId!!.toInt()
|
||||
busRoutesResult.taskTime = currentTask!!.taskStartTime!!
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ object OrderModel {
|
||||
private val TAG: String = OrderModel::class.java.simpleName
|
||||
|
||||
private var mContext: Context? = null
|
||||
@JvmStatic
|
||||
var busRoutesResult: BusRoutesResult? = null
|
||||
private set
|
||||
|
||||
private var mADASStatusCallback: IBusADASStatusCallback? = null
|
||||
/**
|
||||
@@ -145,7 +142,7 @@ object OrderModel {
|
||||
// 乘客屏请求线路信息
|
||||
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> = TaskDetailsMsg::class.java
|
||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) = sendTaskDetailsToClients()
|
||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) = BusLineModel.sendTaskDetailsToClients()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -290,16 +287,18 @@ object OrderModel {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun abortTask() {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
OCHThreadPoolManager.getsInstance().execute {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
|
||||
endOrAbortTaskSuccess()
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
// 取消自驾
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(true)
|
||||
endOrAbortTaskSuccess()
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
// 取消自驾
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,7 +319,7 @@ object OrderModel {
|
||||
}
|
||||
BusLineModel.endTask()
|
||||
|
||||
sendTaskDetailsToClients()
|
||||
BusLineModel.sendTaskDetailsToClients()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -477,15 +476,6 @@ object OrderModel {
|
||||
updateBusStatus()
|
||||
}
|
||||
|
||||
|
||||
private fun sendTaskDetailsToClients() {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
*/
|
||||
@@ -533,7 +523,7 @@ object OrderModel {
|
||||
fun autoDriveToNextStation() {
|
||||
if (BusLineModel.isLastStation()==true) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
endTask()
|
||||
abortTask()
|
||||
return
|
||||
}
|
||||
leaveStation()
|
||||
@@ -573,7 +563,7 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
sendTaskDetailsToClients()
|
||||
BusLineModel.sendTaskDetailsToClients()
|
||||
|
||||
//更新bus路线面板
|
||||
updateBusTaskStatus()
|
||||
@@ -660,22 +650,6 @@ object OrderModel {
|
||||
val isRestartAutopilot: Boolean
|
||||
get() = firstStartAutopilot > 1
|
||||
|
||||
/**
|
||||
* task正常结束
|
||||
*/
|
||||
private fun endTask() {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
|
||||
endOrAbortTaskSuccess()
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
// 取消自驾
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站
|
||||
*
|
||||
|
||||
@@ -23,53 +23,12 @@ import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerWriteOffRes
|
||||
*/
|
||||
object PassengerServiceManager {
|
||||
|
||||
private var driverSnCache = ""
|
||||
|
||||
private val TAG = "PassengerServiceManager"
|
||||
|
||||
private var mShuttleBusPassengerServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(
|
||||
ServiceApi::class.java)
|
||||
|
||||
/**
|
||||
* 查询绑定行驶的小巴车路线
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverSiteByCoordinate(
|
||||
context: Context, callback: OchCommonServiceCallback<PassengerRoutesResponse>?
|
||||
) {
|
||||
mShuttleBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
PassengerQueryLineRequest(
|
||||
LoginLanPassengerSocket.driverSn
|
||||
)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate",false))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机端出车收车状态,以及车牌号
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverOperationStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<PassengerOperationStatusResponse>?
|
||||
) {
|
||||
mShuttleBusPassengerServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
LoginLanPassengerSocket.driverSn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机端出车收车状态,以及车牌号
|
||||
* @param context
|
||||
|
||||
@@ -20,23 +20,6 @@ import retrofit2.http.Query;
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
public interface ServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/och-shuttle-cabin/api/business/v1/passenger/lineDataWithDriver/query" )
|
||||
Observable<PassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body PassengerQueryLineRequest request);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
|
||||
@GET("/och-shuttle-cabin/api/business/v1/passenger/loginStatus")
|
||||
Observable<PassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 核销接口
|
||||
|
||||
@@ -1,496 +1,311 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.model;
|
||||
package com.mogo.och.shuttle.weaknet.passenger.model
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
import static com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst.QUERY_BUS_P_STATION_DELAY;
|
||||
import static com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst.STATION_STATUS_STOPPED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener;
|
||||
import com.mogo.commons.module.intent.IntentManager;
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener;
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.R;
|
||||
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.bean.DPMsgType;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager;
|
||||
import com.mogo.och.common.module.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.manager.distance.IDistanceListener;
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
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.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerOperationStatusResponse;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerRoutesResponse;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassegerDriverStatusCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerControllerStatusCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerRouteLineInfoCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.network.BusPassengerModelLoopManager;
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusTransferData;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.network.PassengerServiceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
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.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
|
||||
import com.mogo.och.common.module.manager.distance.IDistanceListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager
|
||||
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.AppConnectMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
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.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassegerDriverStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerADASStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerAutopilotPlanningCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerRouteLineInfoCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BusPassengerModel {
|
||||
private static final String TAG = BusPassengerModel.class.getSimpleName();
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerModel INSTANCE = new BusPassengerModel();
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object BusPassengerModel {
|
||||
private val TAG: String = BusPassengerModel::class.java.simpleName
|
||||
private var mContext: Context? = null
|
||||
private var mADASStatusCallback: IBusPassengerADASStatusCallback? = null //Model->Presenter:自动驾驶状态相关
|
||||
private var mAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback? = null //Model->Presenter:自动驾驶线路规划
|
||||
private val mControllerStatusCallbackMap: MutableMap<String, IBusPassengerControllerStatusCallback> = ConcurrentHashMap()
|
||||
|
||||
private var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null //出车收车状态
|
||||
private var mRouteLineInfoCallback: IBusPassengerRouteLineInfoCallback? = null // bus路线信息更新
|
||||
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
|
||||
var mStations: MutableList<BusStationBean> = ArrayList()
|
||||
private var mNextStationIndex = 0 // 要到达站的index
|
||||
|
||||
@Volatile
|
||||
private var isGoingToNextStation = false
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context.applicationContext
|
||||
initListeners()
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
public static BusPassengerModel getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
private IBusPassengerADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关
|
||||
private IBusPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter:自动驾驶线路规划
|
||||
private Map<String, IBusPassengerControllerStatusCallback> mControllerStatusCallbackMap = new ConcurrentHashMap<>();
|
||||
|
||||
private IBusPassegerDriverStatusCallback mDriverStatusCallback; //出车收车状态
|
||||
private IBusPassengerRouteLineInfoCallback mRouteLineInfoCallback; // bus路线信息更新
|
||||
|
||||
private BusRoutesResult routesResult = null;
|
||||
|
||||
List<BusStationBean> mStations = new ArrayList<>();
|
||||
private int mNextStationIndex = 0;// 要到达站的index
|
||||
|
||||
private volatile boolean isGoingToNextStation = false;
|
||||
|
||||
private static final int MSG_QUERY_BUS_P_STATION = 1001;
|
||||
private final Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if ( msg.what == MSG_QUERY_BUS_P_STATION ) {
|
||||
queryDriverOperationStatus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
private BusPassengerModel() {
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
mContext = context.getApplicationContext();
|
||||
initListeners();
|
||||
queryDriverOperationStatus();
|
||||
queryDriverByLocalDriver();
|
||||
startOrStopOrderLoop(true);
|
||||
}
|
||||
|
||||
private void queryDriverByLocalDriver() {
|
||||
private fun queryDriverByLocalDriver() {
|
||||
//本地去请求司机端
|
||||
TaskDetailsMsg msg = new TaskDetailsMsg("task", BusinessType.shuttle);
|
||||
|
||||
LanSocketManager.sendMsgToServer(msg);
|
||||
val msg = TaskDetailsMsg("task", BusinessType.shuttle)
|
||||
LanSocketManager.sendMsgToServer(msg)
|
||||
}
|
||||
|
||||
public void setDriverStatusCallback(IBusPassegerDriverStatusCallback callback){
|
||||
this.mDriverStatusCallback = callback;
|
||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
||||
this.mDriverStatusCallback = callback
|
||||
}
|
||||
|
||||
public void setRouteLineInfoCallback(IBusPassengerRouteLineInfoCallback callback){
|
||||
this.mRouteLineInfoCallback = callback;
|
||||
fun setRouteLineInfoCallback(callback: IBusPassengerRouteLineInfoCallback?) {
|
||||
this.mRouteLineInfoCallback = callback
|
||||
}
|
||||
|
||||
private void queryDriverOperationDelay() {
|
||||
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_P_STATION, QUERY_BUS_P_STATION_DELAY );
|
||||
fun setMoGoAutopilotPlanningListener(moGoAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback?) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback
|
||||
}
|
||||
|
||||
private void queryDriverOperationStatus() {
|
||||
PassengerServiceManager.queryDriverOperationStatus(mContext
|
||||
, new OchCommonServiceCallback<PassengerOperationStatusResponse>() {
|
||||
@Override
|
||||
public void onSuccess(PassengerOperationStatusResponse data) {
|
||||
if (data == null || data.data == null) return;
|
||||
if (mDriverStatusCallback != null) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverOperationStatus = %s", data.data.plateNumber );
|
||||
mDriverStatusCallback.changeOperationStatus(data.data.driverStatus == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
//延迟3s再次查询
|
||||
queryDriverOperationDelay();
|
||||
}
|
||||
});
|
||||
fun setADASStatusCallback(callback: IBusPassengerADASStatusCallback?) {
|
||||
this.mADASStatusCallback = callback
|
||||
}
|
||||
|
||||
public void queryDriverSiteByCoordinate(){
|
||||
PassengerServiceManager.queryDriverSiteByCoordinate(mContext
|
||||
, new OchCommonServiceCallback<PassengerRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(PassengerRoutesResponse data) {
|
||||
if ( data == null || data.getResult() == null) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = null");
|
||||
clearLocalRouteResult();
|
||||
return;
|
||||
}
|
||||
if (routesResult != null && data.getResult().equals(routesResult)){
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = not update");
|
||||
return;
|
||||
}
|
||||
|
||||
OchChainLogManager.writeChainLog("线路发生变化",data.toString());
|
||||
|
||||
if (routesResult != null &&
|
||||
routesResult.getWriteVersion() < data.getResult().getWriteVersion()){
|
||||
routesResult = data.getResult();
|
||||
}
|
||||
|
||||
if (routesResult == null){
|
||||
routesResult = data.getResult();
|
||||
}
|
||||
|
||||
updatePassengerRouteInfo(routesResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = onError ="
|
||||
+ ", sn = " + LoginLanPassengerSocket.INSTANCE.getDriverSn());
|
||||
queryDriverByLocalDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg
|
||||
+ ", sn = " +LoginLanPassengerSocket.INSTANCE.getDriverSn());
|
||||
if (code == 1003){
|
||||
queryDriverOperationDelay();
|
||||
}
|
||||
if (LoginLanPassengerSocket.INSTANCE.getDriverSn().isEmpty()){
|
||||
//此处拦截是为了防止过程中乘客屏和司机端断连,拿不到司机端sn, 造成请求失败去刷新了界面
|
||||
return;
|
||||
}
|
||||
if (code == 1003){
|
||||
routesResult = null;
|
||||
cleanStation("queryDriverSiteByCoordinate 1003");
|
||||
return;
|
||||
}
|
||||
queryDriverByLocalDriver();
|
||||
}
|
||||
});
|
||||
fun setControllerStatusCallback(
|
||||
tag: String?,
|
||||
callback: IBusPassengerControllerStatusCallback?
|
||||
) {
|
||||
if (tag == null || "" == tag) return
|
||||
if (callback == null) {
|
||||
mControllerStatusCallbackMap.remove(tag)
|
||||
return
|
||||
}
|
||||
mControllerStatusCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
private void clearLocalRouteResult() {
|
||||
|
||||
private fun clearLocalRouteResult() {
|
||||
if (routesResult != null) {
|
||||
routesResult = null;
|
||||
routesResult = null
|
||||
}
|
||||
mNextStationIndex = 0;
|
||||
cleanStation("queryDriverSiteByCoordinate");
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.showNoTaskView();
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
mRouteLineInfoCallback!!.showNoTaskView()
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePassengerRouteInfo(BusRoutesResult result) {
|
||||
if (result == null){
|
||||
clearLocalRouteResult();
|
||||
return;
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
||||
if (result == null) {
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = update");
|
||||
routesResult = result;
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = update")
|
||||
routesResult = result
|
||||
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.updateLineInfo(result.getName());
|
||||
mRouteLineInfoCallback.hideNoTaskView();
|
||||
if (result.getSites() != null){
|
||||
List<BusStationBean> stations = result.getSites();
|
||||
mStations.clear();
|
||||
mStations.addAll(stations);
|
||||
for (int i = 0; i< stations.size(); i++){
|
||||
BusStationBean station = stations.get(i);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){
|
||||
Logger.d(M_BUS_P + TAG, "order = station= leave");
|
||||
isGoingToNextStation = true;
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
|
||||
mNextStationIndex = i+1;
|
||||
BusStationBean startStation = mStations.get(i);
|
||||
BusStationBean endStation = mStations.get(i+1);
|
||||
setTrajectoryStation(startStation, endStation, result.getLineId());
|
||||
return;
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){
|
||||
if (i == stations.size() - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点");
|
||||
}
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
mRouteLineInfoCallback!!.updateLineInfo(result.name)
|
||||
mRouteLineInfoCallback!!.hideNoTaskView()
|
||||
if (result.sites != null) {
|
||||
val stations = result.sites
|
||||
mStations.clear()
|
||||
mStations.addAll(stations)
|
||||
for (i in stations.indices) {
|
||||
val station = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && station.isLeaving && i + 1 < stations.size) {
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "order = station= leave")
|
||||
isGoingToNextStation = true
|
||||
mRouteLineInfoCallback!!.updateStationsInfo(stations, i + 1, false)
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
|
||||
isGoingToNextStation = false;
|
||||
Logger.d(M_BUS_P + TAG, "order = station= arrive");
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
|
||||
return;
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
|
||||
mRouteLineInfoCallback!!.updateStationsInfo(stations, i, true)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void release() {
|
||||
releaseListeners();
|
||||
cleanStation("release");
|
||||
startOrStopOrderLoop(false);
|
||||
fun release() {
|
||||
releaseListeners()
|
||||
cleanStation("release")
|
||||
}
|
||||
|
||||
public void setMoGoAutopilotPlanningListener(IBusPassengerAutopilotPlanningCallback
|
||||
moGoAutopilotPlanningCallback) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback;
|
||||
}
|
||||
|
||||
public void setADASStatusCallback(IBusPassengerADASStatusCallback callback) {
|
||||
this.mADASStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setControllerStatusCallback(String tag, IBusPassengerControllerStatusCallback callback) {
|
||||
if (tag == null || "".equals(tag)) return;
|
||||
|
||||
if (callback == null) {
|
||||
mControllerStatusCallbackMap.remove(tag);
|
||||
return;
|
||||
}
|
||||
|
||||
mControllerStatusCallbackMap.put(tag,callback);
|
||||
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
|
||||
private fun initListeners() {
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
OchAutoPilotStatusListenerManager.INSTANCE.addListener(TAG,mGoAutopilotStatusListener);
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
// 定位监听
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3,mMapLocationListener);
|
||||
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3, mMapLocationListener)
|
||||
|
||||
//监听司机端消息
|
||||
CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener);
|
||||
// 通用监听
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type, commonListener)
|
||||
// 监听站点信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type, typeTaskDetails)
|
||||
|
||||
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
|
||||
TrajectoryAndDistanceManager.INSTANCE.addDistanceListener(TAG, trajectoryListener);
|
||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(mContext!!)
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
|
||||
private fun releaseListeners() {
|
||||
// 注销定位监听
|
||||
OchLocationManager.removeGCJ02Listener(TAG);
|
||||
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
.unregisterLifecycleListener(10010)
|
||||
|
||||
OchAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type, commonListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type, typeTaskDetails)
|
||||
|
||||
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
|
||||
|
||||
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
|
||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||
}
|
||||
|
||||
private final IDistanceListener trajectoryListener = new IDistanceListener() {
|
||||
@Override
|
||||
public void stationDistanceCallback(float distance) {
|
||||
private val commonListener = object : ILanMessageListener<AppConnectMsg> {
|
||||
override fun targetLan(): Class<AppConnectMsg> = AppConnectMsg::class.java
|
||||
|
||||
override fun onLanMsgReceived(first: AppConnectMsg?) {
|
||||
first?.let {
|
||||
if (it.isViewShow) { //消息盒子显示内容
|
||||
OCHSocketMessageManager.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(), it.msg,
|
||||
OCHSocketMessageManager.OPERATION_SYSTEM
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void distanceCallback(float distance) {
|
||||
double lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6; //秒
|
||||
CallerLogger.d(M_BUS_P + TAG, "轨迹排查==lastSumLength = "+distance);
|
||||
if(routesResult!=null){
|
||||
for (BusStationBean site : routesResult.getSites()) {
|
||||
if (site.getDrivingStatus() == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving()) {
|
||||
return;
|
||||
}
|
||||
|
||||
private val typeTaskDetails = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> = TaskDetailsMsg::class.java
|
||||
|
||||
override fun onLanMsgReceived(first: TaskDetailsMsg?) {
|
||||
first?.let {
|
||||
if (first.msg!!.isEmpty()) {
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(first.msg, BusTransferData::class.java)
|
||||
|
||||
if (result != null && result.routesResult == null){
|
||||
clearLocalRouteResult()
|
||||
}
|
||||
|
||||
mDriverStatusCallback?.changeOperationStatus(result!!.loginStatus == 1)
|
||||
if (result != null) { //已司机端传来的为准
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(SceneConstant.M_BUS_P + TAG, "轨迹排查==lastSumLength = $distance")
|
||||
if (routesResult != null) {
|
||||
for (site in routesResult!!.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
// 小于200m 播报站点介绍
|
||||
if(distance<200){
|
||||
BusStationBean stationNext = mStations.get(mNextStationIndex);
|
||||
if(!stationNext.isPlayTts()){
|
||||
if (!StringUtils.isEmpty(stationNext.getIntroduction())) {
|
||||
VoiceNotice.showNotice(stationNext.getIntroduction());
|
||||
stationNext.setPlayTts(true);
|
||||
if (distance < 200) {
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
if (!stationNext.isPlayTts) {
|
||||
if (!StringUtils.isEmpty(stationNext.introduction)) {
|
||||
showNotice(stationNext.introduction)
|
||||
stationNext.isPlayTts = true
|
||||
}
|
||||
}
|
||||
}
|
||||
mAutopilotPlanningCallback.routePlanningToNextStationChanged(
|
||||
(long)distance, (long)lastTime
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
private final IReceivedMsgListener mReceivedMsgListener = new IReceivedMsgListener() {
|
||||
@Override
|
||||
public void onDemoMode(boolean isDemoMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedServerSn(@Nullable String sn) {
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "司机屏sn:"+sn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
|
||||
BaseDPMsg baseMsg = GsonUtils.fromJson(new String(byteArray), BaseDPMsg.class);
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg));
|
||||
|
||||
if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_COMMON.getType()) {
|
||||
AppConnectMsg msg = GsonUtils.fromJson(new String(byteArray), AppConnectMsg.class);
|
||||
if (msg != null && msg.isViewShow()) { //消息盒子显示内容
|
||||
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(), msg.getMsg(),
|
||||
OCHSocketMessageManager.OPERATION_SYSTEM);
|
||||
}
|
||||
} else if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_TASK_DETAILS.getType()) {
|
||||
TaskDetailsMsg msg = GsonUtils.fromJson(new String(byteArray), TaskDetailsMsg.class);
|
||||
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg));
|
||||
if (msg == null || msg.getMsg().isEmpty()) {
|
||||
clearLocalRouteResult();
|
||||
return;
|
||||
}
|
||||
BusTransferData result = GsonUtils.fromJson(msg.getMsg(), BusTransferData.class);
|
||||
if (msg != null && mDriverStatusCallback != null) {
|
||||
mDriverStatusCallback.changeOperationStatus(result.getLoginStatus() == 1);
|
||||
}
|
||||
if (result != null) { //已司机端传来的为准
|
||||
routesResult = result.getRoutesResult();
|
||||
updatePassengerRouteInfo(routesResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "onIntentReceived = %s", intentStr );
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
queryDriverOperationStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoChassisLocationGCJ02Listener mMapLocationListener = new IMoGoChassisLocationGCJ02Listener() {
|
||||
@Override
|
||||
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
|
||||
if (null == gnssInfo) return;
|
||||
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
callback.onCarLocationChanged(gnssInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final IOchAutopilotStatusListener mGoAutopilotStatusListener = new IOchAutopilotStatusListener(){
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
//2022.7.20 自动驾驶更换成带档位的
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
} else{
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size() - 1
|
||||
&& isGoingToNextStation){
|
||||
Logger.d(M_BUS_P + TAG, "FunctionBuildConfig.isDemoMode is true");
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void startOrStopOrderLoop(boolean start) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "startOrStopOrderLoop() " + start);
|
||||
if (start) {
|
||||
BusPassengerModelLoopManager.getInstance().startQueryDriverLineLoop();
|
||||
} else {
|
||||
BusPassengerModelLoopManager.getInstance().stopQueryDriverLineLoop();
|
||||
mAutopilotPlanningCallback!!.routePlanningToNextStationChanged(
|
||||
distance.toLong(), lastTime.toLong()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private void setTrajectoryStation(
|
||||
BusStationBean startStationInfo ,
|
||||
BusStationBean endStationInfo,
|
||||
int lineId
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
for (callback in mControllerStatusCallbackMap.values) {
|
||||
callback.onCarLocationChanged(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mGoAutopilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
//2022.7.20 自动驾驶更换成带档位的
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
|
||||
} else {
|
||||
if (FunctionBuildConfig.isDemoMode && mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1 && isGoingToNextStation) {
|
||||
Logger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"FunctionBuildConfig.isDemoMode is true"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotEnable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotDisable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
MogoLocation startStation = new MogoLocation();
|
||||
startStation.setLongitude(startStationInfo.getGcjLon());
|
||||
startStation.setLatitude(startStationInfo.getGcjLat());
|
||||
MogoLocation endStation = new MogoLocation();
|
||||
endStation.setLongitude(endStationInfo.getGcjLon());
|
||||
endStation.setLatitude(endStationInfo.getGcjLat());
|
||||
TrajectoryAndDistanceManager.INSTANCE.setStationPoint(startStation, endStation, (long)lineId);
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = startStationInfo.gcjLon
|
||||
startStation.latitude = startStationInfo.gcjLat
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = endStationInfo.gcjLon
|
||||
endStation.latitude = endStationInfo.gcjLat
|
||||
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
|
||||
}
|
||||
|
||||
private void cleanStation(String type) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "清理站点:"+type);
|
||||
TrajectoryAndDistanceManager.INSTANCE.setStationPoint(null, null, -1L);
|
||||
private fun cleanStation(type: String) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.network;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.BusPassengerModel;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
import static com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst.LOOP_DELAY;
|
||||
import static com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst.LOOP_LINE_2S;
|
||||
|
||||
/**
|
||||
* Created on 2021/11/22
|
||||
*
|
||||
* 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等)
|
||||
*/
|
||||
public class BusPassengerModelLoopManager {
|
||||
|
||||
private static final String TAG = BusPassengerModelLoopManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerModelLoopManager INSTANCE = new BusPassengerModelLoopManager();
|
||||
}
|
||||
|
||||
public static BusPassengerModelLoopManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Disposable mQueryLineDisposable; //心跳轮询
|
||||
|
||||
public void startQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null && !mQueryLineDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.i(M_BUS_P + TAG, "startQueryDriverLineLoop()");
|
||||
mQueryLineDisposable = Observable.interval(LOOP_DELAY,
|
||||
LOOP_LINE_2S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> BusPassengerModel.getInstance().queryDriverSiteByCoordinate());
|
||||
}
|
||||
|
||||
public void stopQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null) {
|
||||
CallerLogger.i(M_BUS_P + TAG, "stopQueryDriverLineLoop()");
|
||||
mQueryLineDisposable.dispose();
|
||||
mQueryLineDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,190 +1,151 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.presenter;
|
||||
package com.mogo.och.shuttle.weaknet.passenger.presenter
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassegerDriverStatusCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerControllerStatusCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerRouteLineInfoCallback;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.BusPassengerModel;
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPassengerRouteFragment;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassegerDriverStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerADASStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerAutopilotPlanningCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.IBusPassengerRouteLineInfoCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.BusPassengerModel
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPassengerRouteFragment
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragment> implements
|
||||
IBusPassengerADASStatusCallback, IBusPassengerControllerStatusCallback, IBusPassegerDriverStatusCallback, IBusPassengerRouteLineInfoCallback, IBusPassengerAutopilotPlanningCallback {
|
||||
private static final String TAG = BaseBusPassengerPresenter.class.getSimpleName();
|
||||
class BaseBusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
Presenter<BusPassengerRouteFragment?>(view), IBusPassengerADASStatusCallback,
|
||||
IBusPassengerControllerStatusCallback, IBusPassegerDriverStatusCallback,
|
||||
IBusPassengerRouteLineInfoCallback, IBusPassengerAutopilotPlanningCallback {
|
||||
|
||||
public BaseBusPassengerPresenter(BusPassengerRouteFragment view) {
|
||||
super(view);
|
||||
BusPassengerModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
private val TAG: String = BaseBusPassengerPresenter::class.java.simpleName
|
||||
init {
|
||||
BusPassengerModel.init(AbsMogoApplication.getApp())
|
||||
initListeners()
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
CallerLogger.d(M_BUS_P + TAG, "Bus乘客端Presenter onCreate()");
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
d(SceneConstant.M_BUS_P + TAG, "Bus乘客端Presenter onCreate()")
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
|
||||
releaseListeners();
|
||||
BusPassengerModel.getInstance().release();
|
||||
releaseListeners()
|
||||
BusPassengerModel.release()
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
BusPassengerModel.getInstance().setADASStatusCallback(this);
|
||||
BusPassengerModel.getInstance().setControllerStatusCallback(TAG, this);
|
||||
BusPassengerModel.getInstance().setDriverStatusCallback(this);
|
||||
BusPassengerModel.getInstance().setRouteLineInfoCallback(this);
|
||||
BusPassengerModel.getInstance().setMoGoAutopilotPlanningListener(this);
|
||||
private fun initListeners() {
|
||||
BusPassengerModel.setADASStatusCallback(this)
|
||||
BusPassengerModel.setControllerStatusCallback(TAG, this)
|
||||
BusPassengerModel.setDriverStatusCallback(this)
|
||||
BusPassengerModel.setRouteLineInfoCallback(this)
|
||||
BusPassengerModel.setMoGoAutopilotPlanningListener(this)
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
BusPassengerModel.getInstance().setADASStatusCallback(null);
|
||||
BusPassengerModel.getInstance().setControllerStatusCallback(TAG, null);
|
||||
BusPassengerModel.getInstance().setDriverStatusCallback(null);
|
||||
BusPassengerModel.getInstance().setRouteLineInfoCallback(null);
|
||||
BusPassengerModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
private fun releaseListeners() {
|
||||
BusPassengerModel.setADASStatusCallback(null)
|
||||
BusPassengerModel.setControllerStatusCallback(TAG, null)
|
||||
BusPassengerModel.setDriverStatusCallback(null)
|
||||
BusPassengerModel.setRouteLineInfoCallback(null)
|
||||
BusPassengerModel.setMoGoAutopilotPlanningListener(null)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE);
|
||||
}
|
||||
override fun onAutopilotEnable() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
|
||||
)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE);
|
||||
}
|
||||
override fun onAutopilotDisable() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
}
|
||||
override fun onAutopilotRunning() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (location != null && mView != null) {
|
||||
mView.onCarLocationChanged(location);
|
||||
}
|
||||
override fun onCarLocationChanged(location: MogoLocation) {
|
||||
UiThreadHandler.post({
|
||||
if (location != null && mView != null) {
|
||||
mView!!.onCarLocationChanged(location)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeOperationStatus(boolean changeStatus) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.changeOperationStatus(changeStatus);
|
||||
}
|
||||
override fun changeOperationStatus(changeStatus: Boolean) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.changeOperationStatus(changeStatus)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLineInfo(String lineName) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.updateLineInfo(lineName);
|
||||
}
|
||||
override fun updateLineInfo(lineName: String) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.updateLineInfo(lineName)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.updateStationsInfo(stations, currentStationIndex, isArrived);
|
||||
}
|
||||
override fun updateStationsInfo(
|
||||
stations: List<BusStationBean>,
|
||||
currentStationIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.updateStationsInfo(stations, currentStationIndex, isArrived)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNoTaskView() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.showNoTaskView();
|
||||
}
|
||||
override fun showNoTaskView() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.showNoTaskView()
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideNoTaskView() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.hideNoTaskView();
|
||||
}
|
||||
override fun hideNoTaskView() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.hideNoTaskView()
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routePlanningToNextStationChanged(long meters, long timeInSecond) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mView != null) {
|
||||
mView.updateRoutePlanningToNextStation(meters, timeInSecond);
|
||||
}
|
||||
override fun routePlanningToNextStationChanged(meters: Long, timeInSecond: Long) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.updateRoutePlanningToNextStation(meters, timeInSecond)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,8 @@ import com.mogo.och.data.bean.BusStationBean
|
||||
interface DrivingInfoCallback {
|
||||
fun updateSpeed(speed: Int)
|
||||
fun updatePlateNumber(carNum: String)
|
||||
fun updateLine(lineName: String, lineDuring: String)
|
||||
fun updateLine(lineName: String)
|
||||
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
|
||||
fun changeOperationStatus(loginStatus : Boolean)
|
||||
fun showNoTaskView(isTrue : Boolean)
|
||||
fun updateLineStations(stations: MutableList<BusStationBean>)
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean)
|
||||
|
||||
@@ -1,75 +1,46 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
import android.net.ConnectivityManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
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.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.pushAppOperationalMsgBox
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.distance.IDistanceListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
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.lan.ILanMessageListener
|
||||
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.manager.socket.lan.bean.BaseDPMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
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.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
||||
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerOperationStatusResponse
|
||||
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerRoutesResponse
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.AutoPilotStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.DrivingInfoCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.shuttle.weaknet.passenger.network.PassengerServiceManager
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/1/31
|
||||
*/
|
||||
class PM2DrivingModel private constructor() {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object PM2DrivingModel{
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
|
||||
private val TAG: String = PM2DrivingModel::class.java.simpleName
|
||||
|
||||
var mStations = mutableListOf<BusStationBean>()
|
||||
private var mNextStationIndex = 0 // A-B要到达站的index
|
||||
@@ -78,30 +49,10 @@ class PM2DrivingModel private constructor() {
|
||||
private var mDrivingInfoCallback: DrivingInfoCallback? = null //行程信息
|
||||
private var mAutoStatusCallback: AutoPilotStatusCallback? = null //自动驾驶状态
|
||||
|
||||
private var operationStatus: PassengerOperationStatusResponse.Result? = null
|
||||
|
||||
private val handler = Handler(Handler.Callback { msg ->
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
queryDriverOperationStatus()
|
||||
return@Callback true
|
||||
}
|
||||
false
|
||||
})
|
||||
|
||||
companion object {
|
||||
val TAG = PM2DrivingModel::class.java.simpleName
|
||||
const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
val INSTANCE: PM2DrivingModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
PM2DrivingModel()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
initListener()
|
||||
queryDriverByLocalDriver()
|
||||
queryDriverOperationStatus()
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(2,::queryDriverSiteByCoordinate, scheduler = Schedulers.io()))
|
||||
}
|
||||
|
||||
private fun queryDriverByLocalDriver() {
|
||||
@@ -116,15 +67,12 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
// 定位监听
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3, mMapLocationListener)
|
||||
|
||||
//司乘屏通信监听
|
||||
CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener)
|
||||
|
||||
//网络监听
|
||||
IntentManager.getInstance()
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
|
||||
// 监听站点距离
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
// 通用监听
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
||||
// 监听站点信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,typeTaskDetails)
|
||||
|
||||
}
|
||||
|
||||
@@ -134,13 +82,14 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
// 定位监听
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
|
||||
// 监听站点距离
|
||||
cleanStation("release")
|
||||
|
||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,typeTaskDetails)
|
||||
|
||||
}
|
||||
|
||||
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){
|
||||
@@ -151,60 +100,30 @@ class PM2DrivingModel private constructor() {
|
||||
mAutoStatusCallback = autoPilotStatusCallback
|
||||
}
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mReceivedMsgListener: IReceivedMsgListener =
|
||||
object : IReceivedMsgListener{
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息
|
||||
if (OchCommonConst.BUSINESS_STRING == type){
|
||||
val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
|
||||
Logger.d(
|
||||
SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg)
|
||||
)
|
||||
|
||||
if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), AppConnectMsg::class.java)
|
||||
|
||||
if (msg != null && msg.isPlay){ //播报
|
||||
speakTTS(msg.msg)
|
||||
}
|
||||
|
||||
if (msg != null && msg.isViewShow) { //消息盒子显示内容
|
||||
pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),msg.msg)
|
||||
}
|
||||
}else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), TaskDetailsMsg::class.java)
|
||||
Logger.d(
|
||||
SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg)
|
||||
)
|
||||
if (msg == null || msg.msg?.isEmpty() == true) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(msg.msg, BusTransferData::class.java)
|
||||
mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1)
|
||||
if (result != null && result.routesResult == null){
|
||||
updateLocalOrder()
|
||||
}
|
||||
|
||||
if (routesResult == null ||
|
||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)) {
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult!!)
|
||||
}
|
||||
|
||||
}
|
||||
private val typeTaskDetails = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> {
|
||||
return TaskDetailsMsg::class.java
|
||||
}
|
||||
|
||||
override fun onLanMsgReceived(first: TaskDetailsMsg?) {
|
||||
first?.let {
|
||||
|
||||
if (first.msg?.isEmpty() == true) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(first.msg, BusTransferData::class.java)
|
||||
if (result != null && result.routesResult == null){
|
||||
updateLocalOrder()
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
@@ -234,35 +153,6 @@ class PM2DrivingModel private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun speakTTS(msg: String) {
|
||||
|
||||
val mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
val mAudioAttributes = AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型
|
||||
.build()
|
||||
val mAudioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型
|
||||
.setAudioAttributes(mAudioAttributes) //设置声音属性
|
||||
.setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取
|
||||
.build()
|
||||
mAudioManager.requestAudioFocus(mAudioFocusRequest) //抢占焦点
|
||||
|
||||
VoiceNotice.speakTTSVoiceWithLevel(msg,AIAssist.LEVEL0,object : IMogoVoiceCmdCallBack{
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakError(speakText: String?, errorMsg: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener{
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
@@ -300,105 +190,6 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
}
|
||||
|
||||
private fun queryDriverOperationDelay() {
|
||||
handler.sendEmptyMessageDelayed(
|
||||
MSG_QUERY_BUS_P_STATION,
|
||||
BusPassengerConst.QUERY_BUS_P_STATION_DELAY
|
||||
)
|
||||
}
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
mContext?.let {
|
||||
PassengerServiceManager.queryDriverOperationStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<PassengerOperationStatusResponse> {
|
||||
override fun onSuccess(data: PassengerOperationStatusResponse?) {
|
||||
if (data?.data == null) return
|
||||
if (data.data.driverStatus != operationStatus?.driverStatus
|
||||
|| data.data.plateNumber != operationStatus?.plateNumber){
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverOperationStatus ===== 车牌或者登陆状态有变更")
|
||||
mDrivingInfoCallback?.changeOperationStatus(data.data.driverStatus == 1)
|
||||
}
|
||||
operationStatus = data.data as PassengerOperationStatusResponse.Result
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
//延迟3s再次查询
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun queryDriverSiteByCoordinate(){
|
||||
mContext?.let {
|
||||
PassengerServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PassengerRoutesResponse> {
|
||||
override fun onSuccess(data: PassengerRoutesResponse?) {
|
||||
|
||||
if (data == null || data.result == null){
|
||||
if (routesResult != null) {
|
||||
routesResult = null
|
||||
updateLocalOrder()
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= result is null")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
if (data.result != null && data.result.equals(routesResult)){
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= not update")
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null &&
|
||||
routesResult!!.writeVersion < data.result.writeVersion
|
||||
) {
|
||||
routesResult = data.result
|
||||
}
|
||||
|
||||
if (routesResult == null) {
|
||||
routesResult = data.result
|
||||
}
|
||||
updatePassengerRouteInfo(data.result)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
CallerLogger.d(
|
||||
SceneConstant.Companion.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate = onError ="
|
||||
+ ", sn = " + LoginLanPassengerSocket.driverSn
|
||||
)
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
if (code == 1003){
|
||||
queryDriverOperationDelay()
|
||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
||||
}
|
||||
if (LoginLanPassengerSocket.driverSn.isEmpty()){
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
routesResult = null
|
||||
isGoingToNextStation = false
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLocalOrder(){
|
||||
routesResult = null
|
||||
@@ -409,12 +200,6 @@ class PM2DrivingModel private constructor() {
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult) {
|
||||
|
||||
if (result == null) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId){
|
||||
d(SceneConstant.M_BUS_P+ TAG, "lineId change= clearCustomPolyline")
|
||||
mDrivingInfoCallback?.clearCustomPolyline()
|
||||
@@ -423,7 +208,7 @@ class PM2DrivingModel private constructor() {
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= update")
|
||||
routesResult = result
|
||||
|
||||
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
|
||||
mDrivingInfoCallback?.updateLine(result.name)
|
||||
if (result.sites != null) {
|
||||
mDrivingInfoCallback?.showNoTaskView(false)
|
||||
val stations: List<BusStationBean> = result.sites
|
||||
|
||||
@@ -15,7 +15,7 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
Presenter<PM2DrivingInfoFragment?>(view), DrivingInfoCallback, AutoPilotStatusCallback {
|
||||
|
||||
init {
|
||||
PM2DrivingModel.INSTANCE.init(context)
|
||||
PM2DrivingModel.init(context)
|
||||
PM2ADASModel.INSTANCE.init(context)
|
||||
initListener()
|
||||
}
|
||||
@@ -23,17 +23,17 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
destroyListener()
|
||||
PM2DrivingModel.INSTANCE.releaseListener()
|
||||
PM2DrivingModel.releaseListener()
|
||||
}
|
||||
|
||||
private fun initListener(){
|
||||
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(this)
|
||||
PM2DrivingModel.INSTANCE.setAutoStatusCallback(this)
|
||||
PM2DrivingModel.setDrivingInfoCallback(this)
|
||||
PM2DrivingModel.setAutoStatusCallback(this)
|
||||
}
|
||||
|
||||
private fun destroyListener(){
|
||||
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(null)
|
||||
PM2DrivingModel.INSTANCE.setAutoStatusCallback(null)
|
||||
PM2DrivingModel.setDrivingInfoCallback(null)
|
||||
PM2DrivingModel.setAutoStatusCallback(null)
|
||||
}
|
||||
|
||||
override fun updateSpeed(speed: Int) {
|
||||
@@ -51,10 +51,9 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLine(lineName: String, lineDuring: String) {
|
||||
override fun updateLine(lineName: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateTaskName(lineName)
|
||||
mView?.updateTaskDuringTime(lineDuring)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +63,6 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeOperationStatus(loginStatus: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.changeOperationStatus(loginStatus)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showNoTaskView(isTrue: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.showNoTaskView(!isTrue)
|
||||
|
||||
@@ -21,7 +21,6 @@ import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.clg_dis
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.group_not_select_line
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.group_stationinfo
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.iv_animal_list
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.line_during_tv
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.line_name_tv
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.overMapView
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.speed_tv
|
||||
@@ -144,10 +143,6 @@ class PM2DrivingInfoFragment :
|
||||
line_name_tv.text = name
|
||||
}
|
||||
|
||||
fun updateTaskDuringTime(time : String){
|
||||
line_during_tv.text = time
|
||||
}
|
||||
|
||||
fun changeOperationStatus(status:Boolean){
|
||||
if (!status){
|
||||
updateNoOrderUI()
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_p_speed_tv" />
|
||||
|
||||
|
||||
<com.mogo.och.shuttle.passenger.ui.widget.BusPTurnLightView
|
||||
<com.mogo.och.shuttle.weaknet.passenger.ui.widget.BusPTurnLightView
|
||||
android:layout_width="@dimen/dp_104"
|
||||
android:layout_height="@dimen/dp_58"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
android:layout_marginStart="@dimen/dp_40" />
|
||||
|
||||
<!--魔方连接状态 蓝牙-->
|
||||
<com.mogo.och.shuttle.passenger.ui.BusPBlueToothView
|
||||
<com.mogo.och.shuttle.weaknet.passenger.ui.BusPBlueToothView
|
||||
android:id="@+id/blueToothView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -43,7 +43,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40" />
|
||||
|
||||
<com.mogo.och.shuttle.passenger.manager.scnner.ScannerStateView
|
||||
<com.mogo.och.common.module.manager.scnner.ScannerStateView
|
||||
android:id="@+id/scannerStateView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -307,17 +307,6 @@
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/auto_tv" />-->
|
||||
|
||||
<!-- 被删除的 -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/line_during_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:textColor="@color/shuttle_p_m2_line_during_tv_color"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/line_name_tv"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line_name_tv" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_split"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
|
||||
Reference in New Issue
Block a user