[fea]
[taxi]
[ota 升级]
This commit is contained in:
yangyakun
2024-12-31 17:16:02 +08:00
parent 2b536b04d5
commit f436374079
11 changed files with 151 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
package com.mogo.och.bridge.ota
/**
* OTA升级接口
*/
interface IOchOTAListener {
/**
* OTA是否处于升级状态
* @param status true 处于升级状态 false 未处于升级状态
*/
fun onOtaDownloadStatus(status: Boolean){}
}

View File

@@ -0,0 +1,28 @@
package com.mogo.och.bridge.ota
import com.mogo.eagle.core.function.api.devatools.IOTAListener
import com.mogo.eagle.core.function.call.devatools.CallerOTAManager
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.common.module.biz.order.OrderManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.utils.CallerBase
object OTAManager : IOTAListener, CallerBase<IOchOTAListener>() {
private const val TAG = M_OCHCOMMON+"OTAManager"
init {
CallerOTAManager.addListener(TAG,this)
}
/**
* @param status true 处于升级状态 false 未处于升级状态
*/
override fun onOtaDownloadStatus(status: Boolean) {
OrderManager.otaDownLoadStatus = status
}
fun load() {
OchChainLogManager.writeChainLogInit("初始化信息","ota升级监控")
}
}

View File

@@ -32,6 +32,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ActivityUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.common.module.biz.order.OrderManager
import com.mogo.och.common.module.debug.location.MogoLocationExit
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.scnner.ScannerManager
@@ -66,6 +67,7 @@ object DebugDataDispatch {
const val romal = "romal"
const val visualView = "visual"
const val scanner = "scanner"
const val ota = "ota"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
@@ -81,6 +83,7 @@ object DebugDataDispatch {
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "visual" --ei show 0
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "showDebugView"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "scanner" --es qrInfo ""
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "ota" --ei "ota" 1
val ROOT_PATH =
@@ -93,6 +96,16 @@ object DebugDataDispatch {
}
when (type) {
ota -> {
val ota = intent.getIntExtra("ota",0)
BizLoopManager.runInIoThread{
if(ota>0){
OrderManager.otaDownLoadStatus = true
}else{
OrderManager.otaDownLoadStatus = false
}
}
}
scanner -> {
val qrInfo = intent.getStringExtra("qrInfo")
BizLoopManager.runInIoThread{

View File

@@ -0,0 +1,13 @@
package com.mogo.och.common.module.biz.order
/**
* OTA升级接口
*/
interface IOrderListener {
/**
* 是否需要立刻停止订单
*/
fun shoudleStopOrderImm(){}
}

View File

@@ -0,0 +1,39 @@
package com.mogo.och.common.module.biz.order
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.utils.CallerBase
import kotlin.properties.Delegates
object OrderManager : CallerBase<IOrderListener>() {
private const val TAG = M_OCHCOMMON+"OrderManager"
/**
* true 处于升级状态 false 未处于升级状态
*/
var otaDownLoadStatus: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
if (oldValue != newValue) {
d(TAG, "autopilotFlag old=$oldValue new=$newValue")
OchChainLogManager.writeChainLog(
"ota状态",
"ota状态发生变化;oldValue:${oldValue}----newValue:${newValue}"
)
if(newValue) {// 正在升级状态
M_LISTENERS.forEach {
it.value.shoudleStopOrderImm()
}
}
}
}
/**
* @return true 可以开始接单 false 不能进行接单
*/
fun canStartOrder(): Boolean {
return (!otaDownLoadStatus).apply {
if (otaDownLoadStatus) {// ota正在升级
// todo 可进行统一提示
}
}
}
}

View File

@@ -41,4 +41,7 @@
<string name="common_dialog_goback">返回</string>
<string name="common_start_task_after_upload_success">请等待升级完成后再选择任务</string>
</resources>

View File

@@ -7,6 +7,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.och.bridge.device.checkvin.CheckVinManager
import com.mogo.och.bridge.ota.OTAManager
import com.mogo.och.common.module.biz.lansocket.LoginLanDriverSocket
import com.mogo.och.common.module.biz.login.LoginStatusEnum
import com.mogo.och.common.module.biz.login.LoginStatusManager
@@ -41,6 +42,7 @@ class FacadeDriverProvider : FacadeProvider() {
LoginLanDriverSocket.load()
CheckVinManager.load()
OfflineManager.load()
OTAManager.load()
}
}

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.och.OchInfo
import com.mogo.eagle.core.data.v2x.Point
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.network.utils.digest.DigestUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OFFLINE
@@ -92,6 +93,7 @@ object LineModel {
fun release() {
d(TAG, "release")
mContext = null
currentTask = null
isRequesting.set(false)
mBusLinesCallbackMap.clear()
RxUtils.disposeSubscribe(queryCarInfo)
@@ -440,7 +442,9 @@ object LineModel {
ochInfo.siteMarkerList = mutableListOf()
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("地图", "站点信息:${ochInfo}")
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
} else {
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
val siteList = mutableListOf<SiteMarkerBean>()
var temp: SiteMarkerBean? = null
stationList?.let {

View File

@@ -164,7 +164,7 @@ object OrderModel {
override fun onError(e: Throwable) {
e.printStackTrace()
d(TAG, "queryBusRoutes onError${e.printStackTrace()}")
d(TAG, "queryBusRoutes onError ${e.printStackTrace()}")
e.printStackTrace()
LineModel.haveNoRunningTask()
d(TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
@@ -443,6 +443,10 @@ object OrderModel {
// }
MapMakerManager.removeAllMapMarkerByOwner(TAG)
OffLineTrajectoryManager.stopTrajReqLoop()
LineModel.release()
LineManager.setLineInfo(null)
LineManager.setContraiInfo(null)
LineManager.setStartAndEndStation(null,null)
FunctionBuildConfig.isOffLine = false
LoginStatusManager.loginOut()
}

View File

@@ -9,7 +9,9 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.DiffUtil.Callback
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.biz.order.OrderManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.weaknet.ui.switchtask.SwitchLineTaskAdapter.SwitchLineTaskViewHolder
import com.mogo.och.shuttle.weaknet.R
import com.mogo.och.weaknet.repository.db.bean.TaskDataBean
@@ -61,6 +63,10 @@ class SwitchLineTaskAdapter(
holder.taskTime.isChecked = task==checkTask
}
holder.taskTime.setOnClickListener {
if(!OrderManager.canStartOrder()){
ToastUtils.showShort(ResourcesUtils.getString(R.string.common_start_task_after_upload_success))
return@setOnClickListener
}
var preCheckIndex = -1
if(checkTask==null){
checkTask = task

View File

@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.api.unmanned.IUnmannedListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.function.call.unmanned.CallerUnmannedListenerManager
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
@@ -51,13 +52,17 @@ import com.mogo.och.common.module.manager.socket.cloud.action.OperateAction2
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations
import com.mogo.och.common.module.biz.order.IOrderListener
import com.mogo.och.common.module.biz.order.OrderManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.OCHThreadPoolManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.utils.RxUtils
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.LineInfo
import com.mogo.och.data.taxi.QueryCarOrderByNoRespBean
import com.mogo.och.unmanned.taxi.R
import com.mogo.och.unmanned.taxi.bean.PrepareTaskRespBean
import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean
import com.mogo.och.unmanned.taxi.bean.StartServiceRespBean
@@ -224,6 +229,7 @@ object TaxiTaskModel {
TrajectoryAndDistanceManager.addDistanceListener(TAG, localCalculateDistanceListener)
TrajectoryAndDistanceManager.addTrajectoryListener(TAG, localCalculateTrajectoryListener)
CallerUnmannedListenerManager.addListener(TAG, mMogoUnmanedVirtualTaskPullTaskIntervalListener)
OrderManager.addListener(TAG,orderListener)
}
private fun releaseListeners() {
@@ -237,6 +243,7 @@ object TaxiTaskModel {
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null)
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
CallerUnmannedListenerManager.removeListener(TAG)
OrderManager.removeListener(TAG)
}
/**
@@ -251,6 +258,16 @@ object TaxiTaskModel {
}
}
private val orderListener: IOrderListener =
object : IOrderListener {
override fun shoudleStopOrderImm() {
// 暂停接单
if(LoginStatusManager.isOpenOrderType()){
updateCarServingStatus()
}
}
}
private val mMogoUnmanedVirtualTaskPullTaskIntervalListener: IUnmannedListener =
object : IUnmannedListener {
override fun onVirtualTaskPullTaskIntervalUpdate(time: Int) {
@@ -741,6 +758,7 @@ object TaxiTaskModel {
clearCurrentOCHOrder()
clearLocalCalculateStation()
LineManager.setStartAndEndStation(null,null)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
return
}
@@ -754,6 +772,7 @@ object TaxiTaskModel {
}
if (result.startSite!=null && result.endSite!=null) {
LineManager.setStartAndEndStation(result.startSite!!.toCommonStation(),result.endSite!!.toCommonStation())
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
}
@@ -1141,6 +1160,10 @@ object TaxiTaskModel {
}
private fun startService(){
if (!OrderManager.canStartOrder()) {
ToastUtils.showShort(ResourcesUtils.getString(R.string.common_start_task_after_upload_success))
return
}
//暂停接单状态下,去接单
DebugView.printInfoMsg("[开始接单] 准备发送请求")
val gcJ02Location = OchLocationManager.getGCJ02Location()