[3.4.0-map-sdk] merge 6.1.0
@@ -113,6 +113,9 @@ object BusPassengerModel{
|
||||
false
|
||||
})
|
||||
|
||||
@Volatile
|
||||
private var isGoingToNextStation = false
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context.applicationContext
|
||||
initListeners()
|
||||
@@ -227,6 +230,7 @@ object BusPassengerModel{
|
||||
val station = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.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)
|
||||
if (mNextStationIndex != i + 1) {
|
||||
mTwoStationsRouts.clear()
|
||||
@@ -241,6 +245,9 @@ object BusPassengerModel{
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
|
||||
isGoingToNextStation = false
|
||||
|
||||
suspendCalculate()
|
||||
|
||||
Logger.d(M_BUS_P + TAG, "order = station= arrive")
|
||||
@@ -487,15 +494,24 @@ object BusPassengerModel{
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
mTwoStationsRouts.clear()
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotEnable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
mTwoStationsRouts.clear()
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotDisable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
mTwoStationsRouts.clear()
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
|
||||
} else {
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation){
|
||||
d(M_BUS_P + TAG, "FunctionBuildConfig.isDemoMode is true")
|
||||
return
|
||||
}
|
||||
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
mTwoStationsRouts.clear()
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotEnable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
mTwoStationsRouts.clear()
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotDisable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
mTwoStationsRouts.clear()
|
||||
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivalNotification?) {
|
||||
|
||||
@@ -453,8 +453,6 @@ public class BusPassengerRouteFragment extends
|
||||
public void AutopilotStatusChanged(int status) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_open);
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status){
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_close);
|
||||
} else {
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_close);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.charter.passenger.bean.response
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -65,6 +66,20 @@ data class OrderInfoResponse(val data: OrderInfo?) : BaseData() {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "OrderInfo(orderNo=$orderNo, sn=$sn, productType=${getProductTypeName()}, lineId=$lineId, lineName=$lineName, startSiteId=$startSiteId, startSiteName=$startSiteName, startSiteNameKr=$startSiteNameKr, siteId=$siteId, siteName=$siteName, siteNameKr=$siteNameKr, wgs84Lat=$wgs84Lat, wgs84Lon=$wgs84Lon, startTime=${DateTimeUtil.formatLongToString(startTime?:System.currentTimeMillis(), DateTimeUtil.MM_dd_HH_mm)}, endTime=${DateTimeUtil.formatLongToString(endTime?:System.currentTimeMillis(), DateTimeUtil.MM_dd_HH_mm)}, passengerPhone=$passengerPhone, arriveStatus=$arriveStatus)"
|
||||
}
|
||||
|
||||
fun getProductTypeName(): String {
|
||||
return when (productType) {
|
||||
M1_LOVE -> "爱情号"
|
||||
M1_FAMILY -> "家庭号"
|
||||
M1_FRIENDLY -> "朋友号"
|
||||
else -> "未知"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
companion object{
|
||||
val ARRIVING = 1
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.CharterSendTripInfoManager
|
||||
import com.mogo.och.common.module.manager.CharterSendTripInfoManager.LEAVE_STATION
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
@@ -393,6 +394,7 @@ object CharterPassengerModel {
|
||||
this.orderInfo = orderData
|
||||
setOrderStatus(OrderStatusEnum.OrdersWithLine)
|
||||
updateAutopilotControlParameters()
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"更改线路成功:${orderData.siteName}")
|
||||
} else {
|
||||
this.orderInfo = orderData
|
||||
}
|
||||
@@ -727,6 +729,7 @@ object CharterPassengerModel {
|
||||
private fun setOrderStatus(orderStatus: OrderStatusEnum) {
|
||||
if (this.orderStatus != orderStatus) {
|
||||
d(M_BUS_P + TAG, "${this.orderInfo?.orderNo}新的状态:$orderStatus")
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"新的状态:$orderStatus")
|
||||
this.orderStatus = orderStatus
|
||||
for (callback in orderStatusChangeListeners.values) {
|
||||
callback.onStatusChange(this.orderStatus)
|
||||
@@ -737,6 +740,7 @@ object CharterPassengerModel {
|
||||
fun setEndOrderStatus() {
|
||||
UiThreadHandler.postDelayed({
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUse)
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"手动结束订单:$orderStatus")
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
@@ -933,6 +937,7 @@ object CharterPassengerModel {
|
||||
}
|
||||
|
||||
if (order != null && lineId != null && siteId != null) {
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"到站成功:${order.siteName}")
|
||||
VoiceManager.arrivedStation(
|
||||
order.siteName!!,
|
||||
order.siteNameKr ?: "",
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.mogo.och.charter.passenger.ui.overmapview.MakerWithSiteNamewithCheck
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.StopSideStatusManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorStatusManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.AirconditionStatus
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.HeaterStatue
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsList
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
|
||||
private static final String TAG = OCHAdasAbilityManager.class.getSimpleName();
|
||||
|
||||
private boolean isAutopilotAbility;
|
||||
private ArrayList<UnableAutopilotReason> unableAutopilotReasons;
|
||||
private ArrayList<UnableLaunchReason> unableAutopilotReasons;
|
||||
private String startFailedCode = "";
|
||||
private String startFailedMessage = "";
|
||||
|
||||
@@ -93,7 +93,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons) {
|
||||
public void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
|
||||
this.isAutopilotAbility = isAutopilotAbility;
|
||||
this.unableAutopilotReasons = unableAutopilotReasons;
|
||||
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons == null ? null : unableAutopilotReasons.toString()));
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.common.module.manager.devicemanage
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StatesListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerRoboBusJinlvM1StatesListenerManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.AirconditionStatus
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorStatus
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.HeaterStatue
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.mogo.och.common.module.manager.devicemanage
|
||||
|
||||
import chassis.Chassis
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisDoorStateListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.DoorStateCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorPosition
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
|
||||
|
||||
object TaxiDoorStateManager : IMoGoChassisDoorStateListener,
|
||||
CallerBase<DoorStateCallback>() {
|
||||
private val TAG = TaxiDoorStateManager::class.java.simpleName
|
||||
|
||||
@Volatile
|
||||
private var haveOpenDoor: Boolean? = null
|
||||
|
||||
init {
|
||||
CallerChassisDoorStateListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: DoorStateCallback) {
|
||||
val doorList = CallerChassisDoorStateListenerManager.getDoorList()
|
||||
if(doorList is MutableList<VehicleStateOuterClass.DoorStateV2>){
|
||||
doSomeAfterAddListenerInner(doorList)
|
||||
doorList.forEach {
|
||||
onAutopilotSingleDoorState(it.number,it.status)
|
||||
}
|
||||
}else{
|
||||
doSomeAfterAddListenerInner(mutableListOf())
|
||||
}
|
||||
}
|
||||
|
||||
private fun doSomeAfterAddListenerInner(doorList: MutableList<VehicleStateOuterClass.DoorStateV2>){
|
||||
var have = false
|
||||
doorList.forEach {
|
||||
if (it.status == 1) {//0关闭 1开着 2未知
|
||||
have = true
|
||||
}
|
||||
}
|
||||
haveOpenDoor = have
|
||||
invokeOpenState(have)
|
||||
}
|
||||
|
||||
/**
|
||||
* 主要用来判断是否有门开着
|
||||
*/
|
||||
override fun onAutopilotDoorState(doorList: MutableList<VehicleStateOuterClass.DoorStateV2>) {
|
||||
var have = false
|
||||
doorList.forEach {
|
||||
if (it.status == 1) {//0关闭 1开着 2未知
|
||||
have = true
|
||||
}
|
||||
}
|
||||
if (have != haveOpenDoor) {
|
||||
haveOpenDoor = have
|
||||
invokeOpenState(have)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断单个车门是否开着
|
||||
*/
|
||||
override fun onAutopilotSingleDoorState(num: Chassis.DoorNumber, status: Int) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${num}--${status}")
|
||||
when (status) {
|
||||
0 -> { exchangeEnum(num, DoorState.CLOSE)}
|
||||
1 -> {exchangeEnum(num, DoorState.OPEN)}
|
||||
2 -> {exchangeEnum(num, DoorState.UNKNOWN)}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun exchangeEnum(num: Chassis.DoorNumber, state: DoorState) {
|
||||
when (num) {
|
||||
Chassis.DoorNumber.FRONT_LEFT -> {
|
||||
invokeSingleDoorOpenState(DoorPosition.FRONT_LEFT, state)
|
||||
}
|
||||
|
||||
Chassis.DoorNumber.FRONT_RIGHT -> {
|
||||
invokeSingleDoorOpenState(DoorPosition.FRONT_RIGHT, state)
|
||||
}
|
||||
|
||||
Chassis.DoorNumber.REAR_LEFT -> {
|
||||
invokeSingleDoorOpenState(DoorPosition.REAR_LEFT, state)
|
||||
}
|
||||
|
||||
Chassis.DoorNumber.REAR_RIGHT -> {
|
||||
invokeSingleDoorOpenState(DoorPosition.REAR_RIGHT, state)
|
||||
}
|
||||
|
||||
Chassis.DoorNumber.MIDDLE -> {
|
||||
invokeSingleDoorOpenState(DoorPosition.MIDDLE, state)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param have true 有车门开着
|
||||
* false 没有车门开着(可能开着可能未知)
|
||||
*/
|
||||
@Synchronized
|
||||
private fun invokeOpenState(have: Boolean) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.hasOpenDoor(have)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param doorPosition 车门位置
|
||||
* @param doorState 车门状态
|
||||
*/
|
||||
@Synchronized
|
||||
private fun invokeSingleDoorOpenState(doorPosition: DoorPosition,doorState: DoorState) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.doorStateChangeCallback(doorPosition,doorState)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.och.common.module.manager.devicemanage.callback
|
||||
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorPosition
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
|
||||
|
||||
interface DoorStateCallback {
|
||||
|
||||
/**
|
||||
* @param have true 有车门开着
|
||||
* false 没有车门开着(可能开着可能未知)
|
||||
*/
|
||||
fun hasOpenDoor(have:Boolean){}
|
||||
|
||||
/**
|
||||
* @param position 车门位置
|
||||
* @param state 当前车门状态
|
||||
*/
|
||||
fun doorStateChangeCallback(position: DoorPosition,state: DoorState){}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.common.module.manager.devicemanage
|
||||
package com.mogo.och.common.module.manager.devicemanage.callback
|
||||
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.AirconditionStatus
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.HeaterStatue
|
||||
@@ -1,3 +1,12 @@
|
||||
package com.mogo.och.common.module.manager.devicemanage.data
|
||||
|
||||
data class DoorStatus(var isOpen: Boolean)
|
||||
data class DoorStatus(var isOpen: Boolean)
|
||||
|
||||
|
||||
enum class DoorPosition {
|
||||
FRONT_LEFT, FRONT_RIGHT, REAR_LEFT, REAR_RIGHT, MIDDLE
|
||||
}
|
||||
|
||||
enum class DoorState {
|
||||
OPEN,CLOSE,UNKNOWN
|
||||
}
|
||||
@@ -549,13 +549,13 @@ object TrajectoryAndDistanceManager: IMoGoPlanningRottingListener{
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_OCH,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_OCH,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_COMMON_DISTANCE,
|
||||
paramIndexes = [0,1]
|
||||
)
|
||||
fun writeLog(carLocationInfo: String, location: String) {
|
||||
// @ChainLog(
|
||||
// linkChainLog = ChainConstant.CHAIN_TYPE_OCH,
|
||||
// linkCode = ChainConstant.CHAIN_SOURCE_OCH,
|
||||
// nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_COMMON_DISTANCE,
|
||||
// paramIndexes = [0,1]
|
||||
// )
|
||||
private fun writeLog(carLocationInfo: String, location: String) {
|
||||
d(M_OCHCOMMON+ TAG,carLocationInfo)
|
||||
d(M_OCHCOMMON+ TAG,location)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.mogo.och.common.module.manager.orderlogmanager
|
||||
|
||||
import android.text.TextUtils
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
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.DateTimeUtils
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
|
||||
object OchChainLogManager {
|
||||
|
||||
private val TAG = OchChainLogManager::class.java.simpleName
|
||||
|
||||
const val EVENT_KEY_INFE_WITH_CHANGE = "event_key_och_common_info_and_changeinfo"
|
||||
|
||||
/**
|
||||
* @param Info 订单详细信息
|
||||
* @param changeInfo 变化信息
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_OCH,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_OCH,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_COMMON_DISTANCE,
|
||||
paramIndexes = [0,1]
|
||||
)
|
||||
fun writeChainLog(Info: String, changeInfo: String) {
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, Info)
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, changeInfo)
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
val params = HashMap<String, Any>()
|
||||
params["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
params["env"] = DebugConfig.getNetMode()
|
||||
params["plate_number"] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
params["time"] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
params["info"] = Info
|
||||
params["changeInfo"] = changeInfo
|
||||
MogoAnalyticUtils.track(EVENT_KEY_INFE_WITH_CHANGE, params)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.och.common.module.manager.orderlogmanager
|
||||
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
|
||||
object OrderChainLogManager {
|
||||
|
||||
private val TAG = OrderChainLogManager::class.java.simpleName
|
||||
|
||||
/**
|
||||
* @param orderInfo 订单详细信息
|
||||
* @param changeInfo 变化信息
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_OCH,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_OCH,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_COMMON_DISTANCE,
|
||||
paramIndexes = [0,1]
|
||||
)
|
||||
fun writeChainLog(orderInfo: String, changeInfo: String) {
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, orderInfo)
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, changeInfo)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.mogo.och.common.module.utils
|
||||
|
||||
/**
|
||||
* @author aibingbing
|
||||
* @date: 2023/9/13
|
||||
* @desc Flow Bus
|
||||
*/
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.channels.BufferOverflow
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* FlowBus消息总线
|
||||
*/
|
||||
object FlowBus {
|
||||
private const val TAG = "FlowBus"
|
||||
private val busMap = mutableMapOf<String, EventBus<*>>()
|
||||
private val busStickMap = mutableMapOf<String, StickEventBus<*>>()
|
||||
|
||||
@Synchronized
|
||||
fun <T> with(key: String): EventBus<T> {
|
||||
var eventBus = busMap[key]
|
||||
if (eventBus == null) {
|
||||
eventBus = EventBus<T>(key)
|
||||
busMap[key] = eventBus
|
||||
}
|
||||
return eventBus as EventBus<T>
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun <T> withStick(key: String): StickEventBus<T> {
|
||||
var eventBus = busStickMap[key]
|
||||
if (eventBus == null) {
|
||||
eventBus = StickEventBus<T>(key)
|
||||
busStickMap[key] = eventBus
|
||||
}
|
||||
return eventBus as StickEventBus<T>
|
||||
}
|
||||
|
||||
//真正实现类
|
||||
open class EventBus<T>(private val key: String) : LifecycleObserver {
|
||||
|
||||
//私有对象用于发送消息
|
||||
private val _events: MutableSharedFlow<T> by lazy {
|
||||
obtainEvent()
|
||||
}
|
||||
|
||||
//暴露的公有对象用于接收消息
|
||||
private val events = _events.asSharedFlow()
|
||||
|
||||
open fun obtainEvent(): MutableSharedFlow<T> =
|
||||
MutableSharedFlow(0, 1, BufferOverflow.DROP_OLDEST)
|
||||
|
||||
//主线程接收数据
|
||||
fun register(lifecycleOwner: LifecycleOwner, action: (t: T) -> Unit) {
|
||||
lifecycleOwner.lifecycle.addObserver(this)
|
||||
lifecycleOwner.lifecycleScope.launch {
|
||||
events.collect {
|
||||
try {
|
||||
action(it)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Log.e(TAG, "FlowBus - Error:$e")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//协程中发送数据
|
||||
suspend fun post(event: T) {
|
||||
_events.emit(event)
|
||||
}
|
||||
|
||||
//主线程发送数据
|
||||
fun post(scope: CoroutineScope, event: T) {
|
||||
scope.launch {
|
||||
_events.emit(event)
|
||||
}
|
||||
}
|
||||
|
||||
//自动销毁
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
fun onDestroy() {
|
||||
Log.w(TAG, "FlowBus - 自动onDestroy")
|
||||
val subscriptCount = _events.subscriptionCount.value
|
||||
if (subscriptCount <= 0)
|
||||
busMap.remove(key)
|
||||
}
|
||||
}
|
||||
|
||||
class StickEventBus<T>(key: String) : EventBus<T>(key) {
|
||||
override fun obtainEvent(): MutableSharedFlow<T> =
|
||||
MutableSharedFlow(1, 1, BufferOverflow.DROP_OLDEST)
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,10 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
mShouldRun = false
|
||||
}
|
||||
|
||||
fun isPlaying():Boolean{
|
||||
return mShouldRun
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置停止播放监听
|
||||
* @param listener 设置监听
|
||||
|
||||
@@ -36,12 +36,11 @@ object RxUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun isDisposed(disposable: Disposable?):Boolean{
|
||||
if(disposable!=null){
|
||||
return true
|
||||
fun isNotDisposed(disposable: Disposable?):Boolean{
|
||||
if(disposable==null){
|
||||
return false
|
||||
}
|
||||
|
||||
return false
|
||||
return !disposable.isDisposed
|
||||
}
|
||||
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.mogo.och.common.module.wigets
|
||||
|
||||
import android.os.CountDownTimer
|
||||
import android.util.Log
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/9/18
|
||||
* 支持pause的倒计时, 由CountDownTimer实现的,
|
||||
* 注意CountdownTimer的源码,start(),pause(),cancel()方法都是用message和handler实现的
|
||||
* 如果是在子线程中执行,要加调用Looper.prepare()及Looper.loop()
|
||||
* 或者是使用 runOnMainThread 使其在主线程中执行
|
||||
**/
|
||||
abstract class CountDownTimerExt(
|
||||
private var millisInFuture: Long,
|
||||
/**
|
||||
* 间隔
|
||||
*/
|
||||
private var mInterval: Long
|
||||
) {
|
||||
/**
|
||||
* 倒计时实现类
|
||||
*/
|
||||
private var countDownTimer: CountDownTimer? = null
|
||||
private var isTimerPaused = true
|
||||
var remainingTime: Long
|
||||
|
||||
/**
|
||||
* @param millisInFutureIn 总时长
|
||||
* @param interval onTick间隔
|
||||
*/
|
||||
init {
|
||||
remainingTime = millisInFuture
|
||||
}
|
||||
|
||||
fun start() {
|
||||
startIt(remainingTime, mInterval)
|
||||
}
|
||||
|
||||
fun start(millisInFutureIn: Long, remainingTimeIn: Long, interval: Long) {
|
||||
millisInFuture = millisInFutureIn
|
||||
remainingTime = remainingTimeIn
|
||||
mInterval = interval
|
||||
start()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun startIt(millisInFutureIn: Long, interval: Long) {
|
||||
remainingTime = millisInFutureIn
|
||||
mInterval = interval
|
||||
if (millisInFuture > 0L && interval > 0L) {
|
||||
if (!isTimerPaused) {
|
||||
// 有运行中的先stop
|
||||
stop()
|
||||
}
|
||||
if (isTimerPaused) {
|
||||
// 有暂停或未运行的,创建CountDownTimer实现, 确保运行在主线程
|
||||
countDownTimer = object : CountDownTimer(remainingTime, mInterval) {
|
||||
override fun onFinish() {
|
||||
onTimerFinish()
|
||||
stop()
|
||||
}
|
||||
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
// 这里会记录剩余的时长保存到remainingTime, 方便暂停后能再恢复
|
||||
remainingTime = millisUntilFinished
|
||||
onTimerTick(millisUntilFinished)
|
||||
}
|
||||
}
|
||||
try {
|
||||
countDownTimer?.start()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
isTimerPaused = false
|
||||
} else {
|
||||
Log.d(TAG, "ignore start")
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "invalid parameter")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止
|
||||
*/
|
||||
fun stop() {
|
||||
try {
|
||||
countDownTimer?.cancel()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
isTimerPaused = true
|
||||
remainingTime = millisInFuture
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停
|
||||
*/
|
||||
fun pause() {
|
||||
if (!isTimerPaused) {
|
||||
try {
|
||||
countDownTimer?.cancel()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
isTimerPaused = true
|
||||
onTimerPause()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复
|
||||
*/
|
||||
fun resume() {
|
||||
if (!isRunning) {
|
||||
// 通过remainingTime得到剩余的时长
|
||||
startIt(remainingTime, mInterval)
|
||||
onTimerResume(remainingTime)
|
||||
}
|
||||
}
|
||||
|
||||
private val isRunning: Boolean
|
||||
/**
|
||||
* 运行中
|
||||
* @return
|
||||
*/
|
||||
get() = !isTimerPaused
|
||||
|
||||
/**
|
||||
* 每次触发倒计时回调
|
||||
* @param value
|
||||
*/
|
||||
abstract fun onTimerTick(value: Long)
|
||||
|
||||
/**
|
||||
* 倒计时完成回调
|
||||
*/
|
||||
abstract fun onTimerFinish()
|
||||
|
||||
abstract fun onTimerPause()
|
||||
|
||||
abstract fun onTimerResume(remainingTime: Long)
|
||||
|
||||
companion object {
|
||||
private const val TAG = "CountDownTimerExt"
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,13 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
private const val TAG = "StartAutopilotAnimationView"
|
||||
}
|
||||
|
||||
private var startTimer: CountDownTimer? = null
|
||||
private var startTimer: CountDownTimerExt? = null
|
||||
private val mContext: Context
|
||||
private var mTimerListener: AnimationViewTimerListener? = null
|
||||
|
||||
private val closeWarningTask: Runnable = Runnable {
|
||||
//开始倒计时
|
||||
countDownTimer()
|
||||
showWarning(DirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
|
||||
@@ -58,17 +61,36 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
super.onAttachedToWindow()
|
||||
}
|
||||
|
||||
fun show(direction: DirectionEnum, time: Long) {
|
||||
fun show(direction: DirectionEnum, time: Long,listener: AnimationViewTimerListener) {
|
||||
mTimerListener = listener
|
||||
//开始倒计时
|
||||
countDownTimer()
|
||||
showWarning(direction, time)
|
||||
}
|
||||
|
||||
fun pause(){
|
||||
pauseWarning()
|
||||
}
|
||||
|
||||
private fun pauseWarning() {
|
||||
startTimer?.pause()
|
||||
}
|
||||
|
||||
fun resume(){
|
||||
resumeWarning()
|
||||
}
|
||||
|
||||
private fun resumeWarning() {
|
||||
startTimer?.resume()
|
||||
}
|
||||
|
||||
fun dismiss(direction: DirectionEnum) {
|
||||
dismissWarning(direction)
|
||||
cancelCountdown()
|
||||
}
|
||||
|
||||
fun cancelCountdown(){ //防止内存泄漏
|
||||
startTimer?.cancel()
|
||||
startTimer?.stop()
|
||||
startTimer = null
|
||||
}
|
||||
|
||||
@@ -78,8 +100,6 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
* @see WarningDirectionEnum
|
||||
*/
|
||||
private fun showWarning(direction: DirectionEnum, time: Long = ALL_CLOSE_TIMER) {
|
||||
//开始倒计时
|
||||
countDownTimer()
|
||||
|
||||
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
|
||||
if (oldDirection.get() == direction) {
|
||||
@@ -131,6 +151,26 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun pauseWarning(direction: DirectionEnum) {
|
||||
if (direction == DirectionEnum.ALERT_WARNING_NON) {
|
||||
return
|
||||
}
|
||||
removeCallbacks(closeWarningTask)
|
||||
post {
|
||||
when (direction) {
|
||||
DirectionEnum.ALERT_WARNING_TOP -> {
|
||||
startAutopilotTipImg.visibility = View.VISIBLE
|
||||
startAutopilotTip.visibility = View.VISIBLE
|
||||
}
|
||||
else -> {
|
||||
CallerLogger.d("$M_HMI$TAG", "Not Support Direction")
|
||||
}
|
||||
}
|
||||
clearAnimation()
|
||||
this.oldDirection.set(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
@@ -148,21 +188,37 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
|
||||
startAutopilotTip.visibility = VISIBLE
|
||||
|
||||
startTimer = object : CountDownTimer(ALL_CLOSE_TIMER, 1000L) {// 5倒计时后开启自驾
|
||||
startTimer = object : CountDownTimerExt(ALL_CLOSE_TIMER, 1000L) {// 5倒计时后开启自驾
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
override fun onTimerTick(value: Long) {
|
||||
// 倒计时
|
||||
UiThreadHandler.post {
|
||||
startAutopilotTip.text = "${(millisUntilFinished/1000).toInt()} 车辆即将自动开启自动驾驶"
|
||||
startAutopilotTip.text = "${(value/1000).toInt()} 车辆即将自动开启自动驾驶"
|
||||
}
|
||||
playDI()
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
override fun onTimerFinish() {
|
||||
//倒计时结束了...
|
||||
UiThreadHandler.post {
|
||||
startAutopilotTip.text = "车辆正在自动开启自动驾驶"
|
||||
dismiss(DirectionEnum.ALERT_WARNING_TOP)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimerPause() {
|
||||
//倒计时暂停
|
||||
UiThreadHandler.post {
|
||||
pauseWarning(DirectionEnum.ALERT_WARNING_TOP)
|
||||
mTimerListener?.onTimerPause()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimerResume(remainingTime: Long) {
|
||||
//倒计时继续对动画UI处理
|
||||
UiThreadHandler.post {
|
||||
showWarning(DirectionEnum.ALERT_WARNING_TOP, remainingTime)
|
||||
mTimerListener?.onTimerResume(remainingTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,4 +226,9 @@ class StartAutopilotAnimationView @JvmOverloads constructor(
|
||||
startTimer?.start()
|
||||
}
|
||||
|
||||
interface AnimationViewTimerListener{
|
||||
fun onTimerResume(remainingTime: Long)
|
||||
|
||||
fun onTimerPause()
|
||||
}
|
||||
}
|
||||
@@ -119,6 +119,8 @@ public class BusPassengerModel {
|
||||
private int mPreRouteIndex = 0;
|
||||
private int mWipePreIndex = 0;
|
||||
|
||||
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
|
||||
@@ -291,6 +293,8 @@ public class BusPassengerModel {
|
||||
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);
|
||||
if(mNextStationIndex != i+1){
|
||||
mTwoStationsRouts.clear();
|
||||
@@ -302,6 +306,9 @@ public class BusPassengerModel {
|
||||
if (i == 0){
|
||||
startOrStopRouteAndWipe(false);
|
||||
}
|
||||
|
||||
isGoingToNextStation = false;
|
||||
Logger.d(M_BUS_P + TAG, "order = station= arrive");
|
||||
mPreRouteIndex = 0;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
|
||||
@@ -452,8 +459,6 @@ public class BusPassengerModel {
|
||||
}
|
||||
};
|
||||
|
||||
private volatile int mPreAutoStatus = -1;
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
@@ -492,27 +497,29 @@ public class BusPassengerModel {
|
||||
int state = autopilotStatusInfo.getState();
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
//2022.7.20 自动驾驶更换成带档位的
|
||||
if(state != mPreAutoStatus && null != routesResult){
|
||||
if(null != routesResult){
|
||||
CallerAutoPilotControlManager.INSTANCE.getGlobalPath();
|
||||
}
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
} else{
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size() - 1
|
||||
&& isGoingToNextStation){
|
||||
Logger.d(M_BUS_P + TAG, "FunctionBuildConfig.isDemoMode is true");
|
||||
return;
|
||||
}
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if(state != mPreAutoStatus){
|
||||
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
|
||||
if(state != mPreAutoStatus){
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
mTwoStationsRouts.clear();
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
|
||||
mTwoStationsRouts.clear();
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
}
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
}
|
||||
mPreAutoStatus = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -389,8 +389,6 @@ public class BusPassengerRouteFragment extends
|
||||
public void AutopilotStatusChanged(int status) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_open);
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status){
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_close);
|
||||
} else {
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_close);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.och.sweepercloud.callback
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.sweepercloud.database.bean.WeltDataBean
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask
|
||||
import com.zhjt.mogo.adas.data.AiCloudTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable.IsBootableResp
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
@@ -20,7 +20,7 @@ interface ISweeperCloudTaskCallback {
|
||||
/**
|
||||
* 接取云端任务/正在执行中任务信息回调
|
||||
*/
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType,taskInfo: SweeperTask.TaskInfo?)
|
||||
fun onSweeperCloudTask(messageType: AiCloudTask.MessageType, taskInfo: SweeperTask.TaskInfo?)
|
||||
|
||||
/**
|
||||
* 云端下发子任务请求pad确认
|
||||
@@ -40,7 +40,7 @@ interface ISweeperCloudTaskCallback {
|
||||
/**
|
||||
* 挂起/恢复
|
||||
*/
|
||||
fun onSweeperCloudTaskSuspendResume(messageType: SweeperCloudTask.MessageType,taskId:String,subTaskId:String,code:Code)
|
||||
fun onSweeperCloudTaskSuspendResume(messageType: AiCloudTask.MessageType,taskId:String,subTaskId:String,code:Code)
|
||||
|
||||
/**
|
||||
* pad请求云端进入自驾
|
||||
|
||||
@@ -39,10 +39,11 @@ import com.mogo.och.sweepercloud.constant.SweeperConst;
|
||||
import com.mogo.och.sweepercloud.database.MyDataBase;
|
||||
import com.mogo.och.sweepercloud.database.bean.WeltDataBean;
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils;
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask;
|
||||
import com.zhjt.mogo.adas.data.AiCloudTask;
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.big.SweeperBigTaskStatus;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus;
|
||||
@@ -183,7 +184,6 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void setControllerStatusCallback(ISweeperControllerStatusCallback callback) {
|
||||
this.mControllerStatusCallback = callback;
|
||||
}
|
||||
@@ -217,7 +217,6 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public void setSubtask(String subTaskId, SweeperTask.TaskModel subTaskType, int currentLineId) {
|
||||
@@ -257,8 +256,9 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
return this.mAutopilotState;
|
||||
}
|
||||
|
||||
public static List<SweeperRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext,
|
||||
List<MessagePad.Location> mogoLatLngList) {
|
||||
public static List<SweeperRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(
|
||||
Context mContext,
|
||||
List<MessagePad.Location> mogoLatLngList) {
|
||||
List<SweeperRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(mContext, m);
|
||||
@@ -305,7 +305,6 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
if (mSubTaskType == SweeperTask.TaskModel.MANUAL) {//收集人工驾驶子任务坐标点
|
||||
addCoordinates(gnssInfo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -333,7 +332,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTask(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudTask(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperTask.TaskInfo taskInfo) {
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
@@ -345,7 +344,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskConfirm(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudTaskConfirm(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperTaskConfirm.TaskConfirm taskConfirm) {
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
@@ -357,7 +356,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskStatus(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudTaskStatus(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperTaskStatus.TaskStatusPush taskStatusPush) {
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
"onSweeperFutianCloudTaskStatus:" + printMessage(taskStatusPush));
|
||||
@@ -368,7 +367,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskStop(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudTaskStop(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperTaskStop.StopTaskReq stopTaskReq) {
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
"onSweeperFutianCloudTaskStop:" + printMessage(stopTaskReq));
|
||||
@@ -379,7 +378,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskSuspendResume(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudTaskSuspendResume(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperTaskSuspendResume.SuspendResumeTaskResp suspendResumeTaskResp) {
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
"onSweeperFutianCloudTaskSuspendResume:" + printMessage(suspendResumeTaskResp));
|
||||
@@ -391,7 +390,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudBootable(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudBootable(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperBootable.IsBootableResp isBootableResp) {
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
"onSweeperFutianCloudBootable:" + printMessage(isBootableResp));
|
||||
@@ -402,13 +401,24 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudBigTaskStatus(@NonNull SweeperCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
public void onSweeperFutianCloudBigTaskStatus(@NonNull AiCloudTask.MessageType messageType, String reqNo, long sysTime,
|
||||
SweeperBigTaskStatus.BigTaskStatusPush bigTaskStatusPush) {
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
"onSweeperFutianCloudBigTaskStatus:" + printMessage(bigTaskStatusPush));
|
||||
if (mSweeperTaskCallback != null && bigTaskStatusPush != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudBigTaskStatus(bigTaskStatusPush.getTaskId(), bigTaskStatusPush.getTaskStatus());
|
||||
mSweeperTaskCallback.onSweeperCloudBigTaskStatus(bigTaskStatusPush.getTaskId(), bigTaskStatusPush.getTaskStatus(), bigTaskStatusPush.getIsPop());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskCloudSuspendResume(@NonNull AiCloudTask.MessageType messageType, @Nullable String reqNo, long sysTime,
|
||||
@Nullable SweeperTaskCloudSuspendResume.BigTaskActionPush bigTaskActionPush) {
|
||||
CallerLogger.d(M_SWEEPER + TAG, "messageType: " + messageType.getNumber() + " sysTime:" + sysTime + " reqNo:" + reqNo + " " +
|
||||
"onSweeperFutianCloudTaskCloudSuspendResume:" + printMessage(bigTaskActionPush));
|
||||
if (mSweeperTaskCallback != null && bigTaskActionPush != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudBigTaskSuspendResume(bigTaskActionPush.getTaskId(), bigTaskActionPush.getAction(), bigTaskActionPush.getIsPop());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,24 +440,25 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianTaskIndexData(@NonNull RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex roboSweeperTaskIndex) {
|
||||
if (roboSweeperTaskIndex == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mWeltDataCurrentTimeMillis <= WELT_DATA_INTERVAL_MILLIS) {
|
||||
return;
|
||||
}
|
||||
mWeltDataCurrentTimeMillis = current;
|
||||
|
||||
//没有任务数据时,不处理贴边
|
||||
if (!isHasTaskInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"mSubTaskType:" + mSubTaskType + "+ onSweeperFutianTaskIndexData:" + printMessage(roboSweeperTaskIndex));
|
||||
handleWeltData(roboSweeperTaskIndex);
|
||||
// 20230728 因小地图不展示了,贴边数据先不处理了,浪费资源
|
||||
// if (roboSweeperTaskIndex == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// long current = System.currentTimeMillis();
|
||||
// if (current - mWeltDataCurrentTimeMillis <= WELT_DATA_INTERVAL_MILLIS) {
|
||||
// return;
|
||||
// }
|
||||
// mWeltDataCurrentTimeMillis = current;
|
||||
//
|
||||
// //没有任务数据时,不处理贴边
|
||||
// if (!isHasTaskInfo) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// CallerLogger.INSTANCE.d(M_SWEEPER + TAG,
|
||||
// "mSubTaskType:" + mSubTaskType + "+ onSweeperFutianTaskIndexData:" + printMessage(roboSweeperTaskIndex));
|
||||
// handleWeltData(roboSweeperTaskIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -494,7 +505,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
}
|
||||
}
|
||||
|
||||
public static String format(double value) {
|
||||
private static String format(double value) {
|
||||
BigDecimal bd = new BigDecimal(value);
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
return bd.toString();
|
||||
@@ -508,8 +519,9 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setSn(getDriverSn());
|
||||
String reqNo = SweeperCloudTaskUtils.getRequestId();
|
||||
SweeperTask.GetTaskReq getTaskReq = builder.build();
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"getCurrentTask:" + printMessage(getTaskReq) + " reqNo:" + reqNo + " messageType:" + SweeperCloudTask.MessageType.PadSendGetTaskReq.getNumber());
|
||||
"getCurrentTask:" + printMessage(getTaskReq) + " reqNo:" + reqNo + " messageType:" + AiCloudTask.MessageType.PadSendGetTaskReq.getNumber());
|
||||
getAutoPilotControlManager().sendSweeperGetTaskReq(reqNo, getTaskReq);
|
||||
}
|
||||
|
||||
@@ -522,10 +534,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setTaskId(taskId);
|
||||
builder.setCode(code);
|
||||
SweeperTask.StartTaskResp startTaskResp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTask.getNumber());
|
||||
String reqNo = msgTypeAndReqNo.get(AiCloudTask.MessageType.CloudPushTask.getNumber());
|
||||
|
||||
getAutoPilotControlManager().sendSweeperStartTaskResp(reqNo, startTaskResp);
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"sendSweeperStartTaskResp:" + printMessage(startTaskResp) + " reqNo:" + reqNo + " messageType:" + SweeperCloudTask.MessageType.CloudPushTask.getNumber());
|
||||
"sendSweeperStartTaskResp:" + printMessage(startTaskResp) + " reqNo:" + reqNo + " messageType:" + AiCloudTask.MessageType.CloudPushTask.getNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -538,9 +551,9 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setSubTaskId(subTaskId);
|
||||
builder.setCode(code);
|
||||
SweeperTaskConfirm.TaskConfirmResp taskConfirmResp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTaskConfirm.getNumber());
|
||||
String reqNo = msgTypeAndReqNo.get(AiCloudTask.MessageType.CloudPushTaskConfirm.getNumber());
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"sendSweeperTaskConfirmResp" + printMessage(taskConfirmResp) + " reqNo:" + reqNo + " messageType:" + SweeperCloudTask.MessageType.CloudPushTaskConfirm.getNumber());
|
||||
"sendSweeperTaskConfirmResp" + printMessage(taskConfirmResp) + " reqNo:" + reqNo + " messageType:" + AiCloudTask.MessageType.CloudPushTaskConfirm.getNumber());
|
||||
getAutoPilotControlManager().sendSweeperTaskConfirmResp(reqNo, taskConfirmResp);
|
||||
}
|
||||
|
||||
@@ -556,9 +569,10 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setTaskId(taskId);
|
||||
builder.setCode(code);
|
||||
SweeperTaskStop.StopTaskResp stopTaskResp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTaskStop.getNumber());
|
||||
String reqNo = msgTypeAndReqNo.get(AiCloudTask.MessageType.CloudPushTaskStop.getNumber());
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"sendSweeperStopTaskResp" + printMessage(stopTaskResp) + " reqNo:" + reqNo + " messageType:" + SweeperCloudTask.MessageType.CloudPushTaskStop.getNumber());
|
||||
"sendSweeperStopTaskResp" + printMessage(stopTaskResp) + " reqNo:" + reqNo + " messageType:" + AiCloudTask.MessageType.CloudPushTaskStop.getNumber());
|
||||
getAutoPilotControlManager().sendSweeperStopTaskResp(reqNo, stopTaskResp);
|
||||
}
|
||||
|
||||
@@ -577,13 +591,31 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setLineId(lineId);
|
||||
SweeperBootable.IsBootable isBootable = builder.build();
|
||||
String reqNo = SweeperCloudTaskUtils.getRequestId();
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"sendSweeperAutopilotBootable" + printMessage(isBootable) + " reqNo:" + reqNo + " messageType:" + SweeperCloudTask.MessageType.PadSendBootable.getNumber());
|
||||
"sendSweeperAutopilotBootable" + printMessage(isBootable) + " reqNo:" + reqNo + " messageType:" + AiCloudTask.MessageType.PadSendBootable.getNumber());
|
||||
getAutoPilotControlManager().sendSweeperAutopilotBootable(reqNo, isBootable);
|
||||
// TODO: 2023/5/16
|
||||
//SweeperCloudTaskUtils.mockSendCloudBootable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 大任务暂停/恢复 接收到指令到 回复
|
||||
* @param taskId
|
||||
* @param code
|
||||
*/
|
||||
public void sendSweeperSuspendResumeTaskResp(String taskId, SweeperTaskCloudSuspendResume.Code code) {
|
||||
SweeperTaskCloudSuspendResume.BigTaskActionResp.Builder builder = SweeperTaskCloudSuspendResume.BigTaskActionResp.newBuilder();
|
||||
builder.setSn(getDriverSn());
|
||||
builder.setTaskId(taskId);
|
||||
builder.setCode(code);
|
||||
SweeperTaskCloudSuspendResume.BigTaskActionResp resp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(AiCloudTask.MessageType.CloudPushTaskSuspendResume.getNumber());
|
||||
|
||||
CallerLogger.d(M_SWEEPER + TAG,
|
||||
"sendSweeperSuspendResumeTaskResp" + printMessage(resp) + " reqNo:" + reqNo + " messageType:" + AiCloudTask.MessageType.CloudPushTaskSuspendResume);
|
||||
getAutoPilotControlManager().sendSweeperCloudSuspendResumeTaskResp(reqNo, resp);
|
||||
}
|
||||
|
||||
public CallerAutoPilotControlManager getAutoPilotControlManager() {
|
||||
return CallerAutoPilotControlManager.INSTANCE;
|
||||
}
|
||||
@@ -594,23 +626,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
//CallerLogger.d(M_SWEEPER + TAG, "onAutopilotStatusResponse state:" + autoPilotStatusInfo.getState());
|
||||
this.mAutopilotState = autoPilotStatusInfo.getState();
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.onAutopilotState(autoPilotStatusInfo.getState());
|
||||
}
|
||||
switch (autoPilotStatusInfo.getState()) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING://自动驾驶中
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING://平行驾驶
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -631,6 +647,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
if (status == 0x00) {//判断工控机重连后,获取当前正在执行的子任务,延时10秒,防止工控机连接上时SN为空
|
||||
CallerAutoPilotControlManager.INSTANCE.setIsSubscribeBackCameraVideoVideo(0, false);//TODO 当前3.2.0版本产品未规划后摄像头展示功能
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
getCurrentTask();
|
||||
}, 10000);
|
||||
@@ -666,11 +683,27 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
// TODO: 2023/6/19 bingbing
|
||||
//CallerLogger.d(M_SWEEPER + TAG, "onAutopilotStatusResponse state:" + state);
|
||||
this.mAutopilotState = state;
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.onAutopilotState(state);
|
||||
}
|
||||
switch (state) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING://自动驾驶中
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING://平行驾驶
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
// TODO: 2023/6/19 bingbing
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.mogo.och.sweepercloud.callback.SweeperCloudDialogClickListener
|
||||
import com.mogo.och.sweepercloud.constant.SweeperConst
|
||||
import com.mogo.och.sweepercloud.model.SweeperTaskModel
|
||||
import com.mogo.och.sweepercloud.ui.dialog.SweeperCloudDialog
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask.MessageType
|
||||
import com.zhjt.mogo.adas.data.AiCloudTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.Location
|
||||
@@ -50,7 +50,7 @@ object SweeperCloudTaskUtils {
|
||||
* 模拟云控发送任务给pad
|
||||
*/
|
||||
@JvmStatic
|
||||
fun mockSendCloudTaskInfo(messageType: MessageType) {
|
||||
fun mockSendCloudTaskInfo(messageType: AiCloudTask.MessageType) {
|
||||
val builder = TaskInfo.newBuilder()
|
||||
builder.sn = getDriverSn()
|
||||
builder.taskId = "10"
|
||||
@@ -169,7 +169,7 @@ object SweeperCloudTaskUtils {
|
||||
builder.taskId = "10"
|
||||
builder.subTaskId = "1"
|
||||
SweeperTaskModel.getInstance().onSweeperFutianCloudTaskConfirm(
|
||||
MessageType.CloudPushTaskConfirm, "${System.currentTimeMillis()}",
|
||||
AiCloudTask.MessageType.CloudPushTaskConfirm, "${System.currentTimeMillis()}",
|
||||
System.currentTimeMillis(), builder.build()
|
||||
)
|
||||
}
|
||||
@@ -185,7 +185,7 @@ object SweeperCloudTaskUtils {
|
||||
builder.subTaskId = "1"
|
||||
builder.taskStatus = SweeperCommon.TaskStatus.RUNNING
|
||||
SweeperTaskModel.getInstance().onSweeperFutianCloudTaskStatus(
|
||||
MessageType.CloudPushTaskStatus, "${System.currentTimeMillis()}",
|
||||
AiCloudTask.MessageType.CloudPushTaskStatus, "${System.currentTimeMillis()}",
|
||||
System.currentTimeMillis(), builder.build()
|
||||
)
|
||||
}
|
||||
@@ -200,7 +200,7 @@ object SweeperCloudTaskUtils {
|
||||
builder.taskId = "10"
|
||||
builder.type = SweeperTaskStop.StopTaskType.ADVANCE
|
||||
SweeperTaskModel.getInstance().onSweeperFutianCloudTaskStop(
|
||||
MessageType.CloudPushTaskStop, "${System.currentTimeMillis()}",
|
||||
AiCloudTask.MessageType.CloudPushTaskStop, "${System.currentTimeMillis()}",
|
||||
System.currentTimeMillis(), builder.build()
|
||||
)
|
||||
}
|
||||
@@ -216,7 +216,7 @@ object SweeperCloudTaskUtils {
|
||||
builder.taskStatus = SweeperCommon.TaskStatus.FINISHED
|
||||
builder.systemTime = System.currentTimeMillis()
|
||||
SweeperTaskModel.getInstance().onSweeperFutianCloudBigTaskStatus(
|
||||
MessageType.CloudPushBigTaskStatus, "${System.currentTimeMillis()}",
|
||||
AiCloudTask.MessageType.CloudPushBigTaskStatus, "${System.currentTimeMillis()}",
|
||||
System.currentTimeMillis(), builder.build()
|
||||
)
|
||||
}
|
||||
@@ -233,7 +233,7 @@ object SweeperCloudTaskUtils {
|
||||
builder.code = SweeperCommon.Code.SUCCEED
|
||||
UiThreadHandler.getsUiHandler().postDelayed({
|
||||
SweeperTaskModel.getInstance().onSweeperFutianCloudBootable(
|
||||
MessageType.PadSendBootable, "${System.currentTimeMillis()}",
|
||||
AiCloudTask.MessageType.PadSendBootable, "${System.currentTimeMillis()}",
|
||||
System.currentTimeMillis(), builder.build()
|
||||
)
|
||||
}, 10000)
|
||||
|
||||
@@ -158,5 +158,6 @@ class RightRearCamView : ConstraintLayout , IMoGoBackCameraVideoListener,
|
||||
actv_cam_position_group?.visibility = VISIBLE
|
||||
}
|
||||
v_video_right_rear?.setImageBitmap(mBitmap)
|
||||
v_video_right_rear?.scaleX = -1f
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,19 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorPosition
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
|
||||
import com.mogo.och.common.module.utils.FrameAnimatorContainer
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
|
||||
@@ -25,22 +30,30 @@ import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.starting_
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_btn_bg
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_starting
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_start_autopilot
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.v_xiaozhi_belt_info_bg
|
||||
import java.util.Arrays
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.cl_car_type
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/6/14
|
||||
*/
|
||||
class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAutopilotCallback{
|
||||
class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAutopilotCallback {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
companion object {
|
||||
private val TAG = StartAutopilotView::class.java.simpleName
|
||||
@@ -49,9 +62,9 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
|
||||
var isStarting = false
|
||||
|
||||
private var taxiPStartAutopilot: FrameAnimatorContainer?=null
|
||||
private var taxiPStartAutopilotCar: FrameAnimatorContainer?=null
|
||||
private var taxiPXiaozhiBelt: FrameAnimatorContainer?=null
|
||||
private var taxiPStartAutopilot: FrameAnimatorContainer? = null
|
||||
private var taxiPStartAutopilotCar: FrameAnimatorContainer? = null
|
||||
private var taxiPXiaozhiBelt: FrameAnimatorContainer? = null
|
||||
|
||||
|
||||
init {
|
||||
@@ -60,27 +73,35 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this, true)
|
||||
taxiPStartAutopilotCar = FrameAnimatorContainer(R.array.taxi_p_start_autopilot_car, 20,taxi_p_autopilot_starting)
|
||||
taxiPStartAutopilotCar?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
taxiPStartAutopilotCar = FrameAnimatorContainer(
|
||||
R.array.taxi_p_start_autopilot_car,
|
||||
20,
|
||||
taxi_p_autopilot_starting
|
||||
)
|
||||
taxiPStartAutopilotCar?.setOnAnimStopListener(object :
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
|
||||
}
|
||||
})
|
||||
taxiPStartAutopilot = FrameAnimatorContainer(R.array.taxi_p_start_autopilot, 15,taxi_p_autopilot_btn_bg)
|
||||
taxiPStartAutopilot?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
taxiPStartAutopilot =
|
||||
FrameAnimatorContainer(R.array.taxi_p_start_autopilot, 15, taxi_p_autopilot_btn_bg,false)
|
||||
taxiPStartAutopilot?.setOnAnimStopListener(object :
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
|
||||
}
|
||||
})
|
||||
taxiPXiaozhiBelt = FrameAnimatorContainer(R.array.xiaozhi_belt, 15,iv_xiaozhi_belt)
|
||||
taxiPXiaozhiBelt?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
taxiPXiaozhiBelt = FrameAnimatorContainer(R.array.xiaozhi_belt, 15, iv_xiaozhi_belt)
|
||||
taxiPXiaozhiBelt?.setOnAnimStopListener(object :
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun startAutopilotBgAnimatorDrawable(isStart: Boolean) {
|
||||
private fun startAutopilotBgAnimatorDrawable(isStart: Boolean) {
|
||||
if (isStart) {
|
||||
taxiPStartAutopilot?.start()
|
||||
} else {
|
||||
@@ -103,42 +124,43 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
actv_orderinfo.text = show
|
||||
}
|
||||
|
||||
override fun setDoorStatus(
|
||||
doorPosition: StartAutopilotViewModel.DoorPosition,
|
||||
isOpen: Boolean
|
||||
) {
|
||||
override fun setDoorStatus(doorPosition: DoorPosition, state: DoorState) {
|
||||
when (doorPosition) {
|
||||
StartAutopilotViewModel.DoorPosition.FRONT_LEFT -> {
|
||||
if(isOpen){
|
||||
DoorPosition.FRONT_LEFT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_front_left_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_front_left_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
StartAutopilotViewModel.DoorPosition.FRONT_RIGHT -> {
|
||||
if(isOpen){
|
||||
|
||||
DoorPosition.FRONT_RIGHT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_front_right_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_front_right_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
StartAutopilotViewModel.DoorPosition.REAR_LEFT -> {
|
||||
if(isOpen){
|
||||
|
||||
DoorPosition.REAR_LEFT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_rear_left_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_rear_left_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
StartAutopilotViewModel.DoorPosition.REAR_RIGHT -> {
|
||||
if(isOpen){
|
||||
|
||||
DoorPosition.REAR_RIGHT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_rear_right_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_rear_right_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
else ->{
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,15 +171,20 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
OverlayViewUtils.dismissOverlayView(this)
|
||||
}
|
||||
|
||||
fun updateStartAutopilotBtnStatus(isBoarded: Boolean) {
|
||||
private fun updateStartAutopilotBtnStatus(isBoarded: Boolean) {
|
||||
taxi_p_start_autopilot?.let {
|
||||
if (isBoarded) {
|
||||
it.setTextColor(resources.getColor(R.color.taxi_p_start_autopilot_txt_color))
|
||||
it.setTextColor(
|
||||
ContextCompat.getColor(context, R.color.taxi_p_start_autopilot_txt_color)
|
||||
)
|
||||
it.background = null
|
||||
} else {
|
||||
it.background = ResourcesCompat.getDrawable(resources,R.drawable.taxi_p_start_autopilot_txt_btn_bg,null)
|
||||
it.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.taxi_p_start_autopilot_txt_btn_bg)
|
||||
taxi_p_autopilot_btn_bg!!.background = null
|
||||
it.setTextColor(resources.getColor(R.color.taxi_p_start_autopilot_txt_un_color))
|
||||
it.setTextColor(
|
||||
ContextCompat.getColor(context, R.color.taxi_p_start_autopilot_txt_un_color)
|
||||
)
|
||||
}
|
||||
it.tag = isBoarded
|
||||
it.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
|
||||
@@ -165,7 +192,6 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun startingCarBgAnimatorDrawable(isStart: Boolean) {
|
||||
if (isStart) {
|
||||
taxi_p_autopilot_starting!!.setImageResource(0)
|
||||
@@ -181,7 +207,9 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
if (start) {
|
||||
isStarting = true
|
||||
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_loading)
|
||||
taxi_p_start_autopilot?.setTextColor(resources.getColor(R.color.taxi_p_start_autopilot_txt_color))
|
||||
taxi_p_start_autopilot?.setTextColor(
|
||||
ContextCompat.getColor(context, R.color.taxi_p_start_autopilot_txt_color)
|
||||
)
|
||||
startingAutopilotCountDown()
|
||||
} else {
|
||||
clearBgAnimDrawable()
|
||||
@@ -214,6 +242,15 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
super.onVisibilityChanged(changedView, visibility)
|
||||
if (HdMapBuildConfig.currentCarVrIconRes == R.raw.hq_h9) {
|
||||
cl_car_type.setBackgroundResource(R.drawable.taxi_p_start_panel__hq_bg)
|
||||
} else {
|
||||
cl_car_type.setBackgroundResource(R.drawable.taxi_p_start_panel__df_bg)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val viewModel = ViewModelProvider(this).get(StartAutopilotViewModel::class.java)
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.mogo.och.taxi.passenger.ui.startautopilot
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import chassis.Chassis
|
||||
import chassis.Chassis.DoorNumber
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisDoorStateListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
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.devicemanage.data.DoorPosition
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback
|
||||
import com.mogo.och.taxi.passenger.model.AutopilotManager
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
|
||||
import com.mogo.och.common.module.manager.devicemanage.TaxiDoorStateManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.DoorStateCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
|
||||
|
||||
class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallback,
|
||||
IMoGoChassisDoorStateListener {
|
||||
DoorStateCallback {
|
||||
|
||||
private val TAG = StartAutopilotViewModel::class.java.simpleName
|
||||
|
||||
@@ -21,38 +21,28 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
|
||||
|
||||
init {
|
||||
TaxiPassengerModel.setOrderStatusCallback(TAG, this)
|
||||
CallerChassisDoorStateListenerManager.addListener(TAG, this)
|
||||
TaxiDoorStateManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
fun setStartAutopilotCallback(viewCallback: StartAutopilotCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
TaxiPassengerModel.startOrStopReadyToAutopilotLoop(true)
|
||||
setOrderInfo()
|
||||
setDoorInfo()
|
||||
}
|
||||
|
||||
private fun setDoorInfo() {
|
||||
val doorList = CallerChassisDoorStateListenerManager.getDoorList()
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化初始化:${doorList}")
|
||||
doorList?.forEach {
|
||||
exchangeEnum(it.number,it.status==1)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setOrderInfo() {
|
||||
val currentOCHOrder = TaxiPassengerModel.currentOCHOrder
|
||||
currentOCHOrder?.let {
|
||||
val phone = it.passengerPhone
|
||||
var show = ""
|
||||
if (phone.length > 8) {
|
||||
val show = if (phone.length > 8) {
|
||||
//截取电话号码前三位
|
||||
val phoneNumPre = phone.substring(0, 3);
|
||||
val phoneNumPre = phone.substring(0, 3)
|
||||
//截取电话号码后四位
|
||||
val phoneNumFix = phone.substring(7);
|
||||
val phoneNumFix = phone.substring(7)
|
||||
|
||||
show = "用户:$phoneNumPre****$phoneNumFix 目的地:${it.endSiteAddr}"
|
||||
"用户:$phoneNumPre****$phoneNumFix 目的地:${it.endSiteAddr}"
|
||||
} else {
|
||||
show = "用户:${phone} 目的地:${it.endSiteAddr}"
|
||||
"用户:${phone} 目的地:${it.endSiteAddr}"
|
||||
}
|
||||
viewCallback?.setOrderInfo(show)
|
||||
}
|
||||
@@ -62,7 +52,7 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
TaxiPassengerModel.setOrderStatusCallback(TAG, null)
|
||||
CallerChassisDoorStateListenerManager.removeListener(TAG)
|
||||
TaxiDoorStateManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onDriverHasCheckedPilotCondition(isBoarded: Boolean) {
|
||||
@@ -76,41 +66,18 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
|
||||
AutopilotManager.startAutopilot()
|
||||
}
|
||||
|
||||
override fun onAutopilotSingleDoorState(num: Chassis.DoorNumber, open: Boolean) {
|
||||
super.onAutopilotSingleDoorState(num, open)
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${num}--${open}")
|
||||
exchangeEnum(num,open)
|
||||
override fun hasOpenDoor(have: Boolean) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "车门是否开着:${have}")
|
||||
}
|
||||
|
||||
private fun exchangeEnum(num: Chassis.DoorNumber,open: Boolean){
|
||||
when (num) {
|
||||
DoorNumber.FRONT_LEFT -> {
|
||||
runMain(DoorPosition.FRONT_LEFT,open)
|
||||
}
|
||||
|
||||
DoorNumber.FRONT_RIGHT -> {
|
||||
runMain(DoorPosition.FRONT_RIGHT,open)
|
||||
}
|
||||
|
||||
DoorNumber.REAR_LEFT -> {
|
||||
runMain(DoorPosition.REAR_LEFT,open)
|
||||
}
|
||||
|
||||
DoorNumber.REAR_RIGHT -> {
|
||||
runMain(DoorPosition.REAR_RIGHT,open)
|
||||
}
|
||||
|
||||
DoorNumber.MIDDLE -> {
|
||||
runMain(DoorPosition.MIDDLE,open)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
override fun doorStateChangeCallback(position: DoorPosition, state: DoorState) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${position}--${state}")
|
||||
runMain(position,state)
|
||||
}
|
||||
|
||||
private fun runMain(posttion:DoorPosition,isOpen: Boolean){
|
||||
private fun runMain(posttion:DoorPosition,state: DoorState){
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setDoorStatus(posttion,isOpen)
|
||||
viewCallback?.setDoorStatus(posttion,state)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +85,6 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
|
||||
interface StartAutopilotCallback {
|
||||
fun handleStartAutopilotBtnStatus(isBoarded: Boolean)
|
||||
fun setOrderInfo(show: String)
|
||||
fun setDoorStatus(doorPosition: DoorPosition,isOpen:Boolean)
|
||||
}
|
||||
|
||||
enum class DoorPosition {
|
||||
FRONT_LEFT, FRONT_RIGHT, REAR_LEFT, REAR_RIGHT, MIDDLE
|
||||
fun setDoorStatus(doorPosition: DoorPosition, state: DoorState)
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.1 MiB |
|
After Width: | Height: | Size: 420 KiB |
|
After Width: | Height: | Size: 418 KiB |
BIN
OCH/taxi/passenger/src/main/res/drawable/image_00000_0.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
@@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/taxi_p_setting_view_bg">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/cl_car_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/taxi_p_passenger_start_panel_bg"
|
||||
android:background="@drawable/taxi_p_start_panel__df_bg"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<ImageView
|
||||
@@ -33,6 +34,7 @@
|
||||
android:layout_width="1000dp"
|
||||
android:layout_height="500dp"
|
||||
android:clickable="false"
|
||||
android:src="@drawable/image_00000_0"
|
||||
android:layout_marginBottom="@dimen/dp_62"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
||||
@@ -20,7 +20,7 @@ abstract class BaseViewModel<UiState : IUiState, UiIntent : IUiIntent> : ViewMod
|
||||
val uiStateFlow: StateFlow<UiState> = _uiStateFlow
|
||||
|
||||
private val _uiIntentFlow: Channel<UiIntent> = Channel()
|
||||
val uiIntentFlow: Flow<UiIntent> = _uiIntentFlow.receiveAsFlow()
|
||||
private val uiIntentFlow: Flow<UiIntent> = _uiIntentFlow.receiveAsFlow()
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
|
||||
@@ -7,19 +7,29 @@ import com.mogo.eagle.core.data.BaseData
|
||||
* @date: 2023/8/2
|
||||
*/
|
||||
|
||||
data class GcjLatLon(var gcjLat: Double, var gcjLon: Double)
|
||||
data class GcjLatLon(
|
||||
var gcjLat: Double, var gcjLon: Double
|
||||
)
|
||||
|
||||
data class UnmannedLoginReqBean(
|
||||
var phone: String?,
|
||||
var captcha: String?,
|
||||
var sn: String,
|
||||
var loc: GcjLatLon?
|
||||
var phone: String?, var captcha: String?, var sn: String, var loc: GcjLatLon?
|
||||
)
|
||||
data class UnmannedLogoutReqBean(var sn: String, var loc: GcjLatLon?)
|
||||
|
||||
data class StartServiceReqBean(var sn: String, var gcjLat: Double, var gcjLon: Double)
|
||||
data class UnmannedLogoutReqBean(
|
||||
var sn: String, var loc: GcjLatLon?
|
||||
)
|
||||
|
||||
data class StartServiceRespBean(var data: Result?): BaseData(){
|
||||
data class Result(var siteId: Long,var siteName: String,var gcjLat: Double, var gcjLon: Double,
|
||||
var wgs84Lon: Double, var wgs84Lat: Double )
|
||||
data class StartServiceReqBean(
|
||||
var sn: String, var gcjLat: Double, var gcjLon: Double
|
||||
)
|
||||
|
||||
data class StartServiceRespBean(var data: Result?) : BaseData() {
|
||||
data class Result(
|
||||
var siteId: Long,
|
||||
var siteName: String,
|
||||
var gcjLat: Double,
|
||||
var gcjLon: Double,
|
||||
var wgs84Lon: Double,
|
||||
var wgs84Lat: Double
|
||||
)
|
||||
}
|
||||
@@ -81,9 +81,11 @@ data class QueryCurrentTaskRespBean(var data: Result?) : BaseData() {
|
||||
var endSite: Site?,
|
||||
var order: OrderDetail?
|
||||
) {
|
||||
//servingStatus = 0 //暂停接单 = 1 //开始接单
|
||||
//taskType = 1 //虚拟任务 = 2 //接驾任务 = 3 //送驾任务
|
||||
//currentStatus 0:空闲 1:获取任务 2:开始任务 3:到达目的地
|
||||
/**
|
||||
* servingStatus: 0 -> 暂停接单 1 -> 开始接单
|
||||
* taskType: 1 -> 虚拟任务 2 -> 接驾任务 3-> 送驾任务
|
||||
* currentStatus: 0-> 空闲 1-> 获取任务 2-> 开始任务 3-> 到达目的地
|
||||
*/
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
@@ -161,13 +163,41 @@ data class QueryCurrentTaskRespBean(var data: Result?) : BaseData() {
|
||||
}
|
||||
return data.currentStatus == TaskStatusEnum.StartTask.code
|
||||
}
|
||||
|
||||
/**
|
||||
* with task.currentStatus == CompleteTask
|
||||
*/
|
||||
fun isCompleteTaskType(data: QueryCurrentTaskRespBean.Result?): Boolean {
|
||||
if (data == null) {
|
||||
return false
|
||||
}
|
||||
return data.currentStatus == TaskStatusEnum.CompleteTask.code
|
||||
}
|
||||
|
||||
/**
|
||||
* with task.currentStatus == GetTask
|
||||
*/
|
||||
fun isGetTaskType(data: QueryCurrentTaskRespBean.Result?): Boolean {
|
||||
if (data == null) {
|
||||
return false
|
||||
}
|
||||
return data.currentStatus == TaskStatusEnum.GetTask.code
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class StartTaskReqBean(var sn: String, var lineId: Long)
|
||||
data class StartTaskReqBean(
|
||||
var sn: String, var lineId: Long
|
||||
)
|
||||
|
||||
data class ArriveSiteReqBean(
|
||||
var sn: String, var siteId: Long
|
||||
)
|
||||
|
||||
data class PrepareTaskReqBean(
|
||||
var sn: String, var siteId: Long
|
||||
)
|
||||
|
||||
data class ArriveSiteReqBean(var sn: String, var siteId: Long)
|
||||
data class PrepareTaskReqBean(var sn: String, var siteId: Long)
|
||||
data class PrepareTaskRespBean(var data: Result?) : BaseData() { //taskType 1:虚拟任务 2:接驾任务3:送驾任务
|
||||
data class Result(
|
||||
var lineId: Long,
|
||||
@@ -178,10 +208,22 @@ data class PrepareTaskRespBean(var data: Result?) : BaseData() { //taskType 1:
|
||||
)
|
||||
}
|
||||
|
||||
data class JumpPassengerCheckReqBean(var sn: String, var orderNo: String)
|
||||
data class CancelOrderReqBean(var sn: String, var orderNo: String, var cancelType: Int)
|
||||
data class OrderCompletedReqBean(var sn: String, var orderNo: String)
|
||||
data class QueryCarOrderByNoReqBean(var sn: String, var orderNo: String)
|
||||
data class JumpPassengerCheckReqBean(
|
||||
var sn: String, var orderNo: String
|
||||
)
|
||||
|
||||
data class CancelOrderReqBean(
|
||||
var sn: String, var orderNo: String, var cancelType: Int
|
||||
)
|
||||
|
||||
data class OrderCompletedReqBean(
|
||||
var sn: String, var orderNo: String
|
||||
)
|
||||
|
||||
data class QueryCarOrderByNoReqBean(
|
||||
var sn: String, var orderNo: String
|
||||
)
|
||||
|
||||
data class QueryCarOrderByNoRespBean(var data: Result) : BaseData() {
|
||||
data class Result(
|
||||
var sn: String,
|
||||
|
||||
@@ -19,4 +19,11 @@ public interface ITaxiControllerStatusCallback {
|
||||
|
||||
//自动开启自动驾驶
|
||||
void startOpenAutopilotNonManual();
|
||||
|
||||
//停止启动自动驾驶
|
||||
void stopOpenAutopilotNonManual();
|
||||
|
||||
void pauseOpenAutopilotNonManual();
|
||||
|
||||
void resumeOpenAutopilotNonManual();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,4 @@ public interface ITaxiOrderStatusCallback {
|
||||
* @param isShow 是否显示导航地图(否播报声音)
|
||||
*/
|
||||
void onNaviToEnd(boolean isAmap, boolean isShow);
|
||||
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentOrderDistToEndChanged(long meters, long timeInSecond);
|
||||
}
|
||||
|
||||
@@ -5,13 +5,15 @@ import com.mogo.och.taxi.bean.TrajectoryListRespBean
|
||||
|
||||
interface ITaxiTaskWithOrderCallback {
|
||||
fun onTaskWithOrderDataChanged(taskWithOrder: QueryCurrentTaskRespBean.Result?)
|
||||
fun onTaskCompleted(isOrderArrivedAtStart: Boolean, siteId: Long)
|
||||
fun onTaskCompleted(result: QueryCurrentTaskRespBean.Result)
|
||||
fun onTaskTrajectoryDataChanged(data: TrajectoryListRespBean?)
|
||||
fun onOrderCancel()
|
||||
fun onOrderArriveAtEnd(orderNo: String)
|
||||
fun onOrderTotalMileAndDurationChanged(mileage: Float, duration: Int)
|
||||
fun onOrderTripInfoChanged(mileage: Float, duration: Int)
|
||||
fun onOrderJourneyCompleted()
|
||||
fun onStartAutopilot()
|
||||
|
||||
fun onStartPrepareTask120s(isStart: Boolean)
|
||||
fun onStartAutopilot(postDelayTime: Long)
|
||||
fun onPauseStartAutopilot()
|
||||
fun onStopAutopilot()
|
||||
fun onStartPrepareTaskUI(delayTime: Long, isStart: Boolean)
|
||||
fun onTaskTripInfoLocalCalculateChanged(meters:Long, timeInSecond:Long)
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
package com.mogo.och.taxi.constant/**
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
|
||||
/**
|
||||
* Created on 2023/8/7
|
||||
* taskType = 1 虚拟任务(演练任务), = 2 接驾任务(运营), = 3 //送驾任务(运营)
|
||||
*/
|
||||
@@ -18,5 +22,15 @@ enum class TaskTypeEnum(val code: Int) {
|
||||
}
|
||||
return None
|
||||
}
|
||||
|
||||
/**
|
||||
* taskType == ToOrderStartTask.code 接驾任务
|
||||
*/
|
||||
fun isToOrderStartTask(data: QueryCurrentTaskRespBean.Result?): Boolean {
|
||||
if (data == null) {
|
||||
return false
|
||||
}
|
||||
return data.taskType == ToOrderStartTask.code
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.taxi.constant;
|
||||
|
||||
public interface TaxiDriverEventConst {
|
||||
|
||||
interface TaxiFragmentEvent {
|
||||
String EVENT_TYPE_SHOW_DEBUG_VIEW = "event_type_taxi_fragment_show_debug_view";
|
||||
String EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT = "event_type_taxi_fragment_show_amap_navi_to_station_fragment";
|
||||
String EVENT_TYPE_SHOW_ROUTING_TO_STATION_FRAGMENT = "event_type_taxi_fragment_show_routing_to_station_fragment";
|
||||
String EVENT_TYPE_START_NAVI_TO_END_STATION = "event_type_taxi_fragment_start_navi_to_end_station";
|
||||
}
|
||||
|
||||
interface TabFragmentEvent {
|
||||
String EVENT_TYPE_SHOW_RED_POINT = "event_type_tab_fragment_show_red_point";
|
||||
String EVENT_TYPE_TASK_WITH_ORDER_CHANGED = "event_type_tab_fragment_task_with_order_changed";
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ interface TaxiTaskWithOrderServiceApi {
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/business/v1/contrail")
|
||||
fun contrailList(
|
||||
fun queryTrajectoryByLindIds(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = MoGoAiCloudClientConfig.getInstance().token,
|
||||
@Body data: Array<Long>
|
||||
|
||||
@@ -179,9 +179,9 @@ object TaxiTaskWithOrderServiceManager {
|
||||
context: Context, linIds: Array<Long>,
|
||||
callback: OchCommonServiceCallback<TrajectoryListRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.contrailList(
|
||||
mOCHTaxiServiceApi.queryTrajectoryByLindIds(
|
||||
data = linIds
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "contrailList"))
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryTrajectoryByLindIds"))
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.SystemClock
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -23,6 +21,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.initBa
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showToolsView
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.ParallelDriveView
|
||||
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.mogo.view.OnPreventFastClickListener
|
||||
@@ -50,6 +49,7 @@ import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_autopilot_tv
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_taxi_badcase_ll
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_taxi_setting_layout
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_och_taxi_swich_map_layout
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.parallelDriveView
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.smallMapView
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.startAutopilotAnimationView
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_close_navi_icon
|
||||
@@ -75,11 +75,9 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
// 高德地图轨迹展示fragment
|
||||
private var taxiRoutingNaviFragment: TaxiRoutingNaviFragment? = null
|
||||
|
||||
// 开发调试时展示信息德panel
|
||||
// 开发调试时展示信息的panel
|
||||
private var debugPanelView: View? = null
|
||||
|
||||
private val mHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
private val startAutopilotDrawableIds = arrayOf(
|
||||
R.drawable.anim_flow_00000, R.drawable.anim_flow_00001, R.drawable.anim_flow_00002,
|
||||
R.drawable.anim_flow_00003, R.drawable.anim_flow_00004, R.drawable.anim_flow_00005,
|
||||
@@ -192,6 +190,13 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
showToolsView()
|
||||
}
|
||||
|
||||
//点击主动请求平行驾驶: 若在倒计时请求自驾中, 取消请求
|
||||
parallelDriveView.setClickEventListener(object: ParallelDriveView.ClickEventListener{
|
||||
override fun onReqClick() {
|
||||
stopAutoStartAutopilot()
|
||||
}
|
||||
})
|
||||
|
||||
// mBadCaseBtn的visible显示逻辑在showBadcaseEntrance内处理
|
||||
if (module_och_taxi_badcase_ll != null) {
|
||||
initBadCase(module_och_taxi_badcase_ll)
|
||||
@@ -262,6 +267,8 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
})
|
||||
}
|
||||
|
||||
abstract fun stopAutoStartAutopilot()
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView.onCreate(savedInstanceState)
|
||||
@@ -361,11 +368,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
mPreAutoPilotStatus = parallelDrivingValue
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
// TODO 确认
|
||||
fun updateCtvAutopilotStatusTag(tag: Boolean) {
|
||||
private fun updateCtvAutopilotStatusTag(tag: Boolean) {
|
||||
module_mogo_och_autopilot_status.tag = tag
|
||||
}
|
||||
|
||||
@@ -460,7 +463,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
autopilotLoadingAnimator!!.startDelay = 100
|
||||
autopilotLoadingAnimator!!.duration = 1000 //设置持续时间
|
||||
autopilotLoadingAnimator!!.start() //动画开始
|
||||
startingAutoApilotCountDown()
|
||||
startingAutopilotCountDown()
|
||||
} else {
|
||||
isStarting = false
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
@@ -496,13 +499,13 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
)
|
||||
module_och_autopilot_iv.setImageResource(R.drawable.taxi_ic_autopilot_failed)
|
||||
}
|
||||
mHandler.postDelayed({
|
||||
UiThreadHandler.postDelayed({
|
||||
startOrStopLoadingAnim(false)
|
||||
onAutopilotStatusChanged(getState())
|
||||
}, 1000L)
|
||||
}
|
||||
|
||||
private fun startingAutoApilotCountDown() {
|
||||
private fun startingAutopilotCountDown() {
|
||||
UiThreadHandler.postDelayed({
|
||||
//未启动成功10s后做处理
|
||||
if (isStarting) { //判断动画是否在进行
|
||||
@@ -607,7 +610,8 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
smallMapView.visibility = View.GONE
|
||||
} else {
|
||||
taxi_close_navi_icon.visibility = View.GONE
|
||||
module_mogo_och_navi_panel_container.visibility = View.INVISIBLE //2023.9.4高德导航由gone设置成INVISIBLE,保留导航实例,避免导航被挂起
|
||||
module_mogo_och_navi_panel_container.visibility =
|
||||
View.INVISIBLE //2023.9.4高德导航由gone设置成INVISIBLE,保留导航实例,避免导航被挂起
|
||||
smallMapView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
@@ -617,15 +621,37 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
|
||||
fun showStartAutopilotBlinkAnimation() {
|
||||
startAutopilotAnimationView.show(
|
||||
StartAutopilotAnimationView.DirectionEnum.ALERT_WARNING_TOP,
|
||||
START_AUTOPILOT_ANIMATION_INTERVAL
|
||||
)
|
||||
START_AUTOPILOT_ANIMATION_INTERVAL,
|
||||
object : StartAutopilotAnimationView.AnimationViewTimerListener{
|
||||
override fun onTimerResume(remainingTime: Long) {
|
||||
resumeStartAutopilot(remainingTime)
|
||||
}
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
stopStartAutopilotBlinkAnimation()
|
||||
}, START_AUTOPILOT_ANIMATION_INTERVAL)
|
||||
override fun onTimerPause() {
|
||||
pauseStartAutopilot()
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
abstract fun pauseStartAutopilot()
|
||||
|
||||
abstract fun resumeStartAutopilot(remainingTime: Long)
|
||||
|
||||
fun stopAutopilotBlinkAnimation(){
|
||||
stopStartAutopilotBlinkAnimation()
|
||||
}
|
||||
|
||||
private fun stopStartAutopilotBlinkAnimation() {
|
||||
startAutopilotAnimationView.dismiss(StartAutopilotAnimationView.DirectionEnum.ALERT_WARNING_TOP)
|
||||
}
|
||||
|
||||
fun pauseAutopilotBlinkAnimation(){
|
||||
startAutopilotAnimationView.pause()
|
||||
}
|
||||
|
||||
fun resumeAutopilotBlinkAnimation(){
|
||||
startAutopilotAnimationView.resume()
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,9 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.LoginService
|
||||
import com.mogo.och.common.module.utils.FlowBus
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiDriverEventConst
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.network.TaxiDriverLoginImpl
|
||||
import com.mogo.och.taxi.ui.personal.TaxiPersonalDialogFragment
|
||||
@@ -70,13 +71,13 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
// }
|
||||
}
|
||||
|
||||
private fun openOperationalInfoView() {
|
||||
personalDialogFragment = WeakReference(TaxiPersonalDialogFragment())
|
||||
activity?.supportFragmentManager?.let {
|
||||
personalDialogFragment!!.get()
|
||||
?.show(it, "service_data")
|
||||
}
|
||||
}
|
||||
// private fun openOperationalInfoView() {
|
||||
// personalDialogFragment = WeakReference(TaxiPersonalDialogFragment())
|
||||
// activity?.supportFragmentManager?.let {
|
||||
// personalDialogFragment!!.get()
|
||||
// ?.show(it, "service_data")
|
||||
// }
|
||||
// }
|
||||
|
||||
override fun getTagName(): String {
|
||||
return "TaxiFragment"
|
||||
@@ -86,9 +87,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
loginService =
|
||||
ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation() as LoginService
|
||||
if (loginService != null) {
|
||||
loginService!!.registerFragment(this, presenter, TaxiDriverLoginImpl())
|
||||
}
|
||||
loginService?.registerFragment(this, presenter, TaxiDriverLoginImpl())
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
@@ -112,12 +111,21 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun pauseStartAutopilot() {
|
||||
mPresenter.pauseStartAutopilot()
|
||||
}
|
||||
|
||||
override fun resumeStartAutopilot(remainingTime: Long) {
|
||||
mPresenter.resumeStartAutopilot(remainingTime)
|
||||
}
|
||||
|
||||
override fun startNaviToEndStation(isShow: Boolean) {
|
||||
mPresenter.startNaviToEndStation(isShow)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
super.initViews()
|
||||
initFlowEvent()
|
||||
initFragment()
|
||||
hideDebugPanel()
|
||||
switchVRFlatMode(MogoStatusManager.getInstance().isVrMode)
|
||||
@@ -125,6 +133,29 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
initOrderDebugView()
|
||||
}
|
||||
|
||||
override fun stopAutoStartAutopilot() {
|
||||
mPresenter.stopAutoStartAutopilot()
|
||||
}
|
||||
|
||||
private fun initFlowEvent() {
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW)
|
||||
.register(this) { _ ->
|
||||
clickOrderDebugView()
|
||||
}
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
|
||||
.register(this) { show ->
|
||||
showAmapNaviToStationFragment(show)
|
||||
}
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_ROUTING_TO_STATION_FRAGMENT)
|
||||
.register(this) { show ->
|
||||
showRoutingToStationFragment(show)
|
||||
}
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_START_NAVI_TO_END_STATION)
|
||||
.register(this) { show ->
|
||||
startNaviToEndStation(show)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initFragment() {
|
||||
taskTabFragment = WeakReference(TaxiTaskTabFragment.newInstance())
|
||||
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
|
||||
@@ -147,11 +178,6 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
taskTabFragment!!.get()!!.onCarTakeOrderStatusChanged()
|
||||
}
|
||||
|
||||
fun updateNextTaskFragment(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
||||
if (null == taskTabFragment || taskTabFragment!!.get() == null) return
|
||||
taskTabFragment!!.get()!!.onTaskDataChanged(taskAndOrder)
|
||||
}
|
||||
|
||||
fun switchVRFlatMode(isVRMode: Boolean) {
|
||||
if (mRootView != null) {
|
||||
mRootView.visibility = if (isVRMode) View.VISIBLE else View.GONE
|
||||
@@ -243,7 +269,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
it.order!!.orderLine
|
||||
else
|
||||
it.lineId
|
||||
)
|
||||
,true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,11 +283,15 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
findViewById<View>(R.id.test_bar_route)?.setOnClickListener {
|
||||
testRouteInfoUpload()
|
||||
}
|
||||
}
|
||||
|
||||
fun onCurrentOrderDistToEndChanged(meters: Long, timeInSecond: Long) {
|
||||
if (null == taskTabFragment || taskTabFragment!!.get() == null) return
|
||||
taskTabFragment!!.get()!!.onCurrentTaskTripInfoChanged(meters, timeInSecond)
|
||||
findViewById<View>(R.id.test_brake)?.setOnClickListener {
|
||||
TaxiTaskModel.handleBrakeStatusChange(false)
|
||||
}
|
||||
findViewById<View>(R.id.test_resume_brake)?.setOnClickListener {
|
||||
TaxiTaskModel.handleBrakeStatusChange(true)
|
||||
}
|
||||
findViewById<View>(R.id.test_parallel_driver)?.setOnClickListener {
|
||||
stopAutoStartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
private fun testRouteInfoUpload() {
|
||||
|
||||
@@ -9,6 +9,7 @@ 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.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
@@ -77,7 +78,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
* 开启自动驾驶 自驾模式
|
||||
*/
|
||||
public void startAutoPilot() {
|
||||
TaxiTaskModel.INSTANCE.startAutoPilot();
|
||||
TaxiTaskModel.INSTANCE.startAutopilotByClick();
|
||||
}
|
||||
|
||||
// 登出
|
||||
@@ -137,11 +138,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
runOnUIThread(() -> mView.onNaviToEnd(isAmap, isShow));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.onCurrentOrderDistToEndChanged(meters, timeInSecond));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
runOnUIThread(() -> mView.switchVRFlatMode(isVRMode));
|
||||
@@ -171,6 +167,33 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopOpenAutopilotNonManual() {
|
||||
runOnUIThread(() -> {
|
||||
mView.startOrStopLoadingAnim(false);
|
||||
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
|
||||
mView.stopAutopilotBlinkAnimation();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseOpenAutopilotNonManual() {
|
||||
runOnUIThread(() -> {
|
||||
mView.startOrStopLoadingAnim(false);
|
||||
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
|
||||
mView.pauseAutopilotBlinkAnimation();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeOpenAutopilotNonManual() {
|
||||
runOnUIThread(() -> {
|
||||
mView.startOrStopLoadingAnim(true);
|
||||
mView.resumeAutopilotBlinkAnimation();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loginSuccess(DriverStatusQueryRespBean data) {
|
||||
//设置 接单状态
|
||||
@@ -196,4 +219,16 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
@Override
|
||||
public void loginFail(boolean isLogin) {
|
||||
}
|
||||
|
||||
public void stopAutoStartAutopilot() {
|
||||
TaxiTaskModel.INSTANCE.stopAutoStartAutopilot();
|
||||
}
|
||||
|
||||
public void pauseStartAutopilot() {
|
||||
TaxiTaskModel.INSTANCE.pauseStartAutopilot();
|
||||
}
|
||||
|
||||
public void resumeStartAutopilot(long remainingTime) {
|
||||
TaxiTaskModel.INSTANCE.resumeStartAutopilot(remainingTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ open class AvoidLeakDialog : Dialog {
|
||||
override fun setOnShowListener(listener: OnShowListener?) {}
|
||||
override fun dismiss() {
|
||||
super.dismiss()
|
||||
if (null != hostFragmentReference && null != hostFragmentReference!!.get()) {
|
||||
hostFragmentReference!!.get()!!.dismissAllowingStateLoss()
|
||||
}
|
||||
hostFragmentReference?.get()?.dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class DebugView @JvmOverloads constructor(
|
||||
initViewByData(taskWithOrder)
|
||||
}
|
||||
|
||||
override fun onTaskCompleted(isOrderArrivedAtStart: Boolean, siteId: Long) {
|
||||
override fun onTaskCompleted(result: QueryCurrentTaskRespBean.Result) {
|
||||
}
|
||||
|
||||
override fun onTaskTrajectoryDataChanged(data: TrajectoryListRespBean?) {
|
||||
@@ -189,15 +189,24 @@ public class DebugView @JvmOverloads constructor(
|
||||
override fun onOrderArriveAtEnd(orderNo: String) {
|
||||
}
|
||||
|
||||
override fun onOrderTotalMileAndDurationChanged(mileage: Float, duration: Int) {
|
||||
override fun onOrderTripInfoChanged(mileage: Float, duration: Int) {
|
||||
}
|
||||
|
||||
override fun onOrderJourneyCompleted() {
|
||||
}
|
||||
|
||||
override fun onStartAutopilot() {
|
||||
override fun onStartAutopilot(postDelayTime: Long) {
|
||||
}
|
||||
|
||||
override fun onStartPrepareTask120s(isStart: Boolean) {
|
||||
override fun onPauseStartAutopilot() {
|
||||
}
|
||||
|
||||
override fun onStopAutopilot() {
|
||||
}
|
||||
|
||||
override fun onStartPrepareTaskUI(delayTime: Long, isStart: Boolean) {
|
||||
}
|
||||
|
||||
override fun onTaskTripInfoLocalCalculateChanged(meters: Long, timeInSecond: Long) {
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,10 @@ sealed class TaskWithOrderUIState {
|
||||
data class TaskDriveToNearestStationTask(val driveToNearestStationTask: StartServiceRespBean.Result?) :
|
||||
TaskWithOrderUIState()
|
||||
|
||||
data class UpdateTaskTripInfo(val mileage: Float, val duration: Int) : TaskWithOrderUIState()
|
||||
data class UpdateOrderTripInfo(val mileage: Float, val duration: Int) : TaskWithOrderUIState()
|
||||
|
||||
data class UpdatePrepareTaskDelay120S(val isStart: Boolean) : TaskWithOrderUIState()
|
||||
data class UpdateTaskTripLocalCalculateInfo(val meters: Long, val timeInSecond: Long) :
|
||||
TaskWithOrderUIState()
|
||||
|
||||
data class UpdatePrepareTaskDelay(val delayTime: Long, val isStart: Boolean) : TaskWithOrderUIState()
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.FlowBus
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog
|
||||
import com.mogo.och.taxi.R
|
||||
@@ -35,12 +36,11 @@ import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.constant.TaxiDriverEventConst
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TAXI_END_MAP_MAKER
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TAXI_START_MAP_MAKER
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TIMER_PREPARE_TASK_INTERVAL_120S
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TYPE_MARKER_TAXI_ORDER
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
import com.mogo.och.taxi.utils.MapMakerManager
|
||||
import com.mogo.och.taxi.utils.TaskUtils
|
||||
import kotlinx.android.synthetic.main.task_fragment_current.cancelOrder
|
||||
@@ -75,10 +75,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
|
||||
companion object {
|
||||
const val TAG = M_TAXI + "TaxiCurrentTaskFragment"
|
||||
private var mTaxiFragment: TaxiFragment? = null
|
||||
|
||||
fun newInstance(taxiFragment: TaxiFragment?): TaxiCurrentTaskFragment {
|
||||
mTaxiFragment = taxiFragment
|
||||
fun newInstance(): TaxiCurrentTaskFragment {
|
||||
val args = Bundle()
|
||||
val fragment = TaxiCurrentTaskFragment()
|
||||
fragment.arguments = args
|
||||
@@ -145,7 +143,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
|
||||
private fun initTaskDebugViewListener() {
|
||||
taskStatus.setOnLongClickListener {
|
||||
mTaxiFragment?.clickOrderDebugView()
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW)
|
||||
.post(this.lifecycleScope, true)
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -166,7 +165,7 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
if (taskAndOrderUiState.driveToNearestStationTask != null) {
|
||||
updateViewByDriveToNearestStationTask(taskAndOrderUiState.driveToNearestStationTask)
|
||||
} else {
|
||||
updatePrepareTaskDelay120SUI(false)
|
||||
updatePrepareTaskDelayUI(0, false)
|
||||
initContainerView(false)
|
||||
removeAllMapMarker()
|
||||
}
|
||||
@@ -184,7 +183,7 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
updateViewByCurrentTaskWithOrder(currentTaskWithOrder)
|
||||
}
|
||||
|
||||
is TaskWithOrderUIState.UpdateTaskTripInfo -> {
|
||||
is TaskWithOrderUIState.UpdateOrderTripInfo -> {
|
||||
taskOtherInfo.text =
|
||||
TaskUtils.getCurrentTaskTotalAndDurationHtml(
|
||||
taskAndOrderUiState.mileage,
|
||||
@@ -192,8 +191,18 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
)
|
||||
}
|
||||
|
||||
is TaskWithOrderUIState.UpdatePrepareTaskDelay120S -> {
|
||||
updatePrepareTaskDelay120SUI(taskAndOrderUiState.isStart)
|
||||
is TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo -> {
|
||||
updateCurrentTaskTripInfo(
|
||||
taskAndOrderUiState.meters,
|
||||
taskAndOrderUiState.timeInSecond
|
||||
)
|
||||
}
|
||||
|
||||
is TaskWithOrderUIState.UpdatePrepareTaskDelay -> {
|
||||
updatePrepareTaskDelayUI(
|
||||
taskAndOrderUiState.delayTime,
|
||||
taskAndOrderUiState.isStart
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,35 +212,36 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
/**
|
||||
* 更新120s倒计时
|
||||
*/
|
||||
private fun updatePrepareTaskDelay120SUI(isStart: Boolean) {
|
||||
private fun updatePrepareTaskDelayUI(millisInFuture: Long, isStart: Boolean) {
|
||||
|
||||
if (!isStart){
|
||||
prepareTaskCountdownTv.visibility = View.GONE
|
||||
if (!isStart) {
|
||||
prepareTaskCountdownTv.visibility = View.GONE
|
||||
mPrepareTasCountDownTimer?.cancel()
|
||||
mPrepareTasCountDownTimer = null
|
||||
return
|
||||
}
|
||||
|
||||
prepareTaskCountdownTv.visibility = View.VISIBLE
|
||||
mPrepareTasCountDownTimer = object : CountDownTimer(TIMER_PREPARE_TASK_INTERVAL_120S, 1000L) {// 5倒计时后开启自驾
|
||||
prepareTaskCountdownTv.visibility = View.VISIBLE
|
||||
mPrepareTasCountDownTimer =
|
||||
object : CountDownTimer(millisInFuture, 1000L) {// 5倒计时后开启自驾
|
||||
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
// 倒计时
|
||||
UiThreadHandler.post {
|
||||
prepareTaskCountdownTv.text =
|
||||
"距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished/1000)}"
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
// 倒计时
|
||||
UiThreadHandler.post {
|
||||
prepareTaskCountdownTv.text =
|
||||
"距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//倒计时结束了...
|
||||
UiThreadHandler.post {
|
||||
prepareTaskCountdownTv.visibility = View.GONE
|
||||
}
|
||||
mPrepareTasCountDownTimer?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//倒计时结束了...
|
||||
UiThreadHandler.post {
|
||||
prepareTaskCountdownTv.visibility = View.GONE
|
||||
}
|
||||
mPrepareTasCountDownTimer?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
mPrepareTasCountDownTimer?.start()
|
||||
}
|
||||
|
||||
@@ -283,9 +293,21 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNextTaskFragment(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
||||
mTaxiFragment?.let {
|
||||
it.updateNextTaskFragment(taskAndOrder)
|
||||
private fun updateNextTaskFragment(result: QueryCurrentTaskRespBean.Result?) {
|
||||
FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
|
||||
.post(this.lifecycleScope, result)
|
||||
|
||||
if (result != null
|
||||
&& result.taskType == TaskTypeEnum.VirtualTask.code
|
||||
&& result.order != null
|
||||
&& result.currentStatus != TaskStatusEnum.CompleteTask.code
|
||||
) {
|
||||
VoiceNotice.showNotice("已为您提前接到下一订单,待完成当前任务后服务")
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT)
|
||||
.post(this.lifecycleScope, true)
|
||||
} else {
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT)
|
||||
.post(this.lifecycleScope, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,24 +324,21 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
*/
|
||||
private fun updateRemainDistanceAndTime(isVoicePlay: Boolean) {
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
|
||||
d(TAG, "updateRemainDistanceAndTime ${currentTaskWithOrder.currentStatus}")
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) {
|
||||
if (currentTaskWithOrder.endSite != null) {
|
||||
startNaviToStation(
|
||||
isVoicePlay, currentTaskWithOrder.endSite!!.gcjLat,
|
||||
currentTaskWithOrder.endSite!!.gcjLon
|
||||
)
|
||||
}
|
||||
|
||||
if (currentTaskWithOrder.endSite != null
|
||||
&& currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code
|
||||
} else if (currentTaskWithOrder.currentStatus == TaskStatusEnum.CompleteTask.code &&
|
||||
currentTaskWithOrder.taskType <= TaskTypeEnum.ToOrderStartTask.code
|
||||
) {
|
||||
startNaviToStation(
|
||||
isVoicePlay, currentTaskWithOrder.endSite!!.gcjLat,
|
||||
currentTaskWithOrder.endSite!!.gcjLon
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (currentTaskWithOrder.startSite != null
|
||||
&& currentTaskWithOrder.currentStatus == TaskStatusEnum.GetTask.code
|
||||
) { //演练任务和送驾任务
|
||||
startNaviToStation(
|
||||
isVoicePlay, currentTaskWithOrder.startSite!!.gcjLat,
|
||||
currentTaskWithOrder.startSite!!.gcjLon
|
||||
)
|
||||
taskOtherInfo.text = "已到达 ${currentTaskWithOrder.endSite?.siteName}"
|
||||
} else {
|
||||
taskOtherInfo.text = "距离 -- 公里, 用时 -- 分钟"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,12 +372,19 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
when (taskType) {
|
||||
TaskTypeEnum.None.code -> {
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
|
||||
handleOrderView(order)
|
||||
updateOrderUI(order)
|
||||
}
|
||||
}
|
||||
|
||||
TaskTypeEnum.VirtualTask.code -> { //演练任务
|
||||
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
|
||||
updateOrderUI(order)
|
||||
updateMapMarkers(taskAndOrder)
|
||||
updateRemainDistanceAndTime(false)
|
||||
return
|
||||
}
|
||||
|
||||
cancelOrder.visibility = View.GONE
|
||||
orderPhoneAndNum.visibility = if (order != null &&
|
||||
currentStatus == TaskStatusEnum.CompleteTask.code
|
||||
@@ -374,10 +400,6 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
|
||||
pathwayPoint.visibility = View.GONE
|
||||
|
||||
if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) {
|
||||
updateOrderUI(order)
|
||||
return
|
||||
}
|
||||
if (startSite == null || endSite == null) return
|
||||
|
||||
taskStatus.text = resources.getString(R.string.task_start_end_site)
|
||||
@@ -386,14 +408,13 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
taskTypeTv.text = resources.getString(R.string.task_exercise)
|
||||
startStationName.text = startSite.siteName
|
||||
endStationName.text = endSite.siteName
|
||||
updatePrepareTaskDelay120SUI(false)
|
||||
updatePrepareTaskDelayUI(0, false)
|
||||
updateStartAndEndStationPointByStatus(true)
|
||||
}
|
||||
|
||||
TaskTypeEnum.ToOrderEndTask.code, TaskTypeEnum.ToOrderStartTask.code -> {// 接驾任务 或 送驾任务
|
||||
order?.also {
|
||||
updatePathwayPoint(taskType,endSite?.siteName)
|
||||
handleOrderView(it)
|
||||
updatePathwayPoint(taskType, endSite?.siteName)
|
||||
updateOrderUI(it)
|
||||
}
|
||||
}
|
||||
@@ -403,7 +424,7 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
updateRemainDistanceAndTime(false)
|
||||
}
|
||||
|
||||
private fun updatePathwayPoint(taskType: Int,endSiteName: String?) {
|
||||
private fun updatePathwayPoint(taskType: Int, endSiteName: String?) {
|
||||
if (TextUtils.isEmpty(endSiteName)) return
|
||||
pathwayPoint.visibility = if (taskType == TaskTypeEnum.ToOrderStartTask.code)
|
||||
View.VISIBLE else View.GONE
|
||||
@@ -475,7 +496,22 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
}
|
||||
|
||||
private fun updateOrderUI(order: OrderDetail) {
|
||||
updatePrepareTaskDelay120SUI(false)
|
||||
cancelOrder.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.VISIBLE
|
||||
taskClickBtn.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
// orderStatus: 0 订单创建(为派单), 10 已派上司机(司机去往上车点), 20 司机到达上车点,
|
||||
// 30 乘客到达上车点, 40 服务中(去往目的地), 50 到达目的地, 60 已完成, 70 已取消
|
||||
naviToStart.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
) View.VISIBLE else View.GONE
|
||||
|
||||
naviToEnd.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
) View.VISIBLE else View.GONE
|
||||
taskOtherInfo.visibility = View.VISIBLE
|
||||
|
||||
updatePrepareTaskDelayUI(0, false)
|
||||
taskTypeTv.text = resources.getString(R.string.task_order)
|
||||
taskTypeTv.background =
|
||||
ContextCompat.getDrawable(
|
||||
@@ -547,32 +583,15 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleOrderView(order: OrderDetail?) {
|
||||
if (order == null) return
|
||||
cancelOrder.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.VISIBLE
|
||||
taskClickBtn.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
// orderStatus: 0 订单创建(为派单), 10 已派上司机(司机去往上车点), 20 司机到达上车点,
|
||||
// 30 乘客到达上车点, 40 服务中(去往目的地), 50 到达目的地, 60 已完成, 70 已取消
|
||||
naviToStart.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
) View.VISIBLE else View.GONE
|
||||
|
||||
naviToEnd.visibility = if (order.orderStatus
|
||||
== TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
) View.VISIBLE else View.GONE
|
||||
|
||||
taskOtherInfo.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
private fun hideNaviBtns() {
|
||||
naviToStart.visibility = View.GONE
|
||||
naviToEnd.visibility = View.GONE
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
mTaxiFragment?.showAmapNaviToStationFragment(false)
|
||||
mTaxiFragment?.showRoutingToStationFragment(false)
|
||||
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
|
||||
.post(this.lifecycleScope, false)
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_ROUTING_TO_STATION_FRAGMENT)
|
||||
.post(this.lifecycleScope, false)
|
||||
}
|
||||
|
||||
private fun startNaviToStation(isVoicePlay: Boolean, stationLat: Double, stationLng: Double) {
|
||||
@@ -595,16 +614,25 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
* @param meters 米
|
||||
* @param timeInSecond 秒
|
||||
*/
|
||||
fun updateCurrentTaskTripInfo(meters: Long, timeInSecond: Long) {
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
|
||||
if (currentTaskWithOrder.endSite == null && currentTaskWithOrder == null) return
|
||||
d("NaviToDestinationModel", "taskUitl, ${TaskUtils.getCurrentTaskTripHtml(meters, timeInSecond)}")
|
||||
taskOtherInfo.text = TaskUtils.getCurrentTaskTripHtml(meters, timeInSecond)
|
||||
private fun updateCurrentTaskTripInfo(meters: Long, timeInSecond: Long) {
|
||||
UiThreadHandler.post {
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return@post
|
||||
d(
|
||||
TAG,
|
||||
"updateCurrentTaskTripInfo, taskUtil, ${
|
||||
TaskUtils.getCurrentTaskTripHtml(
|
||||
meters,
|
||||
timeInSecond
|
||||
)
|
||||
}"
|
||||
)
|
||||
taskOtherInfo.text = TaskUtils.getCurrentTaskTripHtml(meters, timeInSecond)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
updatePrepareTaskDelay120SUI(false)
|
||||
updatePrepareTaskDelayUI(0, false)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
@@ -687,7 +715,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
* @param isShow
|
||||
*/
|
||||
private fun showNaviToEndStationFragment(isShow: Boolean) {
|
||||
mTaxiFragment?.startNaviToEndStation(isShow)
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_START_NAVI_TO_END_STATION)
|
||||
.post(this.lifecycleScope, isShow)
|
||||
}
|
||||
|
||||
override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) {
|
||||
@@ -697,7 +726,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) {
|
||||
d(TAG, "isPlay = $isPlay, isRestart=$isRestart")
|
||||
if (!isRestart) {
|
||||
mTaxiFragment?.showAmapNaviToStationFragment(false)
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
|
||||
.post(this.lifecycleScope, false)
|
||||
return
|
||||
}
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
|
||||
@@ -715,7 +745,8 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
}
|
||||
if ((currentTaskWithOrder?.currentStatus == TaskStatusEnum.StartTask.code
|
||||
&& currentTaskWithOrder.order == null)
|
||||
|| (currentTaskWithOrder?.order?.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code)) {
|
||||
|| (currentTaskWithOrder?.order?.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code)
|
||||
) {
|
||||
if (naviToEnd.visibility == View.GONE) {
|
||||
naviToEnd.visibility = View.VISIBLE
|
||||
}
|
||||
@@ -726,10 +757,14 @@ class TaxiCurrentTaskFragment : BaseFragment(),
|
||||
fun onNaviToEndStationByAmap(isShow: Boolean) {
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
|
||||
|
||||
mTaxiFragment?.showAmapNaviToStationFragment(
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
||||
isShow else true
|
||||
)
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
|
||||
.post(
|
||||
this.lifecycleScope,
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
||||
isShow
|
||||
else
|
||||
true
|
||||
)
|
||||
updateRemainDistanceAndTime(
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
||||
isShow else true
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.common.module.wigets.StartAutopilotAnimationView
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.BaseViewModel
|
||||
import com.mogo.och.taxi.base.IUiIntent
|
||||
@@ -21,6 +22,7 @@ import com.mogo.och.taxi.bean.TrajectoryListRespBean
|
||||
import com.mogo.och.taxi.callback.ITaxiCarServiceCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiTaskWithOrderCallback
|
||||
import com.mogo.och.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.network.TaxiTaskWithOrderServiceManager
|
||||
@@ -142,7 +144,7 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun startTask() {
|
||||
private fun startTask(isStartAutopilot: Boolean = true) {
|
||||
if (!TaxiTaskModel.checkCurrentTaskCondition()) {
|
||||
ToastUtils.showShort("无任务!")
|
||||
return
|
||||
@@ -154,7 +156,7 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
it.order!!.orderLine
|
||||
else
|
||||
it.lineId
|
||||
)
|
||||
,isStartAutopilot)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,11 +175,11 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePrepareTaskDelay120SUI(isStart: Boolean){
|
||||
private fun updatePrepareTaskDelayUI(delayTime: Long, isStart: Boolean) {
|
||||
d(TAG, "UpdatePrepareTaskDelay120SUI = $isStart")
|
||||
sendUiState {
|
||||
copy(
|
||||
taskWithOrderUIState = TaskWithOrderUIState.UpdatePrepareTaskDelay120S(
|
||||
taskWithOrderUIState = TaskWithOrderUIState.UpdatePrepareTaskDelay(delayTime,
|
||||
isStart
|
||||
)
|
||||
)
|
||||
@@ -195,30 +197,63 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateOrderTotalMileAndDurationUI(mileage: Float, duration: Int) {
|
||||
d(TAG, "updateOrderTotalMileAndDurationUI")
|
||||
private fun updateOrderTripInfoUI(mileage: Float, duration: Int) {
|
||||
d(TAG, "updateOrderTripInfoUI")
|
||||
sendUiState {
|
||||
copy(
|
||||
taskWithOrderUIState = TaskWithOrderUIState.UpdateTaskTripInfo(
|
||||
taskWithOrderUIState = TaskWithOrderUIState.UpdateOrderTripInfo(
|
||||
mileage, duration
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTaskTripInfoLocalCalculateUI(meters: Long, timeInSecond: Long) {
|
||||
d(TAG, "UpdateTaskTripInfoLocalCalculateUI")
|
||||
sendUiState {
|
||||
copy(
|
||||
taskWithOrderUIState = TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo(
|
||||
meters, timeInSecond
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskWithOrderDataChanged(result: QueryCurrentTaskRespBean.Result?) {
|
||||
d(TAG, "onTaskWithOrderChanged = result = " + GsonUtil.jsonFromObject(result))
|
||||
DebugView.printInfoMsg("[查询TaskWithOrder信息] 更新数据, 刷新UI")
|
||||
updateTaskAndOrderUi(result)
|
||||
}
|
||||
|
||||
override fun onTaskCompleted(isOrderArrivedAtStart: Boolean, siteId: Long) {
|
||||
d(TAG, "onTaskCompleted: isOrderArrivedAtStart=$isOrderArrivedAtStart, siteId=$siteId")
|
||||
if (isOrderArrivedAtStart) {
|
||||
TaxiTaskModel.removePrepareTaskDelay120S()
|
||||
TaxiTaskModel.prepareNextTask(siteId)
|
||||
} else {
|
||||
TaxiTaskModel.startPrepareTaskDelay120S(siteId)
|
||||
/**
|
||||
* 开始倒计时120s或者10s拉取任务
|
||||
* 演练任务120s拉取
|
||||
* 接驾任务10s拉取
|
||||
*/
|
||||
override fun onTaskCompleted(result: QueryCurrentTaskRespBean.Result) {
|
||||
d(TAG, "onTaskCompleted: ${result?.currentStatus}, siteId=${result?.endSite?.siteId}")
|
||||
|
||||
if (result.order != null && result.servingStatus == 1){
|
||||
if (result.taskType <= TaskTypeEnum.VirtualTask.code
|
||||
&& result.order!!.orderStatus < TaxiOrderStatusEnum.ArriveAtStart.code) {
|
||||
VoiceNotice.showNotice("已为您接到订单")
|
||||
}
|
||||
if (result.taskType == TaskTypeEnum.ToOrderStartTask.code
|
||||
&& result.order!!.orderStatus == TaxiOrderStatusEnum.ArriveAtStart.code){
|
||||
VoiceNotice.showNotice("已到达上车地点,等待乘客上车")
|
||||
}
|
||||
}
|
||||
|
||||
if (QueryCurrentTaskRespBean.isUserArriveAtStart(result)) {
|
||||
TaxiTaskModel.removePrepareTaskDelay()
|
||||
TaxiTaskModel.prepareNextTask(0,result.endSite!!.siteId)
|
||||
}else if (!QueryCurrentTaskRespBean.isOrderArriveAtStart(result)
|
||||
|| !QueryCurrentTaskRespBean.isOrderArriveAtEnd(result)){
|
||||
TaxiTaskModel.startPrepareTaskDelay(
|
||||
if (TaskTypeEnum.isToOrderStartTask(result))
|
||||
TaxiUnmannedConst.START_AUTOPILOT_COUNTDOWN_INTERVAL
|
||||
else TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S,
|
||||
result.endSite!!.siteId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,15 +264,19 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
override fun onOrderCancel() {
|
||||
VoiceNotice.showNotice("已取消行程")
|
||||
// updateTaskAndOrderUi(null)
|
||||
//取消自驾,D档位会溜车 map3.6.0 修改
|
||||
TaxiTaskModel.cancelAutopilot()
|
||||
}
|
||||
|
||||
override fun onOrderArriveAtEnd(orderNo: String) {
|
||||
TaxiTaskModel.queryOrderByOrderNo(orderNo)
|
||||
}
|
||||
|
||||
override fun onOrderTotalMileAndDurationChanged(mileage: Float, duration: Int) {
|
||||
//更新总全程信息(公里和分钟)
|
||||
updateOrderTotalMileAndDurationUI(mileage, duration)
|
||||
/**
|
||||
* 更新总全程信息(公里和分钟), 后端返回的数据
|
||||
*/
|
||||
override fun onOrderTripInfoChanged(mileage: Float, duration: Int) {
|
||||
updateOrderTripInfoUI(mileage, duration)
|
||||
}
|
||||
|
||||
override fun onOrderJourneyCompleted() {
|
||||
@@ -245,22 +284,46 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
//获取新的任务
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
|
||||
currentTaskWithOrder?.endSite?.also {
|
||||
TaxiTaskModel.startPrepareTaskDelay120S(it.siteId)
|
||||
TaxiTaskModel.startPrepareTaskDelay(TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S,
|
||||
it.siteId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartAutopilot() {
|
||||
UiThreadHandler.postDelayed({
|
||||
startTask() //状态流转
|
||||
VoiceNotice.showNotice("车辆正在自动开启自动驾驶")
|
||||
}, TaxiUnmannedConst.START_AUTOPILOT_COUNTDOWN_INTERVAL) // 10s后开启自驾, 状态流转
|
||||
override fun onStartAutopilot(postDelayTime: Long) {
|
||||
UiThreadHandler.postDelayed(startTaskRunnable, postDelayTime) // 10s后或者倒计时继续开启自驾, 状态流转
|
||||
}
|
||||
|
||||
private val startTaskRunnable: Runnable = Runnable {
|
||||
startTask() //状态流转
|
||||
VoiceNotice.showNotice("车辆正在自动开启自动驾驶")
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始倒计时120拉取任务
|
||||
* 主动请求平行驾驶, 停止启动自驾命令, 任务状态需向下流转
|
||||
*/
|
||||
override fun onStartPrepareTask120s(isStart: Boolean) {
|
||||
updatePrepareTaskDelay120SUI(isStart)
|
||||
override fun onStopAutopilot() {
|
||||
UiThreadHandler.removeCallbacks(startTaskRunnable)
|
||||
startTask(false)
|
||||
}
|
||||
|
||||
override fun onPauseStartAutopilot() {
|
||||
UiThreadHandler.removeCallbacks(startTaskRunnable)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始倒计时120s或者10s拉取任务
|
||||
* 演练任务120s拉取
|
||||
* 接驾任务10s拉取
|
||||
*/
|
||||
override fun onStartPrepareTaskUI(delayTime: Long, isStart: Boolean) {
|
||||
updatePrepareTaskDelayUI(delayTime, isStart)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新本次任务行程信息, 本地计算的数据
|
||||
*/
|
||||
override fun onTaskTripInfoLocalCalculateChanged(meters: Long, timeInSecond: Long) {
|
||||
updateTaskTripInfoLocalCalculateUI(meters, timeInSecond)
|
||||
}
|
||||
|
||||
override fun onCarEndServiceSuccess(
|
||||
@@ -269,7 +332,7 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
) {
|
||||
if (currentTaskWithOrder?.endSite != null
|
||||
&& (currentTaskWithOrder.currentStatus < TaskStatusEnum.CompleteTask.code
|
||||
||currentTaskWithOrder.order != null)
|
||||
|| currentTaskWithOrder.order != null)
|
||||
) {
|
||||
VoiceNotice.showNotice("暂停接单啦!要完成当前订单哦")
|
||||
return
|
||||
|
||||
@@ -20,14 +20,17 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
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.autopilot.IMoGoParallelDrivingActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
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.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
@@ -76,6 +79,7 @@ import com.mogo.och.taxi.ui.debug.DebugView
|
||||
import com.mogo.och.taxi.utils.RxJavaUtils
|
||||
import com.mogo.och.taxi.utils.TaxiAnalyticsManager
|
||||
import com.mogo.och.taxi.utils.TaxiTrajectoryManager
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -136,7 +140,7 @@ object TaxiTaskModel {
|
||||
|
||||
private val mCurrentTaskRoutePointsGcj: MutableList<MogoLocation> = ArrayList()
|
||||
|
||||
private var mPrepareTaskDelay120SRunnable: Runnable? = null
|
||||
private var mPrepareTaskDelayRunnable: Runnable? = null
|
||||
|
||||
fun addTaskWithOrderListener(tag: String, listener: ITaxiTaskWithOrderCallback) {
|
||||
if (mTaxiTaskWithOrderCallbackMap.containsKey(tag)) {
|
||||
@@ -225,6 +229,8 @@ object TaxiTaskModel {
|
||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(mContext)
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, localCalculateDistanceListener)
|
||||
TrajectoryAndDistanceManager.addTrajectoryListener(TAG, localCalculateTrajectoryListener)
|
||||
//3.6.0后平行驾驶.刹车 且只用于东风和红旗. 3.6.0前没有
|
||||
CallerParallelDrivingActionsListenerManager.addListener(TAG,mParallelDrivingActionsListener)
|
||||
}
|
||||
|
||||
private fun releaseListeners() {
|
||||
@@ -241,6 +247,38 @@ object TaxiTaskModel {
|
||||
CallerPlanningRottingListenerManager.removeListener(mMogoAutopilotPlanningListener)
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null)
|
||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||
CallerParallelDrivingActionsListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
// 监听平行驾驶、刹车, 试用于MAP3.6.0以上 且只用于东风和红旗
|
||||
private val mParallelDrivingActionsListener: IMoGoParallelDrivingActionsListener =
|
||||
object : IMoGoParallelDrivingActionsListener {
|
||||
override fun onParallelDrivingAbility(
|
||||
isParallelDrivingAbility: Boolean,
|
||||
unableParallelDrivingReasons: ArrayList<UnableLaunchReason>?
|
||||
) {
|
||||
if (unableParallelDrivingReasons != null) {
|
||||
if (unableParallelDrivingReasons.toString().contains(UnableLaunchReason.SourceType.CHASSIS.name)
|
||||
&& unableParallelDrivingReasons.toString().contains(UnableLaunchReason.UnableType.BRAKE.name)) {
|
||||
//刹车变化回调
|
||||
d(TAG,"onParallelDrivingAbility = $isParallelDrivingAbility," +
|
||||
" unableParallelDrivingReasons = ${unableParallelDrivingReasons.toString()}" )
|
||||
handleBrakeStatusChange(isParallelDrivingAbility)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* brakeStatus: true: 恢复启动自驾
|
||||
* false: 暂停启动自驾
|
||||
*/
|
||||
fun handleBrakeStatusChange(brakeStatus: Boolean) {
|
||||
if (brakeStatus){
|
||||
mControllerStatusCallback?.resumeOpenAutopilotNonManual()
|
||||
}else{
|
||||
mControllerStatusCallback?.pauseOpenAutopilotNonManual()
|
||||
}
|
||||
}
|
||||
|
||||
private val mMogoAutopilotStatusListener: IMoGoAutopilotStatusListener =
|
||||
@@ -259,7 +297,7 @@ object TaxiTaskModel {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_RUNNING,meaning=自动驾驶中")
|
||||
mADASStatusCallback?.onAutopilotRunning()
|
||||
if ((QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(mCurrentTaskWithOrder))) {
|
||||
if ((QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder))) {
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
isRestartAutopilot,
|
||||
true,
|
||||
@@ -283,12 +321,9 @@ object TaxiTaskModel {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_ENABLE,meaning=可自动驾驶,人工干预状态")
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentTaskCondition()
|
||||
&& (QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(
|
||||
mCurrentTaskWithOrder
|
||||
)
|
||||
|| QueryCurrentTaskRespBean.isOrderArriveAtEnd(
|
||||
mCurrentTaskWithOrder
|
||||
)))
|
||||
&& (QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(mCurrentTaskWithOrder)
|
||||
|| QueryCurrentTaskRespBean.isOrderArriveAtEnd(mCurrentTaskWithOrder))
|
||||
)
|
||||
) {
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
return
|
||||
@@ -298,12 +333,9 @@ object TaxiTaskModel {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_DISABLE,meaning=不可自动驾驶")
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentTaskCondition()
|
||||
&& (QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(
|
||||
mCurrentTaskWithOrder
|
||||
)
|
||||
|| QueryCurrentTaskRespBean.isOrderArriveAtEnd(
|
||||
mCurrentTaskWithOrder
|
||||
)))
|
||||
&& (QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(mCurrentTaskWithOrder)
|
||||
|| QueryCurrentTaskRespBean.isOrderArriveAtEnd(mCurrentTaskWithOrder))
|
||||
)
|
||||
) {
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
return
|
||||
@@ -315,12 +347,9 @@ object TaxiTaskModel {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_PARALLEL_DRIVING,meaning=平行驾驶中")
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
if ((checkCurrentTaskCondition()
|
||||
&& (QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(
|
||||
mCurrentTaskWithOrder
|
||||
)
|
||||
|| QueryCurrentTaskRespBean.isOrderArriveAtEnd(
|
||||
mCurrentTaskWithOrder
|
||||
)))
|
||||
&& (QueryCurrentTaskRespBean.isOrderOnTheWayToEnd(mCurrentTaskWithOrder)
|
||||
|| QueryCurrentTaskRespBean.isOrderArriveAtEnd(mCurrentTaskWithOrder))
|
||||
)
|
||||
) { //订单中
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
} else { //美化模式下没订单,显示人工驾驶
|
||||
@@ -482,10 +511,12 @@ object TaxiTaskModel {
|
||||
TAG,
|
||||
"dynamicCalculateRouteInfo: lastSumLength=$lastSumLength, lastTime=$lastTime, threadName=Thread.currentThread().name"
|
||||
)
|
||||
mOrderStatusCallback?.onCurrentOrderDistToEndChanged(
|
||||
lastSumLength.toLong(),
|
||||
lastTime.toLong()
|
||||
)
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onTaskTripInfoLocalCalculateChanged(
|
||||
lastSumLength.toLong(),
|
||||
lastTime.toLong())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,8 +630,8 @@ object TaxiTaskModel {
|
||||
|
||||
if (isArriveAtEndSite) {
|
||||
updateLocalCalculateStation()
|
||||
//到站后不再调用取消自驾. 原因是取消自驾,D档位会溜车
|
||||
//cancelAutopilot()
|
||||
//取消自驾,D档位会溜车 map3.6.0 修改
|
||||
cancelAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,18 +747,6 @@ object TaxiTaskModel {
|
||||
|
||||
mCurrentTaskWithOrder = result
|
||||
|
||||
if (result.order != null && result.currentStatus == TaskStatusEnum.CompleteTask.code
|
||||
&& result.servingStatus == 1){
|
||||
if (result.taskType <= TaskTypeEnum.VirtualTask.code
|
||||
&& result.order!!.orderStatus < TaxiOrderStatusEnum.ArriveAtStart.code) {
|
||||
VoiceNotice.showNotice("已为您接到订单")
|
||||
}
|
||||
if (result.taskType == TaskTypeEnum.ToOrderStartTask.code
|
||||
&& result.order!!.orderStatus == TaxiOrderStatusEnum.ArriveAtStart.code){
|
||||
VoiceNotice.showNotice("已到达上车地点,等待乘客上车")
|
||||
}
|
||||
}
|
||||
|
||||
// 任务为空
|
||||
if (result.endSite == null && result.order == null) {
|
||||
d(TAG, "queryCurrentTaskOnce: 任务为空")
|
||||
@@ -745,17 +764,10 @@ object TaxiTaskModel {
|
||||
// 主要是解决A-B演练任务同时接到A-B订单状态流转的问题
|
||||
//注意: 需要去除到达乘客上车点的节点, 这个节点不拉取任务
|
||||
if (result?.currentStatus == TaskStatusEnum.CompleteTask.code
|
||||
&& (!QueryCurrentTaskRespBean.isOrderArriveAtStart(result)
|
||||
|| !QueryCurrentTaskRespBean.isOrderArriveAtEnd(result))
|
||||
) {
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onTaskCompleted(
|
||||
QueryCurrentTaskRespBean.isUserArriveAtStart(
|
||||
result
|
||||
),
|
||||
result.endSite!!.siteId
|
||||
)
|
||||
listener.onTaskCompleted(result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,7 +801,7 @@ object TaxiTaskModel {
|
||||
mControllerStatusCallback?.startOpenAutopilotNonManual()
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onStartAutopilot()
|
||||
listener.onStartAutopilot(TaxiUnmannedConst.START_AUTOPILOT_COUNTDOWN_INTERVAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,6 +812,7 @@ object TaxiTaskModel {
|
||||
listener.onTaskWithOrderDataChanged(mCurrentTaskWithOrder)
|
||||
}
|
||||
}
|
||||
updateDemoModeAndAutopilotParameters(result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -833,8 +846,9 @@ object TaxiTaskModel {
|
||||
fun updateLocalCalculateStation() {
|
||||
if (mCurrentTaskWithOrder == null) return
|
||||
if (mCurrentTaskWithOrder!!.startSite != null && mCurrentTaskWithOrder!!.endSite != null
|
||||
&& mCurrentTaskWithOrder!!.currentStatus <= TaskStatusEnum.StartTask.code
|
||||
&& mCurrentTaskWithOrder!!.currentStatus == TaskStatusEnum.StartTask.code
|
||||
) {
|
||||
d(TAG, "updateLocalCalculateStation start")
|
||||
val curTaskAndOrder = getCurrentTaskWithOrder() ?: return
|
||||
if (curTaskAndOrder.startSite != null && curTaskAndOrder.endSite != null) {
|
||||
val startStation = MogoLocation()
|
||||
@@ -846,6 +860,8 @@ object TaxiTaskModel {
|
||||
setStationPoint(startStation, endStation, curTaskAndOrder.lineId)
|
||||
}
|
||||
} else {
|
||||
d(TAG, "updateLocalCalculateStation stop")
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi()
|
||||
setStationPoint(null, null, -1L)
|
||||
}
|
||||
}
|
||||
@@ -869,7 +885,7 @@ object TaxiTaskModel {
|
||||
TaxiOrderStatusEnum.ArriveAtEnd.code -> {
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onOrderTotalMileAndDurationChanged(
|
||||
listener.onOrderTripInfoChanged(
|
||||
data.data.mileage,
|
||||
data.data.duration.toInt()
|
||||
)
|
||||
@@ -896,7 +912,7 @@ object TaxiTaskModel {
|
||||
})
|
||||
}
|
||||
|
||||
fun startTask(lineId: Long) {
|
||||
fun startTask(lineId: Long, isStartAutopilot: Boolean) {
|
||||
DebugView.printInfoMsg("[开始任务] 准备发送请求,lindId=$lineId")
|
||||
TaxiTaskWithOrderServiceManager.startTask(
|
||||
mContext,
|
||||
@@ -904,7 +920,9 @@ object TaxiTaskModel {
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
DebugView.printInfoMsg("[开始任务] 请求success,lindId=$lineId")
|
||||
startAutoPilot() //自驾开启
|
||||
if (isStartAutopilot){
|
||||
startAutoPilot() //自驾开启
|
||||
}
|
||||
d(TAG, "startTask onSuccess: data=${GsonUtil.jsonFromObject(data)}")
|
||||
}
|
||||
|
||||
@@ -927,7 +945,7 @@ object TaxiTaskModel {
|
||||
})
|
||||
}
|
||||
|
||||
fun prepareNextTask(siteId: Long) {
|
||||
fun prepareNextTask(delayTime: Long,siteId: Long) {
|
||||
DebugView.printInfoMsg("[PrepareNextTask] 准备发送请求, siteId=$siteId")
|
||||
TaxiTaskWithOrderServiceManager.prepareTask(
|
||||
mContext,
|
||||
@@ -946,39 +964,39 @@ object TaxiTaskModel {
|
||||
DebugView.printErrorMsg("[PrepareNextTask] 请求fail, code=$code ,msg=$msg")
|
||||
d(TAG, "prepareNextTask onFail: code=$code ,msg=$msg")
|
||||
if (LoginStatusManager.isLogin() && TaxiCarServingStatusManager.isCarServingStatus()) {
|
||||
startPrepareTaskDelay120S(siteId)
|
||||
startPrepareTaskDelay(delayTime,siteId)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun startPrepareTaskDelay120S(siteId: Long) {
|
||||
removePrepareTaskDelay120S()
|
||||
fun startPrepareTaskDelay(delayTime: Long, siteId: Long) {
|
||||
removePrepareTaskDelay()
|
||||
|
||||
mPrepareTaskDelay120SRunnable = Runnable {
|
||||
prepareNextTask(siteId)
|
||||
mPrepareTaskDelayRunnable = Runnable {
|
||||
prepareNextTask(delayTime,siteId)
|
||||
}
|
||||
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onStartPrepareTask120s(true)
|
||||
listener.onStartPrepareTaskUI(delayTime,true)
|
||||
}
|
||||
DebugView.printInfoMsg("[PrepareNextTask] 倒计时${TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S / 1000}秒后prepareNextTask, siteId=$siteId")
|
||||
DebugView.printInfoMsg("[PrepareNextTask] 倒计时${delayTime / 1000}秒后prepareNextTask, siteId=$siteId")
|
||||
UiThreadHandler.postDelayed(
|
||||
mPrepareTaskDelay120SRunnable,
|
||||
TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S
|
||||
mPrepareTaskDelayRunnable,
|
||||
delayTime
|
||||
)
|
||||
}
|
||||
|
||||
fun removePrepareTaskDelay120S() {
|
||||
if (mPrepareTaskDelay120SRunnable != null) {
|
||||
fun removePrepareTaskDelay() {
|
||||
if (mPrepareTaskDelayRunnable != null) {
|
||||
DebugView.printInfoMsg("[PrepareNextTask] removeCallbacks, 取消prepareNextTask倒计时")
|
||||
UiThreadHandler.removeCallbacks(mPrepareTaskDelay120SRunnable)
|
||||
UiThreadHandler.removeCallbacks(mPrepareTaskDelayRunnable)
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onStartPrepareTask120s(false)
|
||||
listener.onStartPrepareTaskUI(0,false)
|
||||
}
|
||||
mPrepareTaskDelay120SRunnable = null
|
||||
mPrepareTaskDelayRunnable = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,7 +1004,7 @@ object TaxiTaskModel {
|
||||
* 查询当前任务的轨迹
|
||||
*/
|
||||
fun queryTaskTrajectoryByLineIds(planningLineIds: Array<Long>, currentTaskLineId: Long) {
|
||||
DebugView.printInfoMsg("[查询轨迹信息] 准备发送请求,currentTaskLineId=$currentTaskLineId, planningLineIds=$planningLineIds")
|
||||
DebugView.printInfoMsg("[查询轨迹信息] 准备发送请求,currentTaskLineId=$currentTaskLineId, planningLineIds=${GsonUtil.jsonFromObject(planningLineIds)}")
|
||||
TaxiTaskWithOrderServiceManager.queryTrajectoryByLindIds(
|
||||
mContext,
|
||||
planningLineIds,
|
||||
@@ -996,7 +1014,7 @@ object TaxiTaskModel {
|
||||
TAG,
|
||||
"queryTaskTrajectoryByLineIds onSuccess: ${GsonUtil.jsonFromObject(data?.data)}"
|
||||
)
|
||||
DebugView.printInfoMsg("[查询轨迹信息] 请求success, currentTaskLineId=$currentTaskLineId, planningLineIds=$planningLineIds")
|
||||
DebugView.printInfoMsg("[查询轨迹信息] 请求success, currentTaskLineId=$currentTaskLineId, planningLineIds=${GsonUtil.jsonFromObject(planningLineIds)}")
|
||||
data?.data?.also {
|
||||
mTaskTrajectoryList.addAll(it)
|
||||
mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId }
|
||||
@@ -1094,6 +1112,19 @@ object TaxiTaskModel {
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_TAXI_START_AUTOPILOT,
|
||||
paramIndexes = [-1]
|
||||
)
|
||||
|
||||
fun startAutopilotByClick(){
|
||||
//订单状态流转成功, 点击了开启自驾按钮, 启动自驾
|
||||
if (QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)) {
|
||||
startAutoPilot()
|
||||
}else if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){
|
||||
startTask(mCurrentTaskWithOrder!!.lineId, true)
|
||||
}else{
|
||||
e(TAG, "task currentStatus is not StartTask.")
|
||||
DebugView.printInfoMsg("[启自驾] task currentStatus is not StartTask")
|
||||
}
|
||||
}
|
||||
|
||||
fun startAutoPilot() {
|
||||
DebugView.printInfoMsg("[启自驾] startAutoPilot")
|
||||
if (!checkCurrentTaskCondition()) {
|
||||
@@ -1107,6 +1138,7 @@ object TaxiTaskModel {
|
||||
e(TAG, "no order or order is empty.")
|
||||
DebugView.printErrorMsg("[启自驾] 轨迹信息不存在!")
|
||||
ToastUtils.showShort("轨迹信息不存在!")
|
||||
return
|
||||
}
|
||||
|
||||
//根据开关和后台是否发布轨迹启动自驾
|
||||
@@ -1144,12 +1176,6 @@ object TaxiTaskModel {
|
||||
return
|
||||
}
|
||||
|
||||
//在订单状态还没流转成功时, 点击了开启自驾按钮, 先去做状态流转成功再启动自驾
|
||||
if (mCurrentTaskWithOrder!!.currentStatus == TaskStatusEnum.GetTask.code) {
|
||||
startTask(mCurrentTaskWithOrder!!.lineId)
|
||||
return
|
||||
}
|
||||
|
||||
//点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩
|
||||
isRestartAutopilot = mCurrentTaskWithOrder!!.currentStatus != TaskStatusEnum.StartTask.code
|
||||
|
||||
@@ -1158,6 +1184,7 @@ object TaxiTaskModel {
|
||||
e(TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
|
||||
CallerAutoPilotControlManager.startAutoPilot(parameters)
|
||||
DebugView.printInfoMsg("[启自驾] 调用成功")
|
||||
d(
|
||||
@@ -1375,22 +1402,16 @@ object TaxiTaskModel {
|
||||
}
|
||||
}
|
||||
|
||||
//更新本地currentOrder信息,并保存订单到本地避免车机重启丢失数据
|
||||
private fun updateNativeCurrentOrder(data: QueryCurrentTaskRespBean.Result?) {
|
||||
//运营模式(美化模式), 鹰眼数据同步
|
||||
private fun updateDemoModeAndAutopilotParameters(data: QueryCurrentTaskRespBean.Result?) {
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
mCurrentTaskWithOrder = data
|
||||
|
||||
SharedPrefsMgr.getInstance(mContext!!).putString(
|
||||
TaxiUnmannedConst.SP_KEY_OCH_TAXI_ORDER,
|
||||
GsonUtil.jsonFromObject(data)
|
||||
)
|
||||
val endSite = data.endSite
|
||||
|
||||
val currentOrder = mCurrentTaskWithOrder!!.order
|
||||
|
||||
if (currentOrder != null) {
|
||||
if (currentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) {
|
||||
if (endSite != null) {
|
||||
if (QueryCurrentTaskRespBean.isStartTaskType(data)) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
@@ -1400,7 +1421,7 @@ object TaxiTaskModel {
|
||||
}
|
||||
updateAutopilotControlParameters()
|
||||
}
|
||||
if (currentOrder!!.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code) {
|
||||
if (QueryCurrentTaskRespBean.isCompleteTaskType(data)) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
d(TAG, "setIPCDemoMode:false")
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(false)
|
||||
@@ -1461,4 +1482,31 @@ object TaxiTaskModel {
|
||||
}
|
||||
startAutoPilot()
|
||||
}
|
||||
|
||||
fun stopAutoStartAutopilot() {
|
||||
d(
|
||||
TAG, "stopAutoStartAutopilot = ${mCurrentTaskWithOrder?.currentStatus}"
|
||||
)
|
||||
if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){
|
||||
mControllerStatusCallback?.stopOpenAutopilotNonManual()
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onStopAutopilot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun pauseStartAutopilot(){
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onPauseStartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
fun resumeStartAutopilot(remainingTime: Long){
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onStartAutopilot(remainingTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,10 @@ import com.google.android.material.tabs.TabLayout
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.common.module.utils.FlowBus
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.ui.base.TaxiFragment
|
||||
import com.mogo.och.taxi.constant.TaxiDriverEventConst
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_tab
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_view_pager
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.wait_order_num
|
||||
@@ -69,6 +67,7 @@ class TaxiTaskTabFragment : BaseFragment() {
|
||||
|
||||
override fun initViews() {
|
||||
initTaskTab()
|
||||
initEventBus()
|
||||
}
|
||||
|
||||
private fun initTaskTab() {
|
||||
@@ -84,9 +83,7 @@ class TaxiTaskTabFragment : BaseFragment() {
|
||||
if (TAB_POSITION_CURRENT == position) {
|
||||
module_och_taxi_tab.addTab(tab, true)
|
||||
changeTabLayoutUI(tab, true)
|
||||
currentTaskFragment = TaxiCurrentTaskFragment.newInstance(
|
||||
parentFragment as TaxiFragment?
|
||||
)
|
||||
currentTaskFragment = TaxiCurrentTaskFragment.newInstance()
|
||||
mFragments.add(currentTaskFragment!!)
|
||||
} else if (TAB_POSITION_NEXT == position) {
|
||||
module_och_taxi_tab.addTab(tab)
|
||||
@@ -183,30 +180,22 @@ class TaxiTaskTabFragment : BaseFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
fun onNaviToEndStationByAMap(isShow: Boolean) {
|
||||
if (null == currentTaskFragment) return
|
||||
currentTaskFragment!!.onNaviToEndStationByAmap(isShow)
|
||||
private fun initEventBus() {
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT)
|
||||
.register(this) { show ->
|
||||
wait_order_num.visibility = if (show) View.VISIBLE else View.GONE
|
||||
}
|
||||
FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
|
||||
.register(this) { taskWithOrder ->
|
||||
nextTaskFragment?.onTaskDataChanged(taskWithOrder)
|
||||
}
|
||||
}
|
||||
|
||||
fun onCurrentTaskTripInfoChanged(meters: Long, timeInSecond: Long) {
|
||||
if (null == currentTaskFragment) return
|
||||
currentTaskFragment!!.updateCurrentTaskTripInfo(meters, timeInSecond)
|
||||
fun onNaviToEndStationByAMap(isShow: Boolean) {
|
||||
currentTaskFragment?.onNaviToEndStationByAmap(isShow)
|
||||
}
|
||||
|
||||
fun onCarTakeOrderStatusChanged() {
|
||||
if (null == currentTaskFragment) return
|
||||
currentTaskFragment!!.onCarTakeOrderStatusChanged()
|
||||
}
|
||||
|
||||
fun onTaskDataChanged(result: QueryCurrentTaskRespBean.Result?) {
|
||||
if (null == nextTaskFragment) return
|
||||
if (result != null && result.taskType == TaskTypeEnum.VirtualTask.code
|
||||
&& result.order != null && result.currentStatus != TaskStatusEnum.CompleteTask.code) {
|
||||
VoiceNotice.showNotice("已为您提前接到下一订单,待完成当前任务后服务")
|
||||
wait_order_num.visibility = View.VISIBLE
|
||||
} else {
|
||||
wait_order_num.visibility = View.GONE
|
||||
}
|
||||
nextTaskFragment!!.onTaskDataChanged(result)
|
||||
currentTaskFragment?.onCarTakeOrderStatusChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,15 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ParallelDriveView
|
||||
android:id="@+id/parallelDriveView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
app:layout_constraintRight_toLeftOf="@+id/viewTrafficLightVr"
|
||||
app:layout_goneMarginRight="@dimen/dp_160"/>
|
||||
|
||||
<!--红绿灯-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
|
||||
android:id="@+id/viewTrafficLightVr"
|
||||
|
||||
@@ -51,6 +51,27 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mock模拟轨迹"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_brake"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mock刹车"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_resume_brake"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mock松开刹车"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_parallel_driver"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mock平行驾驶"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -23,6 +23,8 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
|
||||
private const val TAG = "AutopilotManager"
|
||||
|
||||
private var needSpeakByStartAutopilot = false
|
||||
|
||||
init {
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
@@ -33,14 +35,14 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
}
|
||||
|
||||
|
||||
fun startAutopilot() {
|
||||
fun startAutopilot():String {
|
||||
if (!checkCurrentOCHOrder()) {
|
||||
CallerLogger.e(
|
||||
SceneConstant.M_TAXI_P + TAG,
|
||||
"no order or order is empty."
|
||||
)
|
||||
ToastUtils.showShort("当前订单不存在或异常!")
|
||||
return
|
||||
return "当前订单不存在或异常!"
|
||||
}
|
||||
if (TaxiPassengerModel.currentOCHOrder!!.orderStatus == TaxiPassengerOrderStatusEnum.UserArriveAtStart.code) {
|
||||
startAutoPilotServiceByPassenger()
|
||||
@@ -63,7 +65,7 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
TaxiPassengerModel.currentOCHOrder!!.orderNo,
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
return
|
||||
return OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason + ", 请稍候重试"
|
||||
}
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (parameters == null) {
|
||||
@@ -71,7 +73,7 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
SceneConstant.M_TAXI_P + TAG,
|
||||
"AutopilotControlParameters is empty."
|
||||
)
|
||||
return
|
||||
return "自动化驾驶参数异常"
|
||||
}
|
||||
CallerAutoPilotControlManager.startAutoPilot(parameters)
|
||||
CallerLogger.d(
|
||||
@@ -89,6 +91,8 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
TaxiPassengerModel.currentOCHOrder!!.orderNo,
|
||||
TaxiPassengerModel.currentLineId
|
||||
)
|
||||
needSpeakByStartAutopilot = true
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(): AutopilotControlParameters? {
|
||||
@@ -177,6 +181,10 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
TaxiPassengerModel.currentOCHOrder!!.orderNo,
|
||||
TaxiPassengerModel.currentLineId
|
||||
)
|
||||
if(needSpeakByStartAutopilot) {
|
||||
VoiceNotice.showNotice("坐稳扶好,我们出发咯!", AIAssist.LEVEL2)
|
||||
needSpeakByStartAutopilot = false
|
||||
}
|
||||
//startServicePilotDone()
|
||||
}
|
||||
}
|
||||
@@ -196,7 +204,6 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
|
||||
TaxiPassengerModel.currentLineId,
|
||||
object : OchCommonServiceCallback<TaxiPassengerBaseRespBean> {
|
||||
override fun onSuccess(data: TaxiPassengerBaseRespBean) {
|
||||
VoiceNotice.showNotice("坐稳扶好,我们出发咯!", AIAssist.LEVEL2)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {}
|
||||
|
||||
@@ -186,6 +186,10 @@ object TaxiPassengerModel {
|
||||
} else if (data.data.taskType == TaskType_NONE) {
|
||||
//0905 当车一直在标定站点时,taskType=None 如果此时有运营单过来,此时需要弹出验证手机号弹框(后端不会自动匹单并更新taskType,但是实际有order信息)
|
||||
if (data.data?.order == null) {
|
||||
if (currentOCHOrder != null) {
|
||||
d(M_TAXI_P + TAG, "queryInAndWaitOrders queryCurrentOrderStatus()")
|
||||
queryCurrentOrderStatus()
|
||||
}
|
||||
d(
|
||||
M_TAXI_P + TAG,
|
||||
"queryInAndWaitOrders data.taskType=${data.data.taskType} and order=null, discard data"
|
||||
|
||||
@@ -255,7 +255,9 @@ class TaxiPassengerBaseFragment() :
|
||||
OverlayViewUtils.showOverlayView(activity, it)
|
||||
}
|
||||
} else {
|
||||
mStartAutopilotView?.get()?.closeAllAnimsAndView()
|
||||
mStartAutopilotView?.get()?.let {
|
||||
OverlayViewUtils.dismissOverlayView(it)
|
||||
}
|
||||
mStartAutopilotView = null
|
||||
}
|
||||
}
|
||||
@@ -294,6 +296,7 @@ class TaxiPassengerBaseFragment() :
|
||||
}
|
||||
|
||||
fun showOrHideOverMapView(){
|
||||
CallerLogger.d(M_TAXI_P + TAG, "showOrHideOverMapView 清理轨迹和站点")
|
||||
overMapView?.clearV2XMarkers()
|
||||
overMapView?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
@@ -158,5 +158,6 @@ class RightRearCamView : ConstraintLayout , IMoGoBackCameraVideoListener,
|
||||
actv_cam_position_group?.visibility = VISIBLE
|
||||
}
|
||||
v_video_right_rear?.setImageBitmap(mBitmap)
|
||||
v_video_right_rear?.scaleX = -1f
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,24 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorPosition
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
|
||||
import com.mogo.och.common.module.utils.FrameAnimatorContainer
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_front_left_door
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_front_right_door
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_orderinfo
|
||||
@@ -26,31 +32,43 @@ import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.starting_
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_btn_bg
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_starting
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_start_autopilot
|
||||
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.cl_car_type
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/6/14
|
||||
* @author: yangyakun
|
||||
* 页面状态:
|
||||
* ①:不能启动自驾
|
||||
* ②:可以启动自驾
|
||||
* ③:启动自驾中
|
||||
* ④:启动自驾超时
|
||||
* ⑤:启动自驾失败
|
||||
*/
|
||||
class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAutopilotCallback{
|
||||
class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAutopilotCallback {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
companion object {
|
||||
private val TAG = StartAutopilotView::class.java.simpleName
|
||||
private const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||
}
|
||||
|
||||
var isStarting = false
|
||||
|
||||
private var taxiPStartAutopilot: FrameAnimatorContainer?=null
|
||||
private var taxiPStartAutopilotCar: FrameAnimatorContainer?=null
|
||||
private var taxiPXiaozhiBelt: FrameAnimatorContainer?=null
|
||||
private var taxiPStartAutopilot: FrameAnimatorContainer? = null
|
||||
private var taxiPStartAutopilotCar: FrameAnimatorContainer? = null
|
||||
private var taxiPXiaozhiBelt: FrameAnimatorContainer? = null
|
||||
|
||||
|
||||
init {
|
||||
@@ -59,175 +77,187 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this, true)
|
||||
taxiPStartAutopilotCar = FrameAnimatorContainer(R.array.taxi_p_start_autopilot_car, 20,taxi_p_autopilot_starting)
|
||||
taxiPStartAutopilotCar?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
taxiPStartAutopilotCar = FrameAnimatorContainer(
|
||||
R.array.taxi_p_start_autopilot_car,
|
||||
20,
|
||||
taxi_p_autopilot_starting
|
||||
)
|
||||
taxiPStartAutopilotCar?.setOnAnimStopListener(object :
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "光圈动画暂停")
|
||||
}
|
||||
})
|
||||
taxiPStartAutopilot = FrameAnimatorContainer(R.array.taxi_p_start_autopilot, 15,taxi_p_autopilot_btn_bg)
|
||||
taxiPStartAutopilot?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
taxiPStartAutopilot = FrameAnimatorContainer(
|
||||
R.array.taxi_p_start_autopilot,
|
||||
15,
|
||||
taxi_p_autopilot_btn_bg,
|
||||
false
|
||||
)
|
||||
taxiPStartAutopilot?.setOnAnimStopListener(object :
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "可以启动自驾动画暂停")
|
||||
}
|
||||
})
|
||||
taxiPXiaozhiBelt = FrameAnimatorContainer(R.array.xiaozhi_belt, 15,iv_xiaozhi_belt)
|
||||
taxiPXiaozhiBelt?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
taxiPXiaozhiBelt = FrameAnimatorContainer(R.array.xiaozhi_belt, 15, iv_xiaozhi_belt)
|
||||
taxiPXiaozhiBelt?.setOnAnimStopListener(object :
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "小智动画暂停")
|
||||
}
|
||||
})
|
||||
handleStartAutopilotBtnStatus(true)
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
fun handleStartAutopilotBtnStatus(isBoarded: Boolean) {
|
||||
updateStartAutopilotBtnStatus(isBoarded)
|
||||
taxiPStartAutopilot?.start()
|
||||
}
|
||||
|
||||
override fun setOrderInfo(show: String) {
|
||||
actv_orderinfo.text = show
|
||||
}
|
||||
|
||||
override fun setDoorStatus(
|
||||
doorPosition: StartAutopilotViewModel.DoorPosition,
|
||||
isOpen: Boolean
|
||||
) {
|
||||
override fun setDoorStatus(doorPosition: DoorPosition, state: DoorState) {
|
||||
when (doorPosition) {
|
||||
StartAutopilotViewModel.DoorPosition.FRONT_LEFT -> {
|
||||
if(isOpen){
|
||||
DoorPosition.FRONT_LEFT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_front_left_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_front_left_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
StartAutopilotViewModel.DoorPosition.FRONT_RIGHT -> {
|
||||
if(isOpen){
|
||||
|
||||
DoorPosition.FRONT_RIGHT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_front_right_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_front_right_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
StartAutopilotViewModel.DoorPosition.REAR_LEFT -> {
|
||||
if(isOpen){
|
||||
|
||||
DoorPosition.REAR_LEFT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_rear_left_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_rear_left_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
StartAutopilotViewModel.DoorPosition.REAR_RIGHT -> {
|
||||
if(isOpen){
|
||||
|
||||
DoorPosition.REAR_RIGHT -> {
|
||||
if (state == DoorState.OPEN) {
|
||||
actv_rear_right_door.visibility = VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
actv_rear_right_door.visibility = GONE
|
||||
}
|
||||
}
|
||||
else ->{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
|
||||
fun closeAllAnimsAndView() {
|
||||
isStarting = false
|
||||
clearStartingAnimFrame()
|
||||
clearBgAnimDrawable()
|
||||
OverlayViewUtils.dismissOverlayView(this)
|
||||
}
|
||||
|
||||
fun updateStartAutopilotBtnStatus(isBoarded: Boolean) {
|
||||
taxi_p_start_autopilot?.let {
|
||||
if (isBoarded) {
|
||||
it.setTextColor(ContextCompat.getColor(context,R.color.taxi_p_start_autopilot_txt_color))
|
||||
it.background = null
|
||||
} else {
|
||||
it.background = ResourcesCompat.getDrawable(resources,R.drawable.taxi_p_start_autopilot_txt_btn_bg,null)
|
||||
taxi_p_autopilot_btn_bg!!.background = null
|
||||
it.setTextColor( ContextCompat.getColor(context,R.color.taxi_p_start_autopilot_txt_un_color))
|
||||
}
|
||||
it.tag = isBoarded
|
||||
it.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun startingCarBgAnimatorDrawable(isStart: Boolean) {
|
||||
if (isStart) {
|
||||
taxi_p_autopilot_starting!!.setImageResource(0)
|
||||
taxiPStartAutopilotCar?.start()
|
||||
override fun canStartAutopilot(can: Boolean) {
|
||||
if (can) {
|
||||
ableStartAutopilot()
|
||||
} else {
|
||||
taxiPStartAutopilotCar?.stop()
|
||||
taxi_p_autopilot_starting!!.setImageResource(R.drawable.light_00003)
|
||||
unableStartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startOrStopLoadingAnim(start: Boolean) {
|
||||
startingCarBgAnimatorDrawable(start)
|
||||
if (start) {
|
||||
isStarting = true
|
||||
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_loading)
|
||||
taxi_p_start_autopilot?.setTextColor(ContextCompat.getColor(context,R.color.taxi_p_start_autopilot_txt_color))
|
||||
startingAutopilotCountDown()
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
super.onVisibilityChanged(changedView, visibility)
|
||||
if (changedView != this) {
|
||||
return
|
||||
}
|
||||
if (HdMapBuildConfig.currentCarVrIconRes == R.raw.hq_h9) {
|
||||
cl_car_type.setBackgroundResource(R.drawable.taxi_p_start_panel__hq_bg)
|
||||
} else {
|
||||
clearBgAnimDrawable()
|
||||
isStarting = false
|
||||
handleStartAutopilotBtnStatus(true)
|
||||
cl_car_type.setBackgroundResource(R.drawable.taxi_p_start_panel__df_bg)
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearBgAnimDrawable() {
|
||||
taxiPStartAutopilot?.stop()
|
||||
}
|
||||
|
||||
fun clearStartingAnimFrame() {
|
||||
taxiPStartAutopilotCar?.stop()
|
||||
}
|
||||
|
||||
private fun startingAutopilotCountDown() {
|
||||
UiThreadHandler.postDelayed({
|
||||
//未启动成功20s后做处理
|
||||
if (isStarting) { //判断动画是否在进行
|
||||
ToastUtils.showLong(R.string.taxi_p_start_autopilot_fail_10s_tip)
|
||||
updateStatusCountDownOver()
|
||||
}
|
||||
}, TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
private fun updateStatusCountDownOver() {
|
||||
isStarting = false
|
||||
startingCarBgAnimatorDrawable(false)
|
||||
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "onAttachedToWindow")
|
||||
val viewModel = ViewModelProvider(this).get(StartAutopilotViewModel::class.java)
|
||||
viewModel.setStartAutopilotCallback(this)
|
||||
taxi_p_start_autopilot.onClick {
|
||||
//开启动画和自动驾驶
|
||||
if (!(taxi_p_start_autopilot!!.tag as Boolean)) {
|
||||
ToastUtils.showLong(R.string.taxi_p_start_autopilot_un_click_tip)
|
||||
return@onClick
|
||||
}
|
||||
if (!isStarting) {
|
||||
startOrStopLoadingAnim(true)
|
||||
viewModel.startAutopilot()
|
||||
}
|
||||
startAutopiloting()
|
||||
viewModel.startAutopilot()
|
||||
}
|
||||
starting_autopilot_view_close.onClick {
|
||||
closeAllAnimsAndView()
|
||||
unableStartAutopilot()
|
||||
OverlayViewUtils.dismissOverlayView(this)
|
||||
}
|
||||
taxiPXiaozhiBelt?.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* ①:不能启动自驾
|
||||
*/
|
||||
private fun unableStartAutopilot() {
|
||||
taxiPStartAutopilot?.stop()
|
||||
taxiPStartAutopilotCar?.stop()
|
||||
taxi_p_autopilot_starting.setImageResource(R.drawable.light_00003)
|
||||
taxi_p_autopilot_btn_bg.setImageResource(R.drawable.image_00000_0)
|
||||
taxi_p_start_autopilot.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.taxi_p_start_autopilot_txt_btn_bg)
|
||||
taxi_p_start_autopilot.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
|
||||
}
|
||||
|
||||
/**
|
||||
* ②:可以启动自驾
|
||||
*/
|
||||
private fun ableStartAutopilot() {
|
||||
taxiPStartAutopilot?.reStart()
|
||||
taxiPStartAutopilotCar?.stop()
|
||||
taxi_p_autopilot_starting.setImageResource(R.drawable.light_00003)
|
||||
taxi_p_start_autopilot.background = null
|
||||
taxi_p_start_autopilot.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
|
||||
}
|
||||
|
||||
/**
|
||||
* ③:启动自驾中
|
||||
*/
|
||||
fun startAutopiloting() {
|
||||
taxiPStartAutopilot?.reStart()
|
||||
taxiPStartAutopilotCar?.reStart()
|
||||
taxi_p_start_autopilot.background = null
|
||||
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_loading)
|
||||
taxi_p_start_autopilot?.setTextColor(
|
||||
ContextCompat.getColor(context, R.color.taxi_p_start_autopilot_txt_color)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* ④:启动自驾超时
|
||||
*/
|
||||
override fun startAutopilotingTimeout() {
|
||||
ableStartAutopilot()
|
||||
}
|
||||
|
||||
/**
|
||||
* ⑤:启动自驾失败
|
||||
*/
|
||||
override fun startAutopilotingFail() {
|
||||
ableStartAutopilot()
|
||||
}
|
||||
|
||||
private fun goneAllDoorState(){
|
||||
actv_front_left_door.visibility = GONE
|
||||
actv_front_right_door.visibility = GONE
|
||||
actv_rear_left_door.visibility = GONE
|
||||
actv_rear_right_door.visibility = GONE
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
isStarting = false
|
||||
clearStartingAnimFrame()
|
||||
clearBgAnimDrawable()
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "onDetachedFromWindow")
|
||||
unableStartAutopilot()
|
||||
taxiPXiaozhiBelt?.stop()
|
||||
goneAllDoorState()
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
override fun unableStartAutopilotByDoorState() {
|
||||
unableStartAutopilot()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +1,42 @@
|
||||
package com.mogo.och.taxi.passenger.ui.startautopilot
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import chassis.Chassis.DoorNumber
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisDoorStateListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
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.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ParseVersionUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.TaxiDoorStateManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.DoorStateCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorPosition
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.model.AutopilotManager
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallback,
|
||||
IMoGoChassisDoorStateListener {
|
||||
class StartAutopilotViewModel : ViewModel(),
|
||||
DoorStateCallback {
|
||||
|
||||
private val TAG = StartAutopilotViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: StartAutopilotCallback? = null
|
||||
|
||||
init {
|
||||
TaxiPassengerModel.setOrderStatusCallback(TAG, this)
|
||||
CallerChassisDoorStateListenerManager.addListener(TAG, this)
|
||||
}
|
||||
private val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||
|
||||
var startCountDown: Disposable?=null
|
||||
|
||||
var doorOpenState = true
|
||||
|
||||
fun setStartAutopilotCallback(viewCallback: StartAutopilotCallback) {
|
||||
TaxiDoorStateManager.addListener(TAG,this)
|
||||
this.viewCallback = viewCallback
|
||||
setOrderInfo()
|
||||
setDoorInfo()
|
||||
}
|
||||
|
||||
private fun setDoorInfo() {
|
||||
val doorList = CallerChassisDoorStateListenerManager.getDoorList()
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化初始化:${doorList}")
|
||||
doorList?.forEach {
|
||||
exchangeEnum(it.number,it.status==1)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setOrderInfo() {
|
||||
@@ -58,62 +60,69 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
TaxiPassengerModel.setOrderStatusCallback(TAG, null)
|
||||
CallerChassisDoorStateListenerManager.removeListener(TAG)
|
||||
RxUtils.disposeSubscribe(startCountDown)
|
||||
TaxiDoorStateManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶
|
||||
*/
|
||||
fun startAutopilot() {
|
||||
AutopilotManager.startAutopilot()
|
||||
}
|
||||
|
||||
override fun onAutopilotSingleDoorState(num: DoorNumber, open: Boolean) {
|
||||
super.onAutopilotSingleDoorState(num, open)
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${num}--${open}")
|
||||
exchangeEnum(num,open)
|
||||
}
|
||||
|
||||
private fun exchangeEnum(num: DoorNumber,open: Boolean){
|
||||
when (num) {
|
||||
DoorNumber.FRONT_LEFT -> {
|
||||
runMain(DoorPosition.FRONT_LEFT,open)
|
||||
val num = ParseVersionUtils.parseVersion(true, CallerAutoPilotStatusListenerManager.getDockerVersion())
|
||||
if (num >= 30600) {
|
||||
if(doorOpenState){
|
||||
VoiceNotice.showNotice("关紧车门后再出发吧!")
|
||||
ToastUtils.showShort("关紧车门后再出发吧!")
|
||||
viewCallback?.unableStartAutopilotByDoorState()
|
||||
return
|
||||
}
|
||||
|
||||
DoorNumber.FRONT_RIGHT -> {
|
||||
runMain(DoorPosition.FRONT_RIGHT,open)
|
||||
}
|
||||
|
||||
DoorNumber.REAR_LEFT -> {
|
||||
runMain(DoorPosition.REAR_LEFT,open)
|
||||
}
|
||||
|
||||
DoorNumber.REAR_RIGHT -> {
|
||||
runMain(DoorPosition.REAR_RIGHT,open)
|
||||
}
|
||||
|
||||
DoorNumber.MIDDLE -> {
|
||||
runMain(DoorPosition.MIDDLE,open)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
if (RxUtils.isNotDisposed(startCountDown)) {
|
||||
ToastUtils.showLong("启动中……")
|
||||
return
|
||||
}
|
||||
if (AutopilotManager.startAutopilot().isEmpty()) {
|
||||
startCountDown = RxUtils.createSubscribe(TIMER_START_AUTOPILOT_INTERVAL) {
|
||||
viewCallback?.startAutopilotingTimeout()
|
||||
//未启动成功20s后做处理
|
||||
ToastUtils.showLong(R.string.taxi_p_start_autopilot_fail_10s_tip)
|
||||
VoiceNotice.showNotice("啊哦!系统繁忙中,稍后再试试吧~", AIAssist.LEVEL2)
|
||||
}
|
||||
}else{
|
||||
VoiceNotice.showNotice("啊哦!系统繁忙中,稍后再试试吧~", AIAssist.LEVEL2)
|
||||
viewCallback?.startAutopilotingFail()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun runMain(posttion:DoorPosition,isOpen: Boolean){
|
||||
override fun hasOpenDoor(have: Boolean) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "车门是否开着:${have}")
|
||||
doorOpenState = have
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setDoorStatus(posttion,isOpen)
|
||||
viewCallback?.canStartAutopilot(!doorOpenState)
|
||||
}
|
||||
}
|
||||
|
||||
override fun doorStateChangeCallback(position: DoorPosition, state: DoorState) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${position}--${state}")
|
||||
runMain(position,state)
|
||||
}
|
||||
|
||||
private fun runMain(posttion: DoorPosition, state: DoorState){
|
||||
UiThreadHandler.post({
|
||||
viewCallback?.setDoorStatus(posttion,state)
|
||||
},UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
|
||||
interface StartAutopilotCallback {
|
||||
fun setOrderInfo(show: String)
|
||||
fun setDoorStatus(doorPosition: DoorPosition,isOpen:Boolean)
|
||||
}
|
||||
fun setDoorStatus(doorPosition: DoorPosition,state: DoorState)
|
||||
|
||||
enum class DoorPosition {
|
||||
FRONT_LEFT, FRONT_RIGHT, REAR_LEFT, REAR_RIGHT, MIDDLE
|
||||
fun canStartAutopilot(can:Boolean)
|
||||
fun startAutopilotingTimeout()
|
||||
fun startAutopilotingFail()
|
||||
|
||||
fun unableStartAutopilotByDoorState()
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.1 MiB |
|
After Width: | Height: | Size: 420 KiB |
|
After Width: | Height: | Size: 418 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
@@ -135,6 +135,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="无人化"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/taxi_p_setting_view_bg">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/taxi_p_passenger_start_panel_bg"
|
||||
android:id="@+id/cl_car_type"
|
||||
android:background="@drawable/taxi_p_start_panel__df_bg"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<ImageView
|
||||
@@ -34,6 +35,7 @@
|
||||
android:layout_width="1000dp"
|
||||
android:layout_height="500dp"
|
||||
android:clickable="false"
|
||||
android:src="@drawable/image_00000_0"
|
||||
android:layout_marginBottom="@dimen/dp_62"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
||||
@@ -19,7 +19,7 @@ android {
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode rootProject.versionCode as int
|
||||
versionName rootProject.versionName
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
javaCompileOptions {
|
||||
@@ -116,6 +116,15 @@ android {
|
||||
buildConfigField 'String', 'APP_BUILD_TIME', getBuildTime()
|
||||
buildConfigField 'String', 'MAP_SDK_VERSION', "\"${MAP_SDK_VERSION}\""
|
||||
buildConfigField 'String', 'MAP_SDK_OPT_VERSION', "\"${MAP_SDK_OPERATION_VERSION}\""
|
||||
|
||||
// ②车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
|
||||
|
||||
// ④GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
buildConfigField 'int', 'GPS_PROVIDER', "1"
|
||||
|
||||
// ⑤构建的是否是演示(美化)模式
|
||||
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
|
||||
}
|
||||
|
||||
mogo {
|
||||
|
||||
@@ -12,23 +12,8 @@ project.android.productFlavors {
|
||||
CHANNEL_VALUE_BODY : "Driver",
|
||||
]
|
||||
|
||||
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
|
||||
versionCode rootProject.versionCode as int
|
||||
versionName rootProject.versionName
|
||||
// 应用包名
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
|
||||
// ①标识
|
||||
buildConfigField 'String', 'APP_IDENTITY_MODE_BODY', "\"Driver\""
|
||||
|
||||
// ②车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
|
||||
|
||||
// ④GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
buildConfigField 'int', 'GPS_PROVIDER', "1"
|
||||
|
||||
// ⑤构建的是否是演示(美化)模式
|
||||
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
|
||||
}
|
||||
}
|
||||
@@ -12,23 +12,8 @@ project.android.productFlavors {
|
||||
CHANNEL_VALUE_BODY : "Driver",
|
||||
]
|
||||
|
||||
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
|
||||
versionCode rootProject.versionCode as int
|
||||
versionName rootProject.versionName
|
||||
// 应用包名
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
|
||||
// ①标识
|
||||
buildConfigField 'String', 'APP_IDENTITY_MODE_BODY', "\"Driver\""
|
||||
|
||||
// ②车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
|
||||
|
||||
// ④GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
buildConfigField 'int', 'GPS_PROVIDER', "1"
|
||||
|
||||
// ⑤构建的是否是演示(美化)模式
|
||||
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
|
||||
}
|
||||
}
|
||||
@@ -12,22 +12,8 @@ project.android.productFlavors {
|
||||
CHANNEL_VALUE_BODY : "Passenger",
|
||||
]
|
||||
|
||||
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
|
||||
versionCode rootProject.versionCode as int
|
||||
versionName rootProject.versionName
|
||||
// 应用包名
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
|
||||
// ①标识
|
||||
buildConfigField 'String', 'APP_IDENTITY_MODE_BODY', "\"Passenger\""
|
||||
// ②车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
|
||||
|
||||
// ④GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
buildConfigField 'int', 'GPS_PROVIDER', "1"
|
||||
|
||||
// ⑤构建的是否是演示(美化)模式
|
||||
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ buildscript {
|
||||
classpath "com.mogo.cloud:hook:${service_chain_version}"
|
||||
classpath "com.mogo.cloud:bizconfig:${plugin_version}"
|
||||
classpath 'com.volcengine:apm_insight_plugin:1.4.2'
|
||||
classpath "com.mogo.thread.opt:plg:10.2.0_mogo"
|
||||
classpath "com.mogo.thread.opt:plg:10.2.1_mogo"
|
||||
classpath "com.mogo.cloud:systrace:${plugin_version}"
|
||||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
|
||||
classpath "com.mogo.sticky:service:${plugin_version}"
|
||||
|
||||
@@ -209,7 +209,7 @@ ext {
|
||||
//========================= autosize ======================
|
||||
androidautoSize : 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1',
|
||||
|
||||
thread_opt : "com.mogo.thread.opt:lib:10.2.0_mogo",
|
||||
thread_opt : "com.mogo.thread.opt:lib:10.2.1_mogo",
|
||||
|
||||
weak_network : "com.mogo.weak:network:1.0.1",
|
||||
btrace : "com.bytedance.btrace:rhea-core:2.0.0",
|
||||
|
||||
@@ -117,7 +117,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
|
||||
}
|
||||
|
||||
override fun queryV2XEvents() {
|
||||
if ((AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && !FunctionBuildConfig.isNewV2NData)
|
||||
if ((AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && (!FunctionBuildConfig.v2nMainSwitch || !FunctionBuildConfig.isNewV2NData))
|
||||
|| AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
v2xPoiLoader.queryWholeRoadEvents()
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ object OverViewDataManager {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
it?.apply {
|
||||
if ((AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && !FunctionBuildConfig.isNewV2NData)
|
||||
if ((AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && (!FunctionBuildConfig.v2nMainSwitch || !FunctionBuildConfig.isNewV2NData))
|
||||
|| AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerFuncBizListenerManager.invokeV2XEvents(this)
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
handleRoadMarkerEvent(event.data.toRoadMarker())
|
||||
}
|
||||
is V2XEvent.RoadEventX -> {
|
||||
if (!AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) || !FunctionBuildConfig.isNewV2NData) {
|
||||
if (!AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) || !FunctionBuildConfig.v2nMainSwitch || !FunctionBuildConfig.isNewV2NData) {
|
||||
handleRoadMarkerEvent(event.data.toRoadMarker())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,21 +239,21 @@ internal object V2NIdentifyDrawer {
|
||||
}
|
||||
|
||||
private fun drawShiGong(events: List<TrackedObject>) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && FunctionBuildConfig.isNewV2NData) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
||||
handler.removeMessages(MSG_WHAT_DRAW_SHIGONE)
|
||||
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_SHIGONE, events))
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawShiGu(events: List<TrackedObject>) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && FunctionBuildConfig.isNewV2NData) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
||||
handler.removeMessages(MSG_WHAT_DRAW_SHIGU)
|
||||
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_SHIGU, events))
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawYongDu(events: List<MogoV2X.RTEData_PB>) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && FunctionBuildConfig.isNewV2NData) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
||||
handler.removeMessages(MSG_WHAT_DRAW_YONGDU)
|
||||
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_YONGDU, events))
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import io.netty.channel.Channel
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@@ -1093,6 +1094,13 @@ class MoGoAutopilotControlProvider :
|
||||
return AdasManager.getInstance().sendSweeperCloudSuspendResumeTaskResp(reqNo, bigTaskActionResp)
|
||||
}
|
||||
|
||||
override fun sendParallelDrivingReq(
|
||||
reqNo: String,
|
||||
parallelRequest: ParallelDrivingRequest.ParallelRequest
|
||||
): Boolean {
|
||||
return AdasManager.getInstance().sendParallelDrivingReq(reqNo, parallelRequest)
|
||||
}
|
||||
|
||||
override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
|
||||
if (isDrawPointCloud) {
|
||||
AdasManager.getInstance().subscribeInterface(
|
||||
|
||||
@@ -49,28 +49,32 @@ import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import com.mogo.support.obu.ObuScene
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhjt.mogo.adas.data.bean.AdasParam
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
import com.zhjt.mogo.adas.data.AiCloudTask
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.big.SweeperBigTaskStatus
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.big.SweeperBigTaskStatus
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendResume
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import fault_management.FmInfo
|
||||
import function_state_management.FunctionStates
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.v2x.MogoV2X
|
||||
import mogo.v2x.RoadOverviewEvents
|
||||
import mogo.yycp.paralleldriving.protocol.ParallelTaskProcessNoticeOuterClass
|
||||
import mogo_msg.MogoReportMsg
|
||||
import perception.TrafficLightOuterClass
|
||||
import planning.RoboSweeperTaskIndexOuterClass
|
||||
@@ -444,6 +448,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
invokeSystemStatus(statusInf)
|
||||
}
|
||||
|
||||
override fun onFaultManagementState(header: MessagePad.Header?, fmInfo: FmInfo.FaultResultMsg) {
|
||||
CallerFaultManagementStateListenerManager.invokeFaultManagementState(fmInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集配置应答
|
||||
*/
|
||||
@@ -574,7 +582,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudTask(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
taskInfo: SweeperTask.TaskInfo?
|
||||
@@ -598,7 +606,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudTaskConfirm(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
taskConfirm: SweeperTaskConfirm.TaskConfirm?
|
||||
@@ -622,7 +630,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudTaskStatus(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
taskStatusPush: SweeperTaskStatus.TaskStatusPush?
|
||||
@@ -646,7 +654,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudTaskStop(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
stopTaskReq: SweeperTaskStop.StopTaskReq?
|
||||
@@ -671,7 +679,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudTaskSuspendResume(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
suspendResumeTaskResp: SweeperTaskSuspendResume.SuspendResumeTaskResp?
|
||||
@@ -695,7 +703,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudBootable(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
isBootableResp: SweeperBootable.IsBootableResp?
|
||||
@@ -719,7 +727,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onSweeperFutianCloudBigTaskStatus(
|
||||
header: MessagePad.Header,
|
||||
messageType: SweeperCloudTask.MessageType,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
bigTaskStatusPush: SweeperBigTaskStatus.BigTaskStatusPush?
|
||||
@@ -732,13 +740,46 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 10、云端下发任务暂停/恢复指令到pad(type: 100010)-> sweeper_task_cloud_suspend_resume.proto
|
||||
*
|
||||
* @param header 头
|
||||
* @param messageType 消息类型
|
||||
* @param reqNo 请求编号
|
||||
* @param sysTime 当前时间戳
|
||||
* @param bigTaskActionPush 数据
|
||||
*/
|
||||
override fun onSweeperFutianCloudTaskCloudSuspendResume(header: MessagePad.Header, messageType: AiCloudTask.MessageType, reqNo: String?, sysTime: Long, bigTaskActionPush: SweeperTaskCloudSuspendResume.BigTaskActionPush?) {
|
||||
CallerSweeperFutianCloudTaskListenerManager.invokeSweeperFutianCloudTaskCloudSuspendResume(messageType, reqNo, sysTime, bigTaskActionPush)
|
||||
}
|
||||
|
||||
/**
|
||||
* 无人化场景
|
||||
* 平行驾驶请求相关状态反馈
|
||||
*
|
||||
* @param header 头
|
||||
* @param messageType 消息类型
|
||||
* @param reqNo 请求编号
|
||||
* @param sysTime 当前时间戳
|
||||
* @param parallelTaskProcessNotice 数据
|
||||
*/
|
||||
override fun onParallelDrivingResp(
|
||||
header: MessagePad.Header,
|
||||
messageType: AiCloudTask.MessageType,
|
||||
reqNo: String?,
|
||||
sysTime: Long,
|
||||
parallelTaskProcessNotice: ParallelTaskProcessNoticeOuterClass.ParallelTaskProcessNotice?
|
||||
) {
|
||||
CallerParallelDrivingListenerManager.invokeParallelDrivingListener(parallelTaskProcessNotice)
|
||||
}
|
||||
|
||||
/**
|
||||
* 清扫车云端任务未知类型
|
||||
*
|
||||
* @param header 头
|
||||
* @param bytes 原始数据
|
||||
*/
|
||||
override fun onSweeperFutianCloudTaskUnknown(header: MessagePad.Header, bytes: ByteArray) {
|
||||
override fun onAiCloudTaskUnknown(header: MessagePad.Header, bytes: ByteArray) {
|
||||
CallerSweeperFutianCloudTaskListenerManager.invokeSweeperFutianCloudTaskUnknown(bytes)
|
||||
}
|
||||
|
||||
@@ -844,7 +885,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
*/
|
||||
override fun onAutopilotAbility(
|
||||
isAutopilotAbility: Boolean,
|
||||
unableAutopilotReasons: ArrayList<UnableAutopilotReason>?
|
||||
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
|
||||
) {
|
||||
if (unableAutopilotReasons != null && unableAutopilotReasons.size > 0) {
|
||||
autopilotAbilityCheck(isAutopilotAbility, unableAutopilotReasons.toString())
|
||||
@@ -852,6 +893,16 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
invokeAutopilotAbility(isAutopilotAbility, unableAutopilotReasons)
|
||||
}
|
||||
|
||||
override fun onParallelDrivingAbility(
|
||||
isParallelDrivingAbility: Boolean,
|
||||
unableParallelDrivingReasons: java.util.ArrayList<UnableLaunchReason>?
|
||||
) {
|
||||
CallerParallelDrivingActionsListenerManager.invokeParallelDrivingAbility(
|
||||
isParallelDrivingAbility,
|
||||
unableParallelDrivingReasons
|
||||
)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -39,10 +40,12 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
init {
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED)
|
||||
CallerParallelDrivingActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED)
|
||||
}
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
CallerAutopilotActionsListenerManager.setConnected(ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED)
|
||||
CallerParallelDrivingActionsListenerManager.setConnected(ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED)
|
||||
AppConfigInfo.connectStatusDescribe = reason
|
||||
when (ipcConnectionStatus) {
|
||||
Constants.IPC_CONNECTION_STATUS.CONNECTED -> {
|
||||
|
||||
@@ -561,32 +561,34 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
|
||||
}
|
||||
1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
|
||||
if (HmiBuildConfig.isShowRunRedLightView) {
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
CallerLogger.d(
|
||||
"${M_OBU}${TAG}",
|
||||
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
|
||||
)
|
||||
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
|
||||
return
|
||||
if(HmiBuildConfig.isShowObuV2iView){
|
||||
if (HmiBuildConfig.isShowRunRedLightView) {
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
CallerLogger.d(
|
||||
"${M_OBU}${TAG}",
|
||||
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
|
||||
)
|
||||
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
|
||||
return
|
||||
}
|
||||
saveObuToDcData(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
CommunicationType.V2I
|
||||
)
|
||||
showWarning(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
WarningDirectionEnum.ALERT_WARNING_NON
|
||||
)
|
||||
}
|
||||
saveObuToDcData(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
CommunicationType.V2I
|
||||
)
|
||||
showWarning(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
WarningDirectionEnum.ALERT_WARNING_NON
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
* v2v预警信息 CvxRvInfoIndInfo CvxV2vThreatIndInfo 他车
|
||||
*/
|
||||
override fun onObuRvWarning(data: ObuScene.RvWarningData) {
|
||||
if (HmiBuildConfig.isShowObuV2vView) {
|
||||
if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2vView) {
|
||||
if (data.warningMsg != null) {
|
||||
// 更新数据,远车数据,之前要匹配uuid
|
||||
data.vehBasicsMsg?.let {
|
||||
@@ -1042,25 +1042,27 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
|
||||
}
|
||||
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
|
||||
if (HmiBuildConfig.isShowRunRedLightView) {
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
saveObuData(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
CommunicationType.V2I
|
||||
)
|
||||
showWarning(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
WarningDirectionEnum.ALERT_WARNING_NON
|
||||
)
|
||||
if(HmiBuildConfig.isShowObuV2iView){
|
||||
if (HmiBuildConfig.isShowRunRedLightView) {
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
saveObuData(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
CommunicationType.V2I
|
||||
)
|
||||
showWarning(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
WarningDirectionEnum.ALERT_WARNING_NON
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
SharedPrefsMgr.getInstance(mContext!!).putLong("typePassenger", 0)
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
ipcUpgradeManager.init(context)
|
||||
UiThreadHandler.postDelayed({ queryAppUpgrade() }, 10_000)
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
|
||||
@@ -2,14 +2,12 @@ package com.zhjt.mogo_core_function_devatools.report
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.deva.report.ReportEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import mogo_msg.MogoReportMsg
|
||||
|
||||
@@ -47,11 +45,8 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
|
||||
private val reportList = arrayListOf<ReportEntity>()
|
||||
|
||||
fun initServer(){
|
||||
//乘客屏不显示监控信息弹窗,只在司机端提示
|
||||
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun showReportListWindow(context: Context, isShow: Boolean){
|
||||
@@ -149,11 +144,8 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
|
||||
}
|
||||
|
||||
fun destroy(){
|
||||
//乘客屏不显示监控信息弹窗,只在司机端提示
|
||||
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
|
||||
// 移除 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
// 移除 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,10 @@ package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import android.widget.Toast
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
@@ -21,18 +22,18 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotGetParamResponseDispatcher
|
||||
import com.mogo.eagle.core.function.call.devatools.*
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.data.bean.AdasParam
|
||||
import kotlinx.android.synthetic.main.view_sop_setting.view.*
|
||||
import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,11 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
const val TAG = "SOPSettingView"
|
||||
}
|
||||
|
||||
/**
|
||||
* OBU连接状态
|
||||
*/
|
||||
private var obuConnectStatus = false
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_sop_setting, this, true)
|
||||
initView()
|
||||
@@ -57,103 +63,200 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
|
||||
private fun initView() {
|
||||
sopLayout.setOnClickListener { }
|
||||
tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
|
||||
tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 绕障类功能开关",isChecked)
|
||||
CallerAutoPilotControlManager.sendDetouring(isChecked)
|
||||
FunctionBuildConfig.isDetouring = isChecked
|
||||
//V2X消息设置
|
||||
v2xSetting()
|
||||
//地图效果类设置
|
||||
mapSetting()
|
||||
//与车相关类设置
|
||||
vehicleSetting()
|
||||
//其他类别开关设置
|
||||
otherSetting()
|
||||
}
|
||||
|
||||
/**
|
||||
* V2X消息设置
|
||||
*/
|
||||
private fun v2xSetting(){
|
||||
//V2X总开关
|
||||
scV2XSwitch.isChecked = FunctionBuildConfig.v2xMainSwitch
|
||||
scV2XSwitch.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.v2xMainSwitch = isChecked
|
||||
hmiAction("SOP V2X总开关, ",isChecked)
|
||||
Log.i(TAG,"SOP V2X总开关,$isChecked")
|
||||
if(isChecked){
|
||||
//V2N总开关
|
||||
scV2NSwitch.isChecked = FunctionBuildConfig.v2nMainSwitch
|
||||
hmiAction("SOP V2N总开关, ",FunctionBuildConfig.v2nMainSwitch)
|
||||
Log.i(TAG,"SOP V2N总开关, ${FunctionBuildConfig.v2nMainSwitch}")
|
||||
//V2I总开关
|
||||
scV2ISwitch.isChecked = HmiBuildConfig.isShowObuV2iView
|
||||
hmiAction("SOP V2I总开关, ",HmiBuildConfig.isShowObuV2iView)
|
||||
Log.i(TAG,"SOP V2I总开关, ${HmiBuildConfig.isShowObuV2iView}")
|
||||
//V2V总开关
|
||||
scObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView
|
||||
hmiAction("SOP V2V总开关, ",HmiBuildConfig.isShowObuV2vView)
|
||||
Log.i(TAG,"SOP V2V总开关, ${HmiBuildConfig.isShowObuV2vView}")
|
||||
//obu总开关
|
||||
scObu.isChecked = obuConnectStatus
|
||||
hmiAction("SOP obu总开关, ",obuConnectStatus)
|
||||
Log.i(TAG,"SOP obu总开关, $obuConnectStatus")
|
||||
if(obuConnectStatus){
|
||||
CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP)
|
||||
}
|
||||
}else{
|
||||
//V2N总开关
|
||||
scV2NSwitch.isChecked = false
|
||||
hmiAction("SOP V2N总开关, ",false)
|
||||
Log.i(TAG,"SOP V2N总开关, false")
|
||||
//V2I总开关
|
||||
scV2ISwitch.isChecked = false
|
||||
hmiAction("SOP V2I总开关, ",false)
|
||||
Log.i(TAG,"SOP V2I总开关, false")
|
||||
//V2V总开关
|
||||
scObuV2vView.isChecked = false
|
||||
hmiAction("SOP V2V总开关, ",false)
|
||||
Log.i(TAG,"SOP V2V总开关, false")
|
||||
//obu总开关
|
||||
scObu.isChecked = false
|
||||
hmiAction("SOP OBU控制总开关, ",false)
|
||||
Log.i(TAG,"SOP OBU控制总开关, false")
|
||||
//断开链接
|
||||
CallerObuApiManager.disConnectObu()
|
||||
}
|
||||
scV2NSwitch.isEnabled = isChecked
|
||||
scV2ISwitch.isEnabled = isChecked
|
||||
scObuV2vView.isEnabled = isChecked
|
||||
scObu.isEnabled = isChecked
|
||||
}
|
||||
|
||||
tbMarkingObstacles.isChecked = FunctionBuildConfig.isPNCWarning
|
||||
tbMarkingObstacles.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 危险障碍物颜色标记开关",isChecked)
|
||||
FunctionBuildConfig.isPNCWarning = isChecked
|
||||
//V2N总开关
|
||||
scV2NSwitch.isChecked = FunctionBuildConfig.v2nMainSwitch
|
||||
//根据V2N状态设置子开关是否可以点击
|
||||
//V2N新链路
|
||||
scNewV2NData.isEnabled = FunctionBuildConfig.v2nMainSwitch
|
||||
//V2N场景进PNC
|
||||
scV2nPnc.isEnabled = FunctionBuildConfig.v2nMainSwitch
|
||||
//绿波通行(默认关闭)
|
||||
scGreenWaveSop.isEnabled = FunctionBuildConfig.v2nMainSwitch
|
||||
scV2NSwitch.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(isChecked){
|
||||
//V2N新链路
|
||||
scNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData
|
||||
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",FunctionBuildConfig.isNewV2NData)
|
||||
Log.i(TAG,"SOP 是否是V2N新链路(云->工控机->App), ${FunctionBuildConfig.isNewV2NData}")
|
||||
//V2N场景进PNC
|
||||
scV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc
|
||||
hmiAction("SOP V2N场景进PNC, ",FunctionBuildConfig.isV2NPnc)
|
||||
Log.i(TAG,"SOP V2N场景进PNC, ${FunctionBuildConfig.isV2NPnc}")
|
||||
CallerAutoPilotControlManager.sendV2nToPncCmd(FunctionBuildConfig.isV2NPnc)
|
||||
//绿波通行
|
||||
scGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView
|
||||
hmiAction("SOP obu绿波通行, ",HmiBuildConfig.isShowGreenWaveView)
|
||||
Log.i(TAG,"SOP obu绿波通行, ${HmiBuildConfig.isShowGreenWaveView}")
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "1".toByteArray())
|
||||
}else{
|
||||
//V2N新链路
|
||||
scNewV2NData.isChecked = false
|
||||
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",false)
|
||||
Log.i(TAG,"SOP 是否是V2N新链路(云->工控机->App), false")
|
||||
//V2N场景进PNC
|
||||
scV2nPnc.isChecked = false
|
||||
hmiAction("SOP V2N场景进PNC, ",false)
|
||||
Log.i(TAG,"SOP V2N场景进PNC, false")
|
||||
CallerAutoPilotControlManager.sendV2nToPncCmd(false)
|
||||
//绿波通行
|
||||
scGreenWaveSop.isChecked = false
|
||||
hmiAction("SOP obu绿波通行, ",false)
|
||||
Log.i(TAG,"SOP obu绿波通行, false")
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "0".toByteArray())
|
||||
}
|
||||
scNewV2NData.isEnabled = isChecked
|
||||
scV2nPnc.isEnabled = isChecked
|
||||
scGreenWaveSop.isEnabled = isChecked
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
FunctionBuildConfig.v2nMainSwitch = isChecked
|
||||
}
|
||||
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbMarkingObstacles.visibility = View.GONE
|
||||
//V2I总开关
|
||||
scV2ISwitch.isChecked = HmiBuildConfig.isShowObuV2iView //是否展示obu的v2i
|
||||
//根据V2I状态设置子开关是否可以点击
|
||||
scV2iPnc.isEnabled = HmiBuildConfig.isShowObuV2iView
|
||||
scRunRedLightSop.isEnabled = HmiBuildConfig.isShowObuV2iView
|
||||
scObuWeaknessTrafficSop.isEnabled = HmiBuildConfig.isShowObuV2iView
|
||||
scV2ISwitch.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(isChecked){
|
||||
//V2I场景进PNC
|
||||
scV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc
|
||||
hmiAction("SOP V2I场景进PNC, ",FunctionBuildConfig.isV2IPnc)
|
||||
Log.i(TAG,"SOP V2I场景进PNC,${FunctionBuildConfig.isV2IPnc}")
|
||||
CallerAutoPilotControlManager.sendV2iToPncCmd(FunctionBuildConfig.isV2IPnc)
|
||||
//闯红灯预警
|
||||
scRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView
|
||||
hmiAction("SOP obu闯红灯预警, ",HmiBuildConfig.isShowRunRedLightView)
|
||||
Log.i(TAG,"SOP obu闯红灯预警, ${HmiBuildConfig.isShowRunRedLightView}")
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray())
|
||||
//路侧弱势交通参与者
|
||||
scObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
|
||||
hmiAction("SOP obu弱势交通控制, ",HmiBuildConfig.isShowObuWeaknessTrafficView)
|
||||
Log.i(TAG,"SOP obu弱势交通控制, ${HmiBuildConfig.isShowObuWeaknessTrafficView}")
|
||||
}else{
|
||||
//V2I场景进PNC
|
||||
scV2iPnc.isChecked = false
|
||||
CallerAutoPilotControlManager.sendV2iToPncCmd(false)
|
||||
hmiAction("SOP V2I场景进PNC, ",false)
|
||||
Log.i(TAG,"SOP V2I场景进PNC, false")
|
||||
//闯红灯预警
|
||||
scRunRedLightSop.isChecked = false
|
||||
hmiAction("SOP obu闯红灯预警, ",false)
|
||||
Log.i(TAG,"SOP obu闯红灯预警, false")
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "0".toByteArray())
|
||||
//路侧弱势交通参与者
|
||||
scObuWeaknessTrafficSop.isChecked = false
|
||||
hmiAction("SOP obu弱势交通控制, ",false)
|
||||
Log.i(TAG,"SOP obu弱势交通控制, false")
|
||||
}
|
||||
scV2iPnc.isEnabled = isChecked
|
||||
scRunRedLightSop.isEnabled = isChecked
|
||||
scObuWeaknessTrafficSop.isEnabled = isChecked
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
HmiBuildConfig.isShowObuV2iView = isChecked
|
||||
}
|
||||
|
||||
tbRouteDynamicEffect.isChecked = HmiBuildConfig.isShowRouteStrategy
|
||||
tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 引导线动态效果",isChecked)
|
||||
HmiBuildConfig.isShowRouteStrategy = isChecked
|
||||
//V2N新链路
|
||||
scNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData
|
||||
scNewV2NData.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",isChecked)
|
||||
Log.i(TAG,"SOP 是否是V2N新链路(云->工控机->App) ${isChecked}")
|
||||
FunctionBuildConfig.isNewV2NData = isChecked
|
||||
}
|
||||
|
||||
//默认开启
|
||||
tbObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
|
||||
tbObuWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP obu弱势交通控制, ",isChecked)
|
||||
HmiBuildConfig.isShowObuWeaknessTrafficView = isChecked
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认关闭
|
||||
*/
|
||||
tbCloudWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowCloudWeaknessTrafficView
|
||||
tbCloudWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 云端弱势交通控制, ",isChecked)
|
||||
HmiBuildConfig.isShowCloudWeaknessTrafficView = isChecked
|
||||
}
|
||||
|
||||
tbV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc
|
||||
tbV2nPnc.setOnCheckedChangeListener{ compoundButton, isChecked ->
|
||||
//V2N场景进PNC
|
||||
scV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc
|
||||
scV2nPnc.setOnCheckedChangeListener{ compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP V2N场景进PNC, ",isChecked)
|
||||
Log.i(TAG,"SOP V2N场景进PNC, $isChecked")
|
||||
CallerAutoPilotControlManager.sendV2nToPncCmd(isChecked)
|
||||
FunctionBuildConfig.isV2NPnc = isChecked
|
||||
}
|
||||
|
||||
tbV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc
|
||||
tbV2iPnc.setOnCheckedChangeListener{ compoundButton, isChecked ->
|
||||
//绿波通行(默认关闭)
|
||||
scGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView
|
||||
scGreenWaveSop.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP V2I场景进PNC, ",isChecked)
|
||||
CallerAutoPilotControlManager.sendV2iToPncCmd(isChecked)
|
||||
FunctionBuildConfig.isV2IPnc = isChecked
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认打开
|
||||
*/
|
||||
tbObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView
|
||||
tbObuV2vView.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP obuV2V开关, ",isChecked)
|
||||
HmiBuildConfig.isShowObuV2vView = isChecked
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认打开
|
||||
*/
|
||||
tbObuV2iView.isChecked = HmiBuildConfig.isShowObuV2iView
|
||||
tbObuV2iView.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP obuV2i开关, ",isChecked)
|
||||
HmiBuildConfig.isShowObuV2iView = isChecked
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认关闭
|
||||
*/
|
||||
tbRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView
|
||||
tbRunRedLightSop.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP obu闯红灯预警, ",isChecked)
|
||||
HmiBuildConfig.isShowRunRedLightView = isChecked
|
||||
if (HmiBuildConfig.isShowRunRedLightView) {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray())
|
||||
} else {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "0".toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认关闭
|
||||
*/
|
||||
tbGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView
|
||||
tbGreenWaveSop.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP obu绿波通行, ",isChecked)
|
||||
Log.i(TAG,"SOP obu绿波通行, $isChecked")
|
||||
HmiBuildConfig.isShowGreenWaveView = isChecked
|
||||
if (HmiBuildConfig.isShowGreenWaveView) {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "1".toByteArray())
|
||||
@@ -162,34 +265,141 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
tbTrafficLight.isChecked = !HmiBuildConfig.isShowTrafficLightView
|
||||
tbTrafficLight.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 红绿灯标识开关, ",isChecked)
|
||||
if (isChecked) {
|
||||
CallerHmiManager.showTrafficLightView()
|
||||
//V2I场景进PNC
|
||||
scV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc
|
||||
scV2iPnc.setOnCheckedChangeListener{ compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP V2I场景进PNC, ",isChecked)
|
||||
Log.i(TAG,"SOP V2I场景进PNC, $isChecked")
|
||||
CallerAutoPilotControlManager.sendV2iToPncCmd(isChecked)
|
||||
FunctionBuildConfig.isV2IPnc = isChecked
|
||||
}
|
||||
|
||||
//闯红灯预警(默认关闭)
|
||||
scRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView
|
||||
scRunRedLightSop.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP obu闯红灯预警, ",isChecked)
|
||||
Log.i(TAG,"SOP obu闯红灯预警, $isChecked")
|
||||
HmiBuildConfig.isShowRunRedLightView = isChecked
|
||||
if (HmiBuildConfig.isShowRunRedLightView) {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray())
|
||||
} else {
|
||||
CallerHmiManager.hideTrafficLightView()
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "0".toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
tbSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView
|
||||
tbSpeedLimit.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 限速标识开关, ",isChecked)
|
||||
if (isChecked) {
|
||||
HmiBuildConfig.isShowLimitingVelocityView = true
|
||||
} else {
|
||||
HmiBuildConfig.isShowLimitingVelocityView = false
|
||||
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.GONE)
|
||||
//路侧弱势交通参与者(默认开启)
|
||||
scObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
|
||||
scObuWeaknessTrafficSop.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP obu弱势交通控制, ",isChecked)
|
||||
Log.i(TAG,"SOP obu弱势交通控制, $isChecked")
|
||||
HmiBuildConfig.isShowObuWeaknessTrafficView = isChecked
|
||||
}
|
||||
|
||||
//V2V总开关(默认关闭)
|
||||
scObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView
|
||||
scObuV2vView.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP obuV2V开关, ",isChecked)
|
||||
Log.i(TAG,"SOP obuV2V开关, $isChecked")
|
||||
HmiBuildConfig.isShowObuV2vView = isChecked
|
||||
}
|
||||
|
||||
//obu总开关
|
||||
obuConnectStatus = CallerObuApiManager.isConnected()
|
||||
scObu.isChecked = obuConnectStatus
|
||||
scObu.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP OBU控制总开关, ",isChecked)
|
||||
Log.i(TAG,"SOP OBU控制总开关, $isChecked")
|
||||
if (isChecked) {
|
||||
CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP)
|
||||
} else {
|
||||
//断开链接
|
||||
CallerObuApiManager.disConnectObu()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图效果类设置
|
||||
*/
|
||||
private fun mapSetting(){
|
||||
//危险障碍物颜色标记开关
|
||||
scMarkingObstacles.isChecked = FunctionBuildConfig.isPNCWarning
|
||||
scMarkingObstacles.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 危险障碍物颜色标记开关, ",isChecked)
|
||||
Log.i(TAG,"SOP 危险障碍物颜色标记开关, $isChecked")
|
||||
FunctionBuildConfig.isPNCWarning = isChecked
|
||||
}
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
scMarkingObstacles.isEnabled = false
|
||||
}
|
||||
|
||||
//引导线动态效果
|
||||
scRouteDynamicEffect.isChecked = HmiBuildConfig.isShowRouteStrategy
|
||||
scRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 引导线动态效果, ",isChecked)
|
||||
Log.i(TAG,"SOP 引导线动态效果, $isChecked")
|
||||
HmiBuildConfig.isShowRouteStrategy = isChecked
|
||||
}
|
||||
|
||||
//点云效果
|
||||
//初始化点云数据渲染情况
|
||||
scDrawPointCloudData.isChecked = FunctionBuildConfig.isDrawPointCloudData
|
||||
//是否渲染点云数据
|
||||
scDrawPointCloudData.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked)
|
||||
FunctionBuildConfig.isDrawPointCloudData = isChecked
|
||||
CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked)
|
||||
hmiAction("SOP 是否渲染点云数据, ",isChecked)
|
||||
Log.i(TAG,"SOP 是否渲染点云数据, $isChecked")
|
||||
}
|
||||
|
||||
//自车光圈
|
||||
scCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable
|
||||
scCarAperture.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(isChecked)
|
||||
FunctionBuildConfig.isDisplayAnimEnable = isChecked
|
||||
hmiAction("SOP 是否展示自车光圈,",isChecked)
|
||||
Log.i(TAG,"SOP 是否展示自车光圈,$isChecked")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 与车相关类设置
|
||||
*/
|
||||
private fun vehicleSetting(){
|
||||
//绕障类功能
|
||||
scObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
|
||||
scObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 绕障类功能开关, ",isChecked)
|
||||
Log.i(TAG,"SOP 绕障类功能开关, $isChecked")
|
||||
CallerAutoPilotControlManager.sendDetouring(isChecked)
|
||||
FunctionBuildConfig.isDetouring = isChecked
|
||||
}
|
||||
|
||||
// 演示模式,上一次勾选的数据
|
||||
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
tbDemoMode.setOnCheckedChangeListener { compoundButton, _ ->
|
||||
scDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
scDemoMode.setOnCheckedChangeListener { compoundButton, _ ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP 演示模式开关, ",!FunctionBuildConfig.isDemoMode)
|
||||
Log.i(TAG,"SOP 演示模式开关, ${!FunctionBuildConfig.isDemoMode}")
|
||||
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
|
||||
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
|
||||
CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_DEMO, FunctionBuildConfig.isDemoMode)
|
||||
@@ -200,87 +410,42 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
}
|
||||
//只在司机端设置美化模式开关功能
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbDemoMode.visibility = View.GONE
|
||||
scDemoMode.isEnabled = false
|
||||
}
|
||||
|
||||
// 雨天模式,上一次勾选的数据
|
||||
tbRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
tbRainMode.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
scRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
scRainMode.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
hmiAction("SOP 雨天模式开关, ",isChecked)
|
||||
Log.i(TAG,"SOP 雨天模式开关, $isChecked")
|
||||
FunctionBuildConfig.isRainMode = isChecked
|
||||
CallerAutoPilotControlManager.setRainMode(isChecked)
|
||||
CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_RAIN, isChecked)
|
||||
}
|
||||
//雨天模式按钮只在司机屏生效,乘客屏不显示
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbRainMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
tbObu.isChecked = CallerObuApiManager.isConnected()
|
||||
tbObu.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP OBU控制总开关, ",isChecked)
|
||||
if (isChecked) {
|
||||
CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP)
|
||||
} else {
|
||||
//断开链接
|
||||
CallerObuApiManager.disConnectObu()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tbIPCReport.isChecked = FunctionBuildConfig.isReportWarning
|
||||
tbIPCReport.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 是否开启异常上报, ",isChecked)
|
||||
FunctionBuildConfig.isReportWarning = isChecked
|
||||
}
|
||||
|
||||
tbNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData
|
||||
tbNewV2NData.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",isChecked)
|
||||
FunctionBuildConfig.isNewV2NData = isChecked
|
||||
}
|
||||
|
||||
// M1 360度环视
|
||||
tbNew360LookAround?.also {
|
||||
if (!AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
|
||||
it.isEnabled = false
|
||||
} else {
|
||||
it.isEnabled = true
|
||||
it.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
CallerHmiManager.showM1360LookAround()
|
||||
} else {
|
||||
CallerHmiManager.hidM1360LookAround()
|
||||
}
|
||||
}
|
||||
it.isChecked = CallerHmiManager.isM1360LookAroundShowing()
|
||||
}
|
||||
scRainMode.isEnabled = false
|
||||
}
|
||||
|
||||
//弱网减速停车
|
||||
tbWeakNetSlowDown.isChecked = FunctionBuildConfig.isWeakNetSlowDown
|
||||
tbWeakNetSlowDown.setOnCheckedChangeListener{_, isChecked ->
|
||||
scWeakNetSlowDown.isChecked = FunctionBuildConfig.isWeakNetSlowDown
|
||||
scWeakNetSlowDown.setOnCheckedChangeListener{_, isChecked ->
|
||||
FunctionBuildConfig.isWeakNetSlowDown = isChecked
|
||||
CallerAutoPilotControlManager.sendWeakNetSlowDown(isChecked)
|
||||
hmiAction("SOP 弱网减速停车, ",isChecked)
|
||||
Log.i(TAG,"SOP 弱网减速停车, $isChecked")
|
||||
}
|
||||
|
||||
//故障减速停车
|
||||
tbFaultSlowDown.isChecked = FunctionBuildConfig.isFaultSlowDown
|
||||
tbFaultSlowDown.setOnCheckedChangeListener{_, isChecked ->
|
||||
scFaultSlowDown.isChecked = FunctionBuildConfig.isFaultSlowDown
|
||||
scFaultSlowDown.setOnCheckedChangeListener{_, isChecked ->
|
||||
FunctionBuildConfig.isFaultSlowDown = isChecked
|
||||
CallerAutoPilotControlManager.sendBreakdownSlowDown(isChecked)
|
||||
hmiAction("SOP 故障减速停车, ",isChecked)
|
||||
}
|
||||
|
||||
//是否展示被动触发的录包弹窗(自动驾驶下出现问题触发的录包)
|
||||
tbShowBagRecordWindow.isChecked = FunctionBuildConfig.isShowBagRecordWindow
|
||||
tbShowBagRecordWindow.setOnCheckedChangeListener{_, isChecked ->
|
||||
FunctionBuildConfig.isShowBagRecordWindow = isChecked
|
||||
hmiAction("SOP 是否展示被动触发的录包弹窗, ",isChecked)
|
||||
Log.i(TAG,"SOP 故障减速停车, $isChecked")
|
||||
}
|
||||
//融合模式
|
||||
rgFusionMode.setOnCheckedChangeListener { _, p1 ->
|
||||
@@ -306,9 +471,74 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
FunctionBuildConfig.fusionMode = 5
|
||||
}
|
||||
}
|
||||
hmiAction("SOP 融合模式, ",FunctionBuildConfig.fusionMode)
|
||||
Log.i(TAG,"SOP 融合模式, ${FunctionBuildConfig.fusionMode}")
|
||||
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他类别开关设置
|
||||
*/
|
||||
private fun otherSetting(){
|
||||
//红绿灯标识开关
|
||||
scTrafficLight.isChecked = !HmiBuildConfig.isShowTrafficLightView
|
||||
scTrafficLight.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 红绿灯标识开关, ",isChecked)
|
||||
Log.i(TAG,"SOP 红绿灯标识开关, $isChecked")
|
||||
if (isChecked) {
|
||||
CallerHmiManager.showTrafficLightView()
|
||||
} else {
|
||||
CallerHmiManager.hideTrafficLightView()
|
||||
}
|
||||
}
|
||||
|
||||
//限速标识
|
||||
scSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView
|
||||
scSpeedLimit.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 限速标识开关, ",isChecked)
|
||||
Log.i(TAG,"SOP 限速标识开关, $isChecked")
|
||||
if (isChecked) {
|
||||
HmiBuildConfig.isShowLimitingVelocityView = true
|
||||
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.VISIBLE)
|
||||
} else {
|
||||
HmiBuildConfig.isShowLimitingVelocityView = false
|
||||
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
//异常上报提示
|
||||
scIPCReport.isChecked = FunctionBuildConfig.isReportWarning
|
||||
scIPCReport.setOnCheckedChangeListener { _, isChecked ->
|
||||
hmiAction("SOP 是否开启异常上报, ",isChecked)
|
||||
Log.i(TAG,"SOP 是否开启异常上报, $isChecked")
|
||||
FunctionBuildConfig.isReportWarning = isChecked
|
||||
}
|
||||
|
||||
// M1 360度环视
|
||||
scNew360LookAround?.also {
|
||||
if (!AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
|
||||
it.isEnabled = false
|
||||
} else {
|
||||
it.isEnabled = true
|
||||
it.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
CallerHmiManager.showM1360LookAround()
|
||||
} else {
|
||||
CallerHmiManager.hidM1360LookAround()
|
||||
}
|
||||
}
|
||||
it.isChecked = CallerHmiManager.isM1360LookAroundShowing()
|
||||
}
|
||||
}
|
||||
|
||||
//是否展示被动触发的录包弹窗(自动驾驶下出现问题触发的录包)
|
||||
scShowBagRecordWindow.isChecked = FunctionBuildConfig.isShowBagRecordWindow
|
||||
scShowBagRecordWindow.setOnCheckedChangeListener{_, isChecked ->
|
||||
FunctionBuildConfig.isShowBagRecordWindow = isChecked
|
||||
hmiAction("SOP 是否展示被动触发的录包弹窗, ",isChecked)
|
||||
Log.i(TAG,"SOP 是否展示被动触发的录包弹窗, $isChecked")
|
||||
}
|
||||
|
||||
//变道绕障的目标障碍物速度阈值
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
@@ -393,8 +623,11 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
mfStatusLayout.setClickEnabled(false)
|
||||
mfTest.isEnabled = false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
//添加 业务配置监听
|
||||
@@ -410,10 +643,10 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
override fun updateFuncMode(tag: String, boolean: Boolean) {
|
||||
super.updateFuncMode(tag, boolean)
|
||||
if(tag == FUNC_MODE_DEMO){
|
||||
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
scDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
}
|
||||
if(tag == FUNC_MODE_RAIN){
|
||||
tbRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
scRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,40 +659,34 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
CallerDevaToolsManager.mofang()?.unRegisterMoFangStatusListener(this)
|
||||
}
|
||||
|
||||
// private val timerTaskRefresh = object : TimerTask(){
|
||||
// override fun run() {
|
||||
// UiThreadHandler.post{
|
||||
// tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
// tbRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
override fun updateBizView(type: String, lock: Boolean) {
|
||||
when (type) {
|
||||
//美化模式
|
||||
FuncBizConfig.BIZ_BEAUTY_MODE -> {
|
||||
tbDemoMode.isClickable = !lock
|
||||
scDemoMode.isClickable = !lock
|
||||
if(lock){
|
||||
tbDemoMode.visibility = View.INVISIBLE
|
||||
scDemoMode.visibility = View.INVISIBLE
|
||||
}else{
|
||||
tbDemoMode.visibility = View.VISIBLE
|
||||
scDemoMode.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
//雨天模式
|
||||
FuncBizConfig.BIZ_RAIN_MODE -> {
|
||||
tbRainMode.isClickable = !lock
|
||||
scRainMode.isClickable = !lock
|
||||
if (lock) {
|
||||
tbRainMode.visibility = View.INVISIBLE
|
||||
scRainMode.visibility = View.INVISIBLE
|
||||
} else {
|
||||
tbRainMode.visibility = View.VISIBLE
|
||||
scRainMode.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
//危险障碍物颜色标记
|
||||
FuncBizConfig.BIZ_PNC_WARNING -> {
|
||||
tbMarkingObstacles.isClickable = !lock
|
||||
scMarkingObstacles.isClickable = !lock
|
||||
if (lock) {
|
||||
tbMarkingObstacles.visibility = View.INVISIBLE
|
||||
scMarkingObstacles.visibility = View.INVISIBLE
|
||||
} else {
|
||||
tbMarkingObstacles.visibility = View.VISIBLE
|
||||
scMarkingObstacles.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.vehicle
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -12,20 +11,24 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoParallelDrivingStatusListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.mogo.adas.data.bean.MogoReport
|
||||
import mogo.yycp.paralleldriving.protocol.ParallelTaskProcessNoticeOuterClass
|
||||
import mogo_msg.MogoReportMsg
|
||||
|
||||
class TakeOverView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener,
|
||||
IMoGoParallelDrivingStatusListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "TakeOverView"
|
||||
@@ -41,6 +44,7 @@ class TakeOverView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerParallelDrivingListenerManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
@@ -147,5 +151,68 @@ class TakeOverView @JvmOverloads constructor(
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerParallelDrivingListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 平行驾驶状态回调,云端说有状态变化就回调
|
||||
*/
|
||||
override fun onParallelDrivingResp(parallelTaskProcessNotice: ParallelTaskProcessNoticeOuterClass.ParallelTaskProcessNotice?) {
|
||||
parallelTaskProcessNotice?.let {
|
||||
if (takeOver) {
|
||||
return@let
|
||||
}
|
||||
when(it.code){
|
||||
//进入同步状态
|
||||
"START_SYNC"->{
|
||||
|
||||
}
|
||||
//同步结束
|
||||
"EXIT_SYNC"->{
|
||||
|
||||
}
|
||||
//无法接管
|
||||
"UNABLE_TAKEOVER"->{
|
||||
showParallelDrivingWarning("UNABLE_TAKEOVER","远程无法介入,注意随时接管","远程无法介入,注意随时接管")
|
||||
}
|
||||
//同步异常结束
|
||||
"EXCEPTION_EXIT_SYNC"->{
|
||||
showParallelDrivingWarning("EXCEPTION_EXIT_SYNC","远程介入失败,注意随时接管","远程介入失败,注意随时接管")
|
||||
}
|
||||
//任务已被拒绝
|
||||
"TASK_REJECTED"->{
|
||||
|
||||
}
|
||||
//异常请人工驾驶
|
||||
"PARALLEL_EXCEPTION_MANUAL_DRIVING"->{
|
||||
showParallelDrivingWarning("PARALLEL_EXCEPTION_MANUAL_DRIVING","即将靠边停车,注意随时接管","即将靠边停车,注意随时接管")
|
||||
}
|
||||
//平行驾驶异常结束
|
||||
"EXCEPTION_EXIT_PARALLEL_DRIVING"->{
|
||||
showParallelDrivingWarning("EXCEPTION_EXIT_PARALLEL_DRIVING","可能应急停车,注意随时接管","可能应急停车,注意随时接管")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showParallelDrivingWarning(poiType: String,content: String,tts: String){
|
||||
CallerHmiManager.warningV2X(poiType, content, tts,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
takeOver = true
|
||||
ThreadUtils.runOnUiThread{
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDismiss() {
|
||||
takeOver = false
|
||||
ThreadUtils.runOnUiThread{
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
,isFromObu = false)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,9 @@ class LimitingVelocityView constructor(
|
||||
private const val TAG = "LimitingVelocityView"
|
||||
}
|
||||
|
||||
//限速控件是否展示
|
||||
private var isShow = false
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_limiting_speed_vr, this, true)
|
||||
}
|
||||
@@ -38,20 +41,22 @@ class LimitingVelocityView constructor(
|
||||
}
|
||||
|
||||
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (limitingVelocity > 0) {
|
||||
visibility = View.VISIBLE
|
||||
tvLimitingVelocity.text = "$limitingVelocity"
|
||||
tvLimitingSource?.text = DataSourceType.getName(sourceType)
|
||||
} else {
|
||||
visibility = View.GONE
|
||||
tvLimitingSource?.text = ""
|
||||
if(isShow){
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (limitingVelocity > 0) {
|
||||
visibility = View.VISIBLE
|
||||
tvLimitingVelocity.text = "$limitingVelocity"
|
||||
tvLimitingSource?.text = DataSourceType.getName(sourceType)
|
||||
} else {
|
||||
visibility = View.GONE
|
||||
tvLimitingSource?.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun visible(v: Int) {
|
||||
super.visible(v)
|
||||
isShow = v == View.VISIBLE
|
||||
this.visibility = v
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoParallelDrivingActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoParallelDrivingStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.SourceType
|
||||
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest.ParallelRequest
|
||||
import mogo.yycp.paralleldriving.protocol.ParallelTaskProcessNoticeOuterClass
|
||||
|
||||
/**
|
||||
* 平行驾驶状态View
|
||||
*/
|
||||
class ParallelDriveView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener,
|
||||
IMoGoParallelDrivingActionsListener, IMoGoParallelDrivingStatusListener {
|
||||
companion object {
|
||||
private const val TAG = "ParallelDriveView"
|
||||
private const val APP_REQUESTING = 1
|
||||
private const val AD_REQUESTING = 2
|
||||
private const val SYNCHRONIZING = 3
|
||||
private const val PARALLEL_DRIVING = 4
|
||||
private const val FAILURE = 5
|
||||
private const val ONE_EXCEPTION = 6
|
||||
private const val TWO_EXCEPTION = 7
|
||||
private const val UNAVAILABLE = 8
|
||||
}
|
||||
|
||||
//1:ready, 2:自动驾驶中, 7:平行驾驶中
|
||||
@Volatile
|
||||
private var autopilotState: Int = 1
|
||||
|
||||
// 初始状态为0
|
||||
private var state: Int = 0
|
||||
|
||||
private lateinit var rootLayout: ConstraintLayout
|
||||
private lateinit var statusIcon: ImageView
|
||||
private lateinit var statusTitle: TextView
|
||||
private var listener: ClickEventListener? = null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_parallel_drive, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
initView()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerParallelDrivingListenerManager.addListener(TAG, this)
|
||||
CallerParallelDrivingActionsListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
rootLayout = findViewById(R.id.parDriveLayout)
|
||||
statusIcon = findViewById(R.id.ivStatusIcon)
|
||||
statusTitle = findViewById(R.id.tvAutopilotContent)
|
||||
rootLayout.setOnClickListener {
|
||||
when (state) {
|
||||
0 -> {
|
||||
state = APP_REQUESTING
|
||||
updateUI(APP_REQUESTING)
|
||||
reqParaDrive()
|
||||
listener?.onReqClick()
|
||||
}
|
||||
APP_REQUESTING -> {
|
||||
cancelParaDrive()
|
||||
ToastUtils.showShort("请求已取消!")
|
||||
checkAvailableAndUpdateUI()
|
||||
}
|
||||
UNAVAILABLE -> {
|
||||
ToastUtils.showShort("请P档驻车并松开油门刹车后请求")
|
||||
}
|
||||
}
|
||||
}
|
||||
checkAvailableAndUpdateUI()
|
||||
}
|
||||
|
||||
fun setClickEventListener(listener: ClickEventListener?) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
if (state != autopilotState) {
|
||||
synchronized(this) {
|
||||
when (state) {
|
||||
7 -> {
|
||||
if (this.autopilotState != 7) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
updateUI(PARALLEL_DRIVING)
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
if (this.autopilotState == 7 && this.autopilotState != state) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
checkAvailableAndUpdateUI()
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.autopilotState = state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onParallelDrivingAbility(
|
||||
isParallelDrivingAbility: Boolean,
|
||||
unableParallelDrivingReasons: ArrayList<UnableLaunchReason>?
|
||||
) {
|
||||
if (!isParallelDrivingAbility) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
updateUI(UNAVAILABLE)
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onParallelDrivingResp(parallelTaskProcessNotice: ParallelTaskProcessNoticeOuterClass.ParallelTaskProcessNotice?) {
|
||||
parallelTaskProcessNotice?.let {
|
||||
ThreadUtils.runOnUiThread({
|
||||
when (it.code) {
|
||||
"START_SYNC" -> {// 同步中
|
||||
state = SYNCHRONIZING
|
||||
updateUI(SYNCHRONIZING)
|
||||
}
|
||||
"EXCEPTION_EXIT_SYNC" -> {// 同步异常结束
|
||||
state = ONE_EXCEPTION
|
||||
updateUI(ONE_EXCEPTION)
|
||||
}
|
||||
"TASK_REJECTED" -> {// 任务已被拒绝
|
||||
state = FAILURE
|
||||
updateUI(FAILURE)
|
||||
AIAssist.getInstance(context).speakTTSVoice("请求已被拒绝")
|
||||
}
|
||||
"PARALLEL_EXCEPTION_MANUAL_DRIVING" -> {// 异常请人工驾驶
|
||||
state = TWO_EXCEPTION
|
||||
updateUI(TWO_EXCEPTION)
|
||||
}
|
||||
"EXCEPTION_EXIT_PARALLEL_DRIVING" -> {// 平行驾驶异常结束
|
||||
state = ONE_EXCEPTION
|
||||
updateUI(ONE_EXCEPTION)
|
||||
}
|
||||
"EXIT_SYNC" -> {// 同步结束
|
||||
checkAvailableAndUpdateUI()
|
||||
}
|
||||
"UNABLE_TAKEOVER" -> {// 无法接管
|
||||
state = ONE_EXCEPTION
|
||||
updateUI(ONE_EXCEPTION)
|
||||
}
|
||||
"VEHICLE_IN_TROUBLE_PARALLEL_REQUESTED" -> {// 车辆遇困请求平行驾驶
|
||||
state = AD_REQUESTING
|
||||
updateUI(AD_REQUESTING)
|
||||
}
|
||||
}
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isAvailable(unableAutopilotReasons: ArrayList<UnableLaunchReason>?): Boolean {
|
||||
var unavailable = false
|
||||
unableAutopilotReasons?.forEach {
|
||||
if (it.source.ordinal == SourceType.CHASSIS.ordinal) {
|
||||
unavailable = true
|
||||
}
|
||||
}
|
||||
return !unavailable
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
private fun updateUI(state: Int) {
|
||||
when (state) {
|
||||
0 -> {
|
||||
rootLayout.isEnabled = true
|
||||
rootLayout.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_autopilot_status, null)
|
||||
statusTitle.text = context.getString(R.string.parallel_drive)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
}
|
||||
|
||||
APP_REQUESTING -> {
|
||||
rootLayout.isEnabled = true
|
||||
rootLayout.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_para_requesting, null)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
statusTitle.text = context.getString(R.string.parallel_drive_requesting)
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
}
|
||||
|
||||
AD_REQUESTING -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_para_requesting, null)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
statusTitle.text = context.getString(R.string.parallel_drive_requesting)
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
}
|
||||
|
||||
SYNCHRONIZING -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_para_syn, null)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
statusTitle.text = context.getString(R.string.parallel_drive_synchronizing)
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
}
|
||||
|
||||
PARALLEL_DRIVING -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_autopilot_status, null)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
rootLayout.background =
|
||||
resources.getDrawable(R.drawable.bg_auto_pilot_running, null)
|
||||
statusTitle.text = context.getString(R.string.parallel_drive)
|
||||
}
|
||||
|
||||
FAILURE -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 1f
|
||||
rootLayout.postDelayed({
|
||||
checkAvailableAndUpdateUI()
|
||||
}, 1000)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_fail_start, null)
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
statusTitle.text = context.getString(R.string.parallel_drive_failure)
|
||||
}
|
||||
|
||||
ONE_EXCEPTION -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 1f
|
||||
rootLayout.postDelayed({
|
||||
checkAvailableAndUpdateUI()
|
||||
}, 1000)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_fail_start, null)
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
statusTitle.text = context.getString(R.string.parallel_drive_exception)
|
||||
}
|
||||
|
||||
TWO_EXCEPTION -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 1f
|
||||
rootLayout.postDelayed({
|
||||
checkAvailableAndUpdateUI()
|
||||
}, 2000)
|
||||
statusTitle.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
statusIcon.alpha = 1f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_fail_start, null)
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
statusTitle.text = context.getString(R.string.parallel_drive_exception)
|
||||
}
|
||||
|
||||
UNAVAILABLE -> {
|
||||
rootLayout.isEnabled = false
|
||||
rootLayout.alpha = 0.4f
|
||||
statusIcon.background =
|
||||
resources.getDrawable(R.drawable.icon_autopilot_status, null)
|
||||
statusTitle.setTextColor(Color.parseColor("#66FFFFFF"))
|
||||
statusIcon.alpha = 0.4f
|
||||
rootLayout.background = resources.getDrawable(R.drawable.bg_auto_pilot, null)
|
||||
statusTitle.text = context.getString(R.string.parallel_drive)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun reqParaDrive() {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val parallelRequest = ParallelRequest.newBuilder()
|
||||
.setSn(sn)
|
||||
.setType(2)// 2:鹰眼请求
|
||||
.setTakeover(1)// 1:请求平行驾驶接管
|
||||
.setCode("PAD_ACTIVE")
|
||||
parallelRequest.reason = "鹰眼请求"
|
||||
CallerAutoPilotControlManager.sendParallelDrivingReq(
|
||||
System.currentTimeMillis().toString(), parallelRequest.build()
|
||||
)
|
||||
}
|
||||
|
||||
private fun cancelParaDrive() {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val parallelRequest = ParallelRequest.newBuilder()
|
||||
.setSn(sn)
|
||||
.setType(2)// 2:鹰眼请求
|
||||
.setTakeover(2)// 2:取消平行驾驶接管
|
||||
.setCode("PAD_ACTIVE")
|
||||
parallelRequest.reason = "鹰眼请求"
|
||||
CallerAutoPilotControlManager.sendParallelDrivingReq(
|
||||
System.currentTimeMillis().toString(), parallelRequest.build()
|
||||
)
|
||||
}
|
||||
|
||||
private fun checkAvailableAndUpdateUI() {
|
||||
if (CallerParallelDrivingActionsListenerManager.isParallelDrivingAbility()) {
|
||||
state = 0
|
||||
updateUI(0)
|
||||
} else {
|
||||
state = UNAVAILABLE
|
||||
updateUI(UNAVAILABLE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerParallelDrivingListenerManager.removeListener(TAG)
|
||||
CallerParallelDrivingActionsListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
interface ClickEventListener {
|
||||
fun onReqClick()
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -26,6 +27,8 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import kotlinx.android.synthetic.main.view_system_version.view.*
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
|
||||
|
||||
/**
|
||||
@@ -63,6 +66,7 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
private fun initView() {
|
||||
showCurrentPadVersion()
|
||||
showCurrentAdVersion()
|
||||
updateAdHdMapVersion()
|
||||
|
||||
//鹰眼版本视图点击事件
|
||||
ivPadVersion.setOnClickListener {
|
||||
@@ -366,4 +370,42 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
location = gnssInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态查询应答
|
||||
* @param status 数据
|
||||
* HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
*/
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {
|
||||
if(status.hdMapVer!= null && status.hdMapVer.isNotEmpty()){
|
||||
AppConfigInfo.adHdMapVersion = status.hdMapVer
|
||||
updateAdHdMapVersion()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 定频SSM接口
|
||||
* 1hz hq m1 MAP350开始支持,其他车型MAP360开始支持
|
||||
* 定频SSM接入后 onStatusQueryResp 状态查询应答接口将弃用
|
||||
* @param statusInf 数据
|
||||
*/
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {
|
||||
if(statusInf.hdMapVer!= null && statusInf.hdMapVer.isNotEmpty()){
|
||||
AppConfigInfo.adHdMapVersion = statusInf.hdMapVer
|
||||
updateAdHdMapVersion()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工控机高精地图版本
|
||||
*/
|
||||
private fun updateAdHdMapVersion(){
|
||||
if(tvAdHdMapVersionContent.text.isNullOrEmpty() && AppConfigInfo.adHdMapVersion.isNotEmpty() || tvAdHdMapVersionContent.text != AppConfigInfo.adHdMapVersion){
|
||||
ThreadUtils.runOnUiThread {
|
||||
tvAdHdMapVersionContent.text = AppConfigInfo.adHdMapVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 27 KiB |
@@ -18,7 +18,7 @@
|
||||
android:id="@+id/ivBadCaseImage"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
android:src="@drawable/icon_bad_case"
|
||||
android:src="@drawable/icon_msg_bad_case"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/parDriveLayout"
|
||||
android:layout_width="361dp"
|
||||
android:layout_height="180dp"
|
||||
android:background="@drawable/bg_auto_pilot"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivStatusIcon"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="58dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginTop="56dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAutopilotContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginEnd="72dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="36dp"
|
||||
tools:text="远程代驾"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -12,10 +12,10 @@
|
||||
android:layout_marginStart="113dp"
|
||||
android:src="@drawable/icon_version_pad"
|
||||
android:layout_marginTop="40dp"
|
||||
android:clickable="true"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:contentDescription="@string/current_system_version"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@@ -62,6 +62,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="405dp"
|
||||
android:src="@drawable/icon_version_ad_normal"
|
||||
android:contentDescription="@string/current_system_version"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.CircularProgressView
|
||||
@@ -108,10 +109,8 @@
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvAdVersionTitle"
|
||||
app:layout_constraintRight_toRightOf="@id/tvAdVersionTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAdVersionTitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="#FFA7B6F0"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:textSize="32dp"
|
||||
/>
|
||||
|
||||
@@ -124,6 +123,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="680dp"
|
||||
android:src="@drawable/icon_version_hd_map"
|
||||
android:contentDescription="@string/current_system_version"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@@ -136,4 +136,44 @@
|
||||
app:layout_constraintCircleRadius="90dp"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<!--工控机HDMap版本-->
|
||||
<ImageView
|
||||
android:id="@+id/ivAdHdMapVersion"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ivPadVersion"
|
||||
app:layout_constraintRight_toRightOf="@id/ivPadVersion"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPadVersionContent"
|
||||
android:layout_marginTop="60dp"
|
||||
android:src="@drawable/icon_version_ad_hd_map"
|
||||
android:contentDescription="@string/current_system_version"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAdHdMapVersionTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ivAdHdMapVersion"
|
||||
app:layout_constraintRight_toRightOf="@id/ivAdHdMapVersion"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivAdHdMapVersion"
|
||||
android:text="@string/current_system_version"
|
||||
android:textColor="#FFA7B6F0"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="32dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAdHdMapVersionContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ivAdHdMapVersion"
|
||||
app:layout_constraintRight_toRightOf="@id/ivAdHdMapVersion"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAdHdMapVersionTitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="#FFA7B6F0"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textSize="32dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -86,4 +86,9 @@
|
||||
<string name="light_source_ai_cloud">云端下发</string>
|
||||
<string name="light_source_perception">自车感知</string>
|
||||
<string name="light_source_obu">\u2000OBU\u2000</string>
|
||||
<string name="parallel_drive">远程代驾</string>
|
||||
<string name="parallel_drive_requesting">请求中...</string>
|
||||
<string name="parallel_drive_synchronizing">同步中...</string>
|
||||
<string name="parallel_drive_failure">请求失败</string>
|
||||
<string name="parallel_drive_exception">异常</string>
|
||||
</resources>
|
||||
|
||||