[6.8.0]
[fea] [bus shuttle code]
This commit is contained in:
@@ -13,7 +13,7 @@ import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
|
||||
import com.mogo.och.common.module.wigets.media.MediaPlayerActivity
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.TicketModel
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPStatusBarView
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.widget.BusPStatusBarView
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPassengerRouteFragment
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.PM2BaseFragment
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.widget.M2StatusBarView
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback;
|
||||
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/6
|
||||
*/
|
||||
public interface ICommonCallback {
|
||||
void updateLineInfo(String lineName);
|
||||
void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived);
|
||||
void updateSpeed(int location);
|
||||
void updateRemainMT(long meters, long timeInSecond);
|
||||
void showNoTaskView(boolean isTrue);
|
||||
|
||||
/**
|
||||
* false: 未开启自驾, true : 开启自驾
|
||||
*/
|
||||
void updateAutoStatus(boolean isOpen);
|
||||
|
||||
default void updateLineStations(List<BusStationBean> stations){}
|
||||
|
||||
default void clearCustomPolyline(){}
|
||||
|
||||
}
|
||||
@@ -1,26 +1,120 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
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.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
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.StringUtils
|
||||
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.biz.media.MediaManager
|
||||
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.download.DownloadManager
|
||||
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.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.common.module.wigets.media.MediaItem
|
||||
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.bean.response.ResponseSiteIntroduce
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.shuttle.weaknet.passenger.network.PassengerServiceManager
|
||||
import kotlin.math.abs
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object CommonModel {
|
||||
|
||||
private val TAG: String = CommonModel::class.java.simpleName
|
||||
|
||||
var mContext: Context? = null
|
||||
|
||||
|
||||
private var mCommonCallback: ICommonCallback? = null // bus路线信息更新
|
||||
|
||||
var mStations = mutableListOf<BusStationBean>()
|
||||
var mNextStationIndex = 0 // A-B要到达站的index
|
||||
@Volatile
|
||||
var isGoingToNextStation = false //是否前往下一站过程中
|
||||
|
||||
var routesResult: BusRoutesResult? = null
|
||||
|
||||
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context.applicationContext
|
||||
initListeners()
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
|
||||
private fun initListeners() {
|
||||
//自动驾驶状态监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
|
||||
// 定位监听
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3, mMapLocationListener)
|
||||
// 监听站点距离
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
// 通用监听
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type, LanSocketManager.commonListener)
|
||||
// 监听站点信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type, typeTaskDetails)
|
||||
// 注册监听和司机屏连接情况
|
||||
LoginLanPassengerSocket.addListener(TAG, connectDriverListener)
|
||||
}
|
||||
|
||||
fun releaseListeners() {
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// 定位监听
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
// 监听站点距离
|
||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type, LanSocketManager.commonListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type, typeTaskDetails)
|
||||
LoginLanPassengerSocket.removeListener(TAG)
|
||||
cleanStation("release")
|
||||
}
|
||||
|
||||
|
||||
fun setRouteLineInfoCallback(callback: ICommonCallback?) {
|
||||
this.mCommonCallback = callback
|
||||
}
|
||||
|
||||
open class CommonModel {
|
||||
|
||||
val connectDriverListener = object : IOchLanPassengerStatusListener {
|
||||
// 和司机屏连接发生变化后
|
||||
override fun onDriverConnectChangeListener(isConnect: Boolean) {
|
||||
super.onDriverConnectChangeListener(isConnect)
|
||||
if(isConnect){
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
}
|
||||
|
||||
// 司机屏sn 发生变化后
|
||||
override fun onDriverSnChagneListner(sn: String?) {
|
||||
super.onDriverSnChagneListner(sn)
|
||||
sn?.let {
|
||||
@@ -29,12 +123,170 @@ open class CommonModel {
|
||||
}
|
||||
}
|
||||
|
||||
val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
updateSpeed(mogoLocation)
|
||||
}
|
||||
}
|
||||
|
||||
val mAutoPilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
d(SceneConstant.M_BUS_P, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation
|
||||
){
|
||||
mCommonCallback?.updateAutoStatus(true)
|
||||
}else{//非美化模式下
|
||||
mCommonCallback?.updateAutoStatus(false)
|
||||
}
|
||||
}else{//自驾状态 2
|
||||
mCommonCallback?.updateAutoStatus(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(SceneConstant.M_BUS_P, "轨迹排查==lastSumLength = $distance")
|
||||
if (routesResult != null) {
|
||||
for (site in routesResult!!.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
// 小于200m 播报站点介绍
|
||||
if (distance < 200) {
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
if (!stationNext.isPlayTts) {
|
||||
if (!StringUtils.isEmpty(stationNext.introduction)) {
|
||||
showNotice(stationNext.introduction)
|
||||
stationNext.isPlayTts = true
|
||||
}
|
||||
}
|
||||
}
|
||||
mCommonCallback?.updateRemainMT(
|
||||
distance.toLong(),
|
||||
lastTime.toLong()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(first.msg, BusTransferData::class.java)
|
||||
if (result != null && result.routesResult == null) {
|
||||
clearLocalRouteResult()
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val b1CommonListener = 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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun clearLocalRouteResult(){
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
isGoingToNextStation = false
|
||||
mCommonCallback?.showNoTaskView(true)
|
||||
}
|
||||
|
||||
|
||||
fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
||||
if (result == null) {
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "lineId change= clearCustomPolyline")
|
||||
mCommonCallback?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = update")
|
||||
routesResult = result
|
||||
|
||||
if (result.sites != null) {
|
||||
mCommonCallback?.updateLineInfo(result.name)
|
||||
mCommonCallback?.showNoTaskView(false)
|
||||
if (result.sites != null) {
|
||||
val stations = result.sites
|
||||
mStations.clear()
|
||||
mStations.addAll(stations)
|
||||
mCommonCallback?.updateLineStations(mStations)
|
||||
for (i in stations.indices) {
|
||||
val station = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED
|
||||
&& station.isLeaving && i + 1 < stations.size
|
||||
) {
|
||||
isGoingToNextStation = true
|
||||
mCommonCallback?.updateStationsInfo(stations, i + 1, false)
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
startStationVideo(endStation)
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
updateAutopilotControlParameters(result, i)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
|
||||
mCommonCallback?.updateStationsInfo(stations, i, true)
|
||||
clearAutopilotControlParameters()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 向司机屏请求业务数据
|
||||
fun queryDriverByLocalDriver() {
|
||||
//本地去请求司机端
|
||||
val msg = TaskDetailsMsg("task", BusinessType.shuttle)
|
||||
LanSocketManager.sendMsgToServer(msg)
|
||||
}
|
||||
|
||||
// 查询sn 所配置的所有站点介绍视频
|
||||
private fun querySiteIntroduce(){
|
||||
AbsMogoApplication.getApp()?.let {
|
||||
if (ProjectUtils.isSaas()) {
|
||||
@@ -54,7 +306,7 @@ open class CommonModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 去统一下载站点介绍
|
||||
private fun downloadSiteIntroduce(response: ResponseSiteIntroduce) {
|
||||
response.data?.forEach {siteIntroduceInfo ->
|
||||
siteIntroduceInfo.introduceList.forEach {introduceInfo ->
|
||||
@@ -63,5 +315,101 @@ open class CommonModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P, "AutopilotControlParameters is update.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
|
||||
fun initAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
): AutopilotControlParameters? {
|
||||
if (busRoutesResult.sites == null) {
|
||||
return null
|
||||
}
|
||||
val stations = busRoutesResult.sites
|
||||
if (leaveIndex + 1 > stations.size - 1) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
val currentStation = stations[leaveIndex]
|
||||
val nextStation = stations[leaveIndex + 1]
|
||||
val parameters = AutopilotControlParameters()
|
||||
parameters.routeID = busRoutesResult.lineId
|
||||
parameters.routeName = busRoutesResult.name
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name)
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name)
|
||||
parameters.startLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon)
|
||||
parameters.endLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon)
|
||||
parameters.vehicleType = 10
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
|
||||
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
|
||||
busRoutesResult.contrailSaveTimeDPQP
|
||||
)
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
fun clearAutopilotControlParameters() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P, "AutopilotControlParameters is clear.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
fun startStationVideo(startStationInfo: BusStationBean){
|
||||
val introductionList = mutableListOf<MediaItem>()
|
||||
startStationInfo.videoList?.forEach {
|
||||
if(it.type==1) {
|
||||
introductionList.add(
|
||||
MediaItem(
|
||||
MediaItem.PrioritySite, it.url,
|
||||
MediaItem.MEDIA_TYPE_VIDEO,"","")
|
||||
)
|
||||
}
|
||||
}
|
||||
MediaManager.postSiteIntroduceInfo(introductionList)
|
||||
}
|
||||
|
||||
fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
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())
|
||||
}
|
||||
|
||||
fun cleanStation(type: String) {
|
||||
d(SceneConstant.M_BUS_P, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
|
||||
fun updateSpeed(mogoLocation: MogoLocation) {
|
||||
// km/h
|
||||
val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt()
|
||||
|
||||
mCommonCallback?.updateSpeed(speedKM)
|
||||
}
|
||||
}
|
||||
@@ -1,346 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
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.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
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
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.biz.media.MediaManager
|
||||
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.lan.ILanMessageListener
|
||||
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.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.common.module.wigets.media.MediaItem
|
||||
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.AutoPilotStatusCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.DrivingInfoCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.constant.BusPassengerConst
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/1/31
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object LineModel:CommonModel(){
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
private val TAG: String = LineModel::class.java.simpleName
|
||||
|
||||
var mStations = mutableListOf<BusStationBean>()
|
||||
private var mNextStationIndex = 0 // A-B要到达站的index
|
||||
private var isGoingToNextStation = false //是否前往下一站过程中
|
||||
|
||||
private var mDrivingInfoCallback: DrivingInfoCallback? = null //行程信息
|
||||
private var mAutoStatusCallback: AutoPilotStatusCallback? = null //自动驾驶状态
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
initListener()
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun initListener() {
|
||||
//自动驾驶状态监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
|
||||
|
||||
// 定位监听
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3, mMapLocationListener)
|
||||
// 监听站点距离
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
// 通用监听
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
||||
// 监听站点信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,typeTaskDetails)
|
||||
|
||||
LoginLanPassengerSocket.addListener(TAG, connectDriverListener)
|
||||
|
||||
}
|
||||
|
||||
fun releaseListener() {
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
|
||||
// 定位监听
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
// 监听站点距离
|
||||
cleanStation("release")
|
||||
|
||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,typeTaskDetails)
|
||||
|
||||
LoginLanPassengerSocket.removeListener(TAG)
|
||||
|
||||
}
|
||||
|
||||
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){
|
||||
mDrivingInfoCallback = drivingInfoCallback
|
||||
}
|
||||
|
||||
fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?){
|
||||
mAutoStatusCallback = autoPilotStatusCallback
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
if (!stationNext.isPlayTts) {
|
||||
if (!StringUtils.isEmpty(stationNext.introduction)) {
|
||||
showNotice(stationNext.introduction)
|
||||
stationNext.isPlayTts = true
|
||||
}
|
||||
}
|
||||
}
|
||||
mDrivingInfoCallback?.updateRemainMT(
|
||||
distance.toLong(),
|
||||
lastTime.toLong()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener{
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
updateSpeed(mogoLocation)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSpeed(mogoLocation: MogoLocation) {
|
||||
// km/h
|
||||
val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt()
|
||||
|
||||
mDrivingInfoCallback?.updateSpeed(speedKM)
|
||||
}
|
||||
|
||||
private val mAutoPilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
d(SceneConstant.M_BUS_P+ TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation){
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}else{//非美化模式下
|
||||
mAutoStatusCallback?.updateAutoStatus(false)
|
||||
}
|
||||
}else{//自驾状态 2
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun updateLocalOrder(){
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
isGoingToNextStation = false
|
||||
mDrivingInfoCallback?.showNoTaskView(true)
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult) {
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId){
|
||||
d(SceneConstant.M_BUS_P+ TAG, "lineId change= clearCustomPolyline")
|
||||
mDrivingInfoCallback?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= update")
|
||||
routesResult = result
|
||||
|
||||
mDrivingInfoCallback?.updateLine(result.name)
|
||||
if (result.sites != null) {
|
||||
mDrivingInfoCallback?.showNoTaskView(false)
|
||||
val stations: List<BusStationBean> = result.sites
|
||||
mStations.clear()
|
||||
mStations.addAll(stations)
|
||||
mDrivingInfoCallback?.updateLineStations(mStations)
|
||||
for (i in stations.indices) {
|
||||
val station: BusStationBean = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED
|
||||
&& station.isLeaving && i + 1 < stations.size) {
|
||||
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<BusStationBean>, i + 1, false)
|
||||
d(SceneConstant.M_BUS_P+ TAG,"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i")
|
||||
d(SceneConstant.M_BUS_P+ TAG,"och-rotting--start ")
|
||||
isGoingToNextStation = true
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
startStationVideo(endStation)
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
updateAutopilotControlParameters(result,i)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
d(SceneConstant.M_BUS_P+ TAG,"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i")
|
||||
d(SceneConstant.M_BUS_P+ TAG,"och-rotting--arrived ")
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<BusStationBean>, i, true)
|
||||
clearAutopilotControlParameters()
|
||||
return
|
||||
}else{
|
||||
// d(SceneConstant.M_BUS_P+TAG,"och-rotting--BusStationBean = " + GsonUtils.toJson(station))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
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 fun startStationVideo(startStationInfo: BusStationBean){
|
||||
val introductionList = mutableListOf<MediaItem>()
|
||||
startStationInfo.videoList?.forEach {
|
||||
if(it.type==1) {
|
||||
introductionList.add(
|
||||
MediaItem(
|
||||
MediaItem.PrioritySite, it.url,
|
||||
MediaItem.MEDIA_TYPE_VIDEO,"","")
|
||||
)
|
||||
}
|
||||
}
|
||||
MediaManager.postSiteIntroduceInfo(introductionList)
|
||||
}
|
||||
|
||||
private fun cleanStation(type: String) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
private fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is update.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
): AutopilotControlParameters? {
|
||||
if (busRoutesResult.sites == null) {
|
||||
return null
|
||||
}
|
||||
val stations = busRoutesResult.sites
|
||||
if (leaveIndex + 1 > stations.size - 1) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
val currentStation = stations[leaveIndex]
|
||||
val nextStation = stations[leaveIndex + 1]
|
||||
val parameters = AutopilotControlParameters()
|
||||
parameters.routeID = busRoutesResult.lineId
|
||||
parameters.routeName = busRoutesResult.name
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name)
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name)
|
||||
parameters.startLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon)
|
||||
parameters.endLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon)
|
||||
parameters.vehicleType = 10
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
|
||||
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
|
||||
busRoutesResult.contrailSaveTimeDPQP
|
||||
)
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
|
||||
private fun clearAutopilotControlParameters() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is clear.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface IBusPassegerDriverStatusCallback {
|
||||
void changeOperationStatus(boolean changeStatus);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface IBusPassengerADASStatusCallback {
|
||||
|
||||
// 自动驾驶可用状态
|
||||
void onAutopilotEnable();
|
||||
|
||||
// 自动驾驶不可用状态
|
||||
void onAutopilotDisable();
|
||||
|
||||
// 自动驾驶运行中
|
||||
void onAutopilotRunning();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public interface IBusPassengerAutopilotPlanningCallback {
|
||||
void routePlanningToNextStationChanged(long meters, long timeInSecond);
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface IBusPassengerControllerStatusCallback {
|
||||
// 自车定位
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback;
|
||||
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/6
|
||||
*/
|
||||
public interface IBusPassengerRouteLineInfoCallback {
|
||||
void updateLineInfo(String lineName);
|
||||
void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived);
|
||||
void showNoTaskView();
|
||||
void hideNoTaskView();
|
||||
}
|
||||
@@ -1,390 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
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.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
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.StringUtils
|
||||
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.biz.media.MediaManager
|
||||
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.utils.PinYinUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.common.module.wigets.media.MediaItem
|
||||
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
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object BusPassengerModel :CommonModel(){
|
||||
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()
|
||||
}
|
||||
|
||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
||||
this.mDriverStatusCallback = callback
|
||||
}
|
||||
|
||||
fun setRouteLineInfoCallback(callback: IBusPassengerRouteLineInfoCallback?) {
|
||||
this.mRouteLineInfoCallback = callback
|
||||
}
|
||||
|
||||
fun setMoGoAutopilotPlanningListener(moGoAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback?) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback
|
||||
}
|
||||
|
||||
fun setADASStatusCallback(callback: IBusPassengerADASStatusCallback?) {
|
||||
this.mADASStatusCallback = callback
|
||||
}
|
||||
|
||||
fun setControllerStatusCallback(
|
||||
tag: String?,
|
||||
callback: IBusPassengerControllerStatusCallback?
|
||||
) {
|
||||
if (tag == null || "" == tag) return
|
||||
if (callback == null) {
|
||||
mControllerStatusCallbackMap.remove(tag)
|
||||
return
|
||||
}
|
||||
mControllerStatusCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
|
||||
private fun clearLocalRouteResult() {
|
||||
if (routesResult != null) {
|
||||
routesResult = null
|
||||
}
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
mRouteLineInfoCallback!!.showNoTaskView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
||||
if (result == null) {
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = update")
|
||||
routesResult = result
|
||||
|
||||
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]
|
||||
startStationVideo(endStation)
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
updateAutopilotControlParameters(result,i)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
|
||||
mRouteLineInfoCallback!!.updateStationsInfo(stations, i, true)
|
||||
clearAutopilotControlParameters()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun release() {
|
||||
releaseListeners()
|
||||
cleanStation("release")
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3, mMapLocationListener)
|
||||
|
||||
// 通用监听
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type, commonListener)
|
||||
// 监听站点信息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type, typeTaskDetails)
|
||||
|
||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(mContext!!)
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
|
||||
LoginLanPassengerSocket.addListener(TAG,connectDriverListener)
|
||||
}
|
||||
|
||||
private fun releaseListeners() {
|
||||
// 注销定位监听
|
||||
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010)
|
||||
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type, commonListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type, typeTaskDetails)
|
||||
|
||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||
LoginLanPassengerSocket.removeListener(TAG)
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
if (!stationNext.isPlayTts) {
|
||||
if (!StringUtils.isEmpty(stationNext.introduction)) {
|
||||
showNotice(stationNext.introduction)
|
||||
stationNext.isPlayTts = true
|
||||
}
|
||||
}
|
||||
}
|
||||
mAutopilotPlanningCallback!!.routePlanningToNextStationChanged(
|
||||
distance.toLong(), lastTime.toLong()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
) {
|
||||
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 fun startStationVideo(startStationInfo: BusStationBean){
|
||||
val introductionList = mutableListOf<MediaItem>()
|
||||
startStationInfo.videoList?.forEach {
|
||||
if(it.type==1) {
|
||||
introductionList.add(
|
||||
MediaItem(
|
||||
MediaItem.PrioritySite, it.url,
|
||||
MediaItem.MEDIA_TYPE_VIDEO,"","")
|
||||
)
|
||||
}
|
||||
}
|
||||
MediaManager.postSiteIntroduceInfo(introductionList)
|
||||
}
|
||||
|
||||
private fun cleanStation(type: String) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
private fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is update.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
): AutopilotControlParameters? {
|
||||
if (busRoutesResult.sites == null) {
|
||||
return null
|
||||
}
|
||||
val stations = busRoutesResult.sites
|
||||
if (leaveIndex + 1 > stations.size - 1) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
val currentStation = stations[leaveIndex]
|
||||
val nextStation = stations[leaveIndex + 1]
|
||||
val parameters = AutopilotControlParameters()
|
||||
parameters.routeID = busRoutesResult.lineId
|
||||
parameters.routeName = busRoutesResult.name
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name)
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name)
|
||||
parameters.startLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon)
|
||||
parameters.endLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon)
|
||||
parameters.vehicleType = 10
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
|
||||
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
|
||||
busRoutesResult.contrailSaveTimeDPQP
|
||||
)
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
|
||||
private fun clearAutopilotControlParameters() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is clear.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,31 +3,24 @@ package com.mogo.och.shuttle.weaknet.passenger.presenter
|
||||
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.common.module.manager.loop.BizLoopManager
|
||||
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.callback.ICommonCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPassengerRouteFragment
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
class BaseBusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
Presenter<BusPassengerRouteFragment?>(view), IBusPassengerADASStatusCallback,
|
||||
IBusPassengerControllerStatusCallback, IBusPassegerDriverStatusCallback,
|
||||
IBusPassengerRouteLineInfoCallback, IBusPassengerAutopilotPlanningCallback {
|
||||
Presenter<BusPassengerRouteFragment?>(view),
|
||||
ICommonCallback {
|
||||
|
||||
private val TAG: String = BaseBusPassengerPresenter::class.java.simpleName
|
||||
init {
|
||||
BusPassengerModel.init(AbsMogoApplication.getApp())
|
||||
CommonModel.init(AbsMogoApplication.getApp())
|
||||
initListeners()
|
||||
}
|
||||
|
||||
@@ -40,77 +33,27 @@ class BaseBusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
super.onDestroy(owner)
|
||||
|
||||
releaseListeners()
|
||||
BusPassengerModel.release()
|
||||
CommonModel.releaseListeners()
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
BusPassengerModel.setADASStatusCallback(this)
|
||||
BusPassengerModel.setControllerStatusCallback(TAG, this)
|
||||
BusPassengerModel.setDriverStatusCallback(this)
|
||||
BusPassengerModel.setRouteLineInfoCallback(this)
|
||||
BusPassengerModel.setMoGoAutopilotPlanningListener(this)
|
||||
CommonModel.setRouteLineInfoCallback(this)
|
||||
}
|
||||
|
||||
private fun releaseListeners() {
|
||||
BusPassengerModel.setADASStatusCallback(null)
|
||||
BusPassengerModel.setControllerStatusCallback(TAG, null)
|
||||
BusPassengerModel.setDriverStatusCallback(null)
|
||||
BusPassengerModel.setRouteLineInfoCallback(null)
|
||||
BusPassengerModel.setMoGoAutopilotPlanningListener(null)
|
||||
CommonModel.setRouteLineInfoCallback(null)
|
||||
}
|
||||
|
||||
override fun onAutopilotEnable() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
|
||||
)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onAutopilotDisable() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onAutopilotRunning() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onCarLocationChanged(location: MogoLocation) {
|
||||
UiThreadHandler.post({
|
||||
if (location != null && mView != null) {
|
||||
mView!!.onCarLocationChanged(location)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun changeOperationStatus(changeStatus: Boolean) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.changeOperationStatus(changeStatus)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
override fun updateSpeed(location: Int) {
|
||||
BizLoopManager.runInMainThread{
|
||||
mView?.onCarLocationChanged(location)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLineInfo(lineName: String) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.updateLineInfo(lineName)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
BizLoopManager.runInMainThread{
|
||||
mView?.updateLineInfo(lineName)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateStationsInfo(
|
||||
@@ -118,34 +61,30 @@ class BaseBusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
currentStationIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.updateStationsInfo(stations, currentStationIndex, isArrived)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
BizLoopManager.runInMainThread{
|
||||
mView?.updateStationsInfo(stations, currentStationIndex, isArrived)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showNoTaskView() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.showNoTaskView()
|
||||
override fun showNoTaskView(isShow:Boolean) {
|
||||
BizLoopManager.runInMainThread{
|
||||
if(isShow) {
|
||||
mView?.showNoTaskView()
|
||||
}else{
|
||||
mView?.hideNoTaskView()
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideNoTaskView() {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.hideNoTaskView()
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
override fun updateAutoStatus(isOpen: Boolean) {
|
||||
BizLoopManager.runInMainThread{
|
||||
mView?.onAutopilotStatusChanged(isOpen)
|
||||
}
|
||||
}
|
||||
|
||||
override fun routePlanningToNextStationChanged(meters: Long, timeInSecond: Long) {
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.updateRoutePlanningToNextStation(meters, timeInSecond)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
override fun updateRemainMT(meters: Long, timeInSecond: Long) {
|
||||
BizLoopManager.runInMainThread{
|
||||
mView?.updateRoutePlanningToNextStation(meters, timeInSecond)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +62,6 @@ public class BusPassengerRouteFragment extends
|
||||
private AppCompatTextView mCurrentArriveTip;
|
||||
private AppCompatImageView mSpeakArrivedIv;
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
private int mPrevAPStatus = -1;
|
||||
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.shuttle_p_weak_jl_route_fragment;
|
||||
@@ -179,18 +172,6 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
public void changeOperationStatus(boolean status) {
|
||||
if (!status) {
|
||||
emptyTv.setText(getString(R.string.shuttle_p_jl_no_out));
|
||||
mNoLineInfoView.setVisibility(View.VISIBLE);
|
||||
mRouteInfoView.setVisibility(View.GONE);
|
||||
mLineName.setText(getContext().getString(R.string.shuttle_p_jl_no_line));
|
||||
updateArrivedStation(null,0,true);
|
||||
clearMapView();
|
||||
clearMapMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
public void showNoTaskView(){
|
||||
if (mNoLineInfoView.getVisibility() == View.GONE){
|
||||
mNoLineInfoView.setVisibility(View.VISIBLE);
|
||||
@@ -279,13 +260,8 @@ public class BusPassengerRouteFragment extends
|
||||
// lastBearing = bearing;
|
||||
// }
|
||||
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
updateSpeedView((float) location.getGnssSpeed());
|
||||
}
|
||||
|
||||
public void updateSpeedView(float speed){
|
||||
int speedKM = (int) (Math.abs(speed) * 3.6F);
|
||||
mSpeedTv.setText(String.valueOf(speedKM));
|
||||
public void onCarLocationChanged(int location) {
|
||||
mSpeedTv.setText(String.valueOf(location));
|
||||
}
|
||||
|
||||
public void updateCurrentStation(int position) {
|
||||
@@ -355,21 +331,17 @@ public class BusPassengerRouteFragment extends
|
||||
mCurrentArriveTip.setText(Html.fromHtml(str));
|
||||
}
|
||||
|
||||
public void onAutopilotStatusChanged(int status) {
|
||||
public void onAutopilotStatusChanged(boolean isOpen) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 3. 其他过程直接更新
|
||||
if (mPrevAPStatus != status){
|
||||
AutopilotStatusChanged(status);
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
AutopilotStatusChanged(isOpen);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void AutopilotStatusChanged(int status) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
public void AutopilotStatusChanged(boolean isOpen) {
|
||||
if (isOpen) {
|
||||
mAutopilotIv.setImageResource(R.drawable.shuttle_p_jl_auto_open);
|
||||
} else {
|
||||
mAutopilotIv.setImageResource(R.drawable.shuttle_p_jl_auto_close);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.ui
|
||||
package com.mogo.och.shuttle.weaknet.passenger.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.ui
|
||||
package com.mogo.och.shuttle.weaknet.passenger.ui.widget
|
||||
|
||||
import android.annotation.*
|
||||
import android.content.Context
|
||||
@@ -11,11 +11,9 @@ import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
||||
import kotlinx.android.synthetic.main.shuttle_p_weak_jl_view_status_bar.view.tv_shuttle_b1_p_version
|
||||
import kotlinx.coroutines.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.ui
|
||||
package com.mogo.och.shuttle.weaknet.passenger.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/13
|
||||
*/
|
||||
interface AutoPilotStatusCallback {
|
||||
/**
|
||||
* false: 未开启自驾, true : 开启自驾
|
||||
*/
|
||||
fun updateAutoStatus(isOpen: Boolean)
|
||||
|
||||
fun updateAutoStatus(status: Int)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.och.shuttle.weaknet.passenger.callback
|
||||
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/2
|
||||
*/
|
||||
interface DrivingInfoCallback {
|
||||
fun updateSpeed(speed: Int)
|
||||
fun updatePlateNumber(carNum: String)
|
||||
fun updateLine(lineName: String)
|
||||
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
|
||||
fun showNoTaskView(isTrue : Boolean)
|
||||
fun updateLineStations(stations: MutableList<BusStationBean>)
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean)
|
||||
fun clearCustomPolyline()
|
||||
}
|
||||
@@ -4,18 +4,18 @@ import androidx.lifecycle.LifecycleOwner
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
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.model.PM2ADASModel
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.LineModel
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.PM2DrivingInfoFragment
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
||||
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
||||
|
||||
class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
Presenter<PM2DrivingInfoFragment?>(view), DrivingInfoCallback, AutoPilotStatusCallback {
|
||||
Presenter<PM2DrivingInfoFragment?>(view),
|
||||
ICommonCallback {
|
||||
|
||||
init {
|
||||
LineModel.init(context)
|
||||
CommonModel.init(context)
|
||||
PM2ADASModel.INSTANCE.init(context)
|
||||
initListener()
|
||||
}
|
||||
@@ -23,17 +23,15 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
destroyListener()
|
||||
LineModel.releaseListener()
|
||||
CommonModel.releaseListeners()
|
||||
}
|
||||
|
||||
private fun initListener(){
|
||||
LineModel.setDrivingInfoCallback(this)
|
||||
LineModel.setAutoStatusCallback(this)
|
||||
CommonModel.setRouteLineInfoCallback(this)
|
||||
}
|
||||
|
||||
private fun destroyListener(){
|
||||
LineModel.setDrivingInfoCallback(null)
|
||||
LineModel.setAutoStatusCallback(null)
|
||||
CommonModel.setRouteLineInfoCallback(null)
|
||||
}
|
||||
|
||||
override fun updateSpeed(speed: Int) {
|
||||
@@ -45,13 +43,7 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun updatePlateNumber(carNum: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateCarPlateNum(carNum)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLine(lineName: String) {
|
||||
override fun updateLineInfo(lineName: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateTaskName(lineName)
|
||||
}
|
||||
@@ -128,9 +120,5 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateAutoStatus(status: Int) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -28,23 +28,11 @@ class PM2BaseFragment :
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
//横竖屏
|
||||
// setScreenDirection()
|
||||
tv_shuttle_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
||||
//隐藏小地图
|
||||
initFragment()
|
||||
}
|
||||
|
||||
// private fun setScreenDirection() {
|
||||
// var ro = Settings.System.getInt(context?.contentResolver,
|
||||
// Settings.System.USER_ROTATION,Surface.ROTATION_270)
|
||||
// if (ro != Surface.ROTATION_270){
|
||||
// ro = Surface.ROTATION_270
|
||||
// }
|
||||
// Settings.System.putInt(context?.contentResolver,
|
||||
// Settings.System.USER_ROTATION,ro)
|
||||
// }
|
||||
|
||||
/**
|
||||
* 初始化行程信息,高静地图,宣传 三个fragment
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.och.shuttle.weaknet.passenger.R
|
||||
import com.mogo.och.shuttle.weaknet.passenger.presenter.PM2DrivingPresenter
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil.*
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.auto_tv
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_driving_info_fragment.clg_distance_left_time
|
||||
@@ -41,16 +42,24 @@ import kotlin.math.roundToInt
|
||||
class PM2DrivingInfoFragment :
|
||||
MvpFragment<PM2DrivingInfoFragment?, PM2DrivingPresenter?>() {
|
||||
|
||||
val stationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.shuttle_p_m2_map_staton_icon)
|
||||
val stationPassIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.shuttle_p_m2_map_staton_arrived_icon)
|
||||
val startStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.shuttle_p_m2_map_start_icon)
|
||||
val endStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.shuttle_p_m2_map_end_icon)
|
||||
private val stationIcon = BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.shuttle_p_m2_map_staton_icon
|
||||
)
|
||||
private val stationPassIcon = BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.shuttle_p_m2_map_staton_arrived_icon
|
||||
)
|
||||
private val startStationIcon = BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.shuttle_p_m2_map_start_icon
|
||||
)
|
||||
private val endStationIcon = BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.shuttle_p_m2_map_end_icon
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.shuttle_p_m2_driving_info_fragment
|
||||
}
|
||||
@@ -65,38 +74,14 @@ class PM2DrivingInfoFragment :
|
||||
true
|
||||
}
|
||||
|
||||
line_name_tv.setTextColor(resources.getColor(R.color.shuttle_p_m2_line_name_tv_color))
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.shuttle_p_m2_line_name_tv_color))
|
||||
line_name_tv.setTextColor(ResourcesUtils.getColor(R.color.shuttle_p_m2_line_name_tv_color))
|
||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.shuttle_p_m2_line_name_tv_color))
|
||||
speed_tv.setVertrial(true)
|
||||
val intArrayOf = intArrayOf(
|
||||
requireContext().resources.getColor(R.color.shuttle_p_m2_color_43cefe),
|
||||
requireContext().resources.getColor(R.color.shuttle_p_m2_color_1466fb)
|
||||
ResourcesUtils.getColor(R.color.shuttle_p_m2_color_43cefe),
|
||||
ResourcesUtils.getColor(R.color.shuttle_p_m2_color_1466fb),
|
||||
)
|
||||
speed_tv.setmColorList(intArrayOf)
|
||||
|
||||
// current_time_tv.onClick {
|
||||
|
||||
// //测试V2X消息
|
||||
// CallerMsgBoxManager.saveMsgBox(
|
||||
// MsgBoxBean(
|
||||
// MsgBoxType.V2X,
|
||||
// V2XMsg(
|
||||
// "6666",
|
||||
// "超速行驶",
|
||||
// ""
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
//
|
||||
// val noticeTrafficStylePushData = NoticeTrafficStylePushData()
|
||||
// noticeTrafficStylePushData.content= "测试公告布局"
|
||||
// val noticeFromCloudMsg = NoticeFrCloudMsg(null, noticeTrafficStylePushData, 1)
|
||||
// CallerMsgBoxManager.saveMsgBox(
|
||||
// MsgBoxBean(
|
||||
// MsgBoxType.NOTICE, noticeFromCloudMsg)
|
||||
// )
|
||||
// BPRouteDataTestUtils.converToRouteData()
|
||||
// }
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
@@ -111,50 +96,34 @@ class PM2DrivingInfoFragment :
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
overMapView?.let{
|
||||
it.onResume()
|
||||
}
|
||||
overMapView?.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
overMapView?.let{
|
||||
it.onPause()
|
||||
}
|
||||
overMapView?.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
overMapView?.onDestroy()
|
||||
if (mPresenter != null) {
|
||||
mPresenter?.onDestroy(this)
|
||||
}
|
||||
mPresenter?.onDestroy(this)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
fun updateSpeed(speed: Int){
|
||||
fun updateSpeed(speed: Int) {
|
||||
speed_tv.text = speed.toString()
|
||||
}
|
||||
|
||||
fun updateCarPlateNum(plateNum : String){
|
||||
|
||||
}
|
||||
|
||||
fun updateTaskName(name: String){
|
||||
fun updateTaskName(name: String) {
|
||||
line_name_tv.text = name
|
||||
}
|
||||
|
||||
fun changeOperationStatus(status:Boolean){
|
||||
if (!status){
|
||||
updateNoOrderUI()
|
||||
}
|
||||
}
|
||||
|
||||
fun showNoTaskView(haveTask: Boolean){
|
||||
fun showNoTaskView(haveTask: Boolean) {
|
||||
setLineInfoView(haveTask)
|
||||
}
|
||||
|
||||
private fun setLineInfoView(isShow: Boolean){
|
||||
if (!isShow){
|
||||
private fun setLineInfoView(isShow: Boolean) {
|
||||
if (!isShow) {
|
||||
updateNoOrderUI()
|
||||
}
|
||||
}
|
||||
@@ -162,19 +131,16 @@ class PM2DrivingInfoFragment :
|
||||
private fun updateNoOrderUI() {
|
||||
line_name_tv.text = resources.getString(R.string.shuttle_p_m2_not_select_line_content)
|
||||
updateNoStationView()
|
||||
overMapView?.let {
|
||||
it.clearSiteMarkers()
|
||||
}
|
||||
overMapView?.clearSiteMarkers()
|
||||
clearCustomPolyline()
|
||||
}
|
||||
|
||||
fun clearCustomPolyline(){
|
||||
overMapView?.let {
|
||||
it.clearCustomPolyline()
|
||||
}
|
||||
fun clearCustomPolyline() {
|
||||
overMapView?.clearCustomPolyline()
|
||||
}
|
||||
private fun updateNoStationView(){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.shuttle_p_m2_next_tv_color))
|
||||
|
||||
private fun updateNoStationView() {
|
||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.shuttle_p_m2_next_tv_color))
|
||||
station_name_tv.text = resources.getString(R.string.shuttle_p_m2_empty_tv)
|
||||
tv_distance.text = resources.getString(R.string.shuttle_p_m2_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.shuttle_p_m2_empty_remain_minute)
|
||||
@@ -186,12 +152,32 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
|
||||
fun updateAutoStatus(isAutoPilot: Boolean) {
|
||||
if (isAutoPilot){
|
||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.shuttle_p_m2_white_color)) }
|
||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.shuttle_p_m2_auto_button_bg) }
|
||||
}else{
|
||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.shuttle_p_m2_color_7094ad)) }
|
||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.shuttle_p_m2_bg_p_m2_auto) }
|
||||
if (isAutoPilot) {
|
||||
context?.let {
|
||||
auto_tv.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
it,
|
||||
R.color.shuttle_p_m2_white_color
|
||||
)
|
||||
)
|
||||
}
|
||||
context?.let {
|
||||
auto_tv.background =
|
||||
ContextCompat.getDrawable(it, R.drawable.shuttle_p_m2_auto_button_bg)
|
||||
}
|
||||
} else {
|
||||
context?.let {
|
||||
auto_tv.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
it,
|
||||
R.color.shuttle_p_m2_color_7094ad
|
||||
)
|
||||
)
|
||||
}
|
||||
context?.let {
|
||||
auto_tv.background =
|
||||
ContextCompat.getDrawable(it, R.drawable.shuttle_p_m2_bg_p_m2_auto)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,38 +186,40 @@ class PM2DrivingInfoFragment :
|
||||
stationsPass: MutableList<LatLng>,
|
||||
startStation: LatLng?,
|
||||
endStation: LatLng?
|
||||
){
|
||||
) {
|
||||
overMapView?.let {
|
||||
val stationsList: MutableList<SiteMarkerBean> = mutableListOf()
|
||||
startStation?.let { start->
|
||||
stationsList.add(SiteMarkerBean(start,startStationIcon,0.5f,0.5f))
|
||||
startStation?.let { start ->
|
||||
stationsList.add(SiteMarkerBean(start, startStationIcon, 0.5f, 0.5f))
|
||||
}
|
||||
for (stationsPass in stationsPass) {
|
||||
stationsList.add(SiteMarkerBean(stationsPass,stationPassIcon,0.5f,0.5f))
|
||||
for (stationPass in stationsPass) {
|
||||
stationsList.add(SiteMarkerBean(stationPass, stationPassIcon, 0.5f, 0.5f))
|
||||
}
|
||||
for (stationsPass in stations) {
|
||||
stationsList.add(SiteMarkerBean(stationsPass,stationIcon,0.5f,0.5f))
|
||||
for (stationPass in stations) {
|
||||
stationsList.add(SiteMarkerBean(stationPass, stationIcon, 0.5f, 0.5f))
|
||||
}
|
||||
endStation?.let {end->
|
||||
stationsList.add(SiteMarkerBean(end,endStationIcon,0.5f,0.5f))
|
||||
endStation?.let { end ->
|
||||
stationsList.add(SiteMarkerBean(end, endStationIcon, 0.5f, 0.5f))
|
||||
}
|
||||
it.drawSiteMarkers(stationsList)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean){
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean) {
|
||||
if (stations.size == 0) return
|
||||
if (0<= i && i<stations.size){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.shuttle_p_m2_next_tv_color))
|
||||
station_name_tv.text = stations[i].name
|
||||
if (0 <= i && i < stations.size) {
|
||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.shuttle_p_m2_next_tv_color))
|
||||
station_name_tv.text = stations[i].name
|
||||
}
|
||||
if (isArrived){//到站
|
||||
if (isArrived) {//到站
|
||||
tv_distance.text = resources.getString(R.string.shuttle_p_m2_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.shuttle_p_m2_empty_remain_minute)
|
||||
tv_next_station_title.text = resources.getString(R.string.shuttle_p_m2_station_title_arrived_tv)
|
||||
tv_next_station_title.text =
|
||||
resources.getString(R.string.shuttle_p_m2_station_title_arrived_tv)
|
||||
haveLineAndArrivedStation()
|
||||
}else{ //前往目的地中
|
||||
tv_next_station_title.text = resources.getString(R.string.shuttle_p_m2_next_station_title)
|
||||
} else { //前往目的地中
|
||||
tv_next_station_title.text =
|
||||
resources.getString(R.string.shuttle_p_m2_next_station_title)
|
||||
haveLineAndArriveingStation()
|
||||
}
|
||||
}
|
||||
@@ -259,7 +247,7 @@ class PM2DrivingInfoFragment :
|
||||
"${time}分钟".also { tv_left_time.text = it }
|
||||
}
|
||||
|
||||
fun noLineShow(){
|
||||
fun noLineShow() {
|
||||
// 没有线路展示
|
||||
group_not_select_line.visibility = View.VISIBLE
|
||||
// 下一个站点
|
||||
@@ -271,16 +259,18 @@ class PM2DrivingInfoFragment :
|
||||
|
||||
iv_animal_list.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 有线路正在到站点
|
||||
fun haveLineAndArriveingStation(){
|
||||
fun haveLineAndArriveingStation() {
|
||||
group_not_select_line.visibility = View.GONE
|
||||
group_stationinfo.visibility = View.VISIBLE
|
||||
clg_distance_left_time.visibility = View.VISIBLE
|
||||
tv_arrived_notice.visibility = View.GONE
|
||||
iv_animal_list.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 有线路到达站点
|
||||
private fun haveLineAndArrivedStation(){
|
||||
private fun haveLineAndArrivedStation() {
|
||||
group_not_select_line.visibility = View.GONE
|
||||
group_stationinfo.visibility = View.VISIBLE
|
||||
clg_distance_left_time.visibility = View.GONE
|
||||
|
||||
@@ -30,6 +30,6 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/no_order_data_iv"
|
||||
android:text="@string/shuttle_p_jl_no_out"/>
|
||||
android:text="@string/shuttle_p_jl_no_task"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -32,7 +32,7 @@
|
||||
android:layout_marginStart="@dimen/dp_40" />
|
||||
|
||||
<!--魔方连接状态 蓝牙-->
|
||||
<com.mogo.och.shuttle.weaknet.passenger.ui.BusPBlueToothView
|
||||
<com.mogo.och.shuttle.weaknet.passenger.ui.widget.BusPBlueToothView
|
||||
android:id="@+id/blueToothView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user