diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/MainFragment.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/MainFragment.kt index 11096f4adb..3d81be6386 100644 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/MainFragment.kt +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/MainFragment.kt @@ -9,7 +9,6 @@ import com.amap.api.maps.model.LatLng import com.mogo.commons.AbsMogoApplication import com.mogo.commons.mvp.MvpFragment import com.mogo.eagle.core.data.config.HdMapBuildConfig -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController import com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView import com.mogo.eagle.core.function.view.SiteMarkerBean @@ -205,7 +204,6 @@ class MainFragment : override fun initViews(savedInstanceState: Bundle?) { super.initViews(savedInstanceState) mapBizView.onCreate(savedInstanceState) - getMapUIController()?.setAllGesturesEnabled(false) omvOverMap.onCreateView(savedInstanceState) } @@ -223,6 +221,9 @@ class MainFragment : super.onResume() mapBizView.onResume() omvOverMap.onResume() + UiThreadHandler.postDelayed({ + getMapUIController()?.setAllGesturesEnabled(false) + },200) } override fun onSaveInstanceState(outState: Bundle) { diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockAndUnlockView.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockAndUnlockView.kt new file mode 100644 index 0000000000..3a7d6b7612 --- /dev/null +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockAndUnlockView.kt @@ -0,0 +1,175 @@ +package com.mogo.och.bus.passenger.ui.lockview + +import android.content.Context +import android.os.Handler +import android.os.Looper +import android.os.Message +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.och.bus.passenger.R +import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer +import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock +import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock_bg +import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_unlock_ani + +class LockAndUnlockView : ConstraintLayout, LockManager.LockStatusCallback { + + constructor(context: Context) : super(context) + + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super( + context, + attributeSet, + defStyleAttr + ) + + val TAG = "UnLockView" + + private var animations: AnimationsContainer? = null + private var downType: DownType = DownType.NONE + + private var handler: Handler?=null + + private fun initView() { + LayoutInflater.from(context).inflate(R.layout.m1_devices_lock_unlock, this, true) + handler = object : Handler(Looper.myLooper()!!) { + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + when (msg.what) { + 2 -> {// 解锁 + LockManager.setLock(LockManager.LockStatus.UNLOCK) + animations?.stop() + } + else -> {} + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + LockManager.setAutoStatusCallback(TAG, this) + aciv_screen_unlock_ani?.let { + animations = AnimationsContainer(R.array.openlock, 24, it) + animations!!.setOnAnimStopListener(object : + AnimationsContainer.OnAnimationStoppedListener { + override fun AnimationStopped() { + it.setImageDrawable(null) + } + }) + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + LockManager.setAutoStatusCallback(TAG, null) + } + + override fun onTouchEvent(event: MotionEvent?): Boolean { + when (event?.action) { + MotionEvent.ACTION_DOWN -> { + if (LockManager.getLockStatus()==LockManager.LockStatus.LOCKED) { + downType = DownType.LOCK + LockManager.setLock(LockManager.LockStatus.UNLOCKING) + handler?.sendEmptyMessageDelayed(2,1_000) + } else { + downType = DownType.UNLOCK + } + CallerLogger.d(TAG, "ACTION_DOWN") + } + + MotionEvent.ACTION_MOVE -> {} + MotionEvent.ACTION_UP -> { + if (downType == DownType.LOCK) { + handler?.let { + if (it.hasMessages(2)) { + it.removeMessages(2) + LockManager.setLock(LockManager.LockStatus.LOCKED) + } + } + } else { + if (LockManager.getLockStatus()==LockManager.LockStatus.UNLOCK) { + CallerLogger.d(TAG, "onClick") + LockManager.setLock(LockManager.LockStatus.LOCKED) + } + } + CallerLogger.d(TAG, "ACTION_UP") + } + + MotionEvent.ACTION_CANCEL -> { + handler?.let { + if (it.hasMessages(2)) { + it.removeMessages(2) + LockManager.setLock(LockManager.LockStatus.LOCKED) + } + } + CallerLogger.d(TAG, "ACTION_CANCEL") + } + + else -> {} + } + return true + } + + enum class DownType { + NONE, LOCK, UNLOCK + } + + override fun lockStatusChange(isLock: LockManager.LockStatus) { + setImageStatus(LockManager.getStatusViewVisable(),isLock) + } + + override fun statusViewvisableChange(statusView: Int) { + setImageStatus(statusView,LockManager.getLockStatus()) + } + + private fun setImageStatus(statusView: Int,lockStatus: LockManager.LockStatus){ + when (statusView) { + View.GONE -> { + when (lockStatus) { + LockManager.LockStatus.LOCKED -> { + aciv_screen_lock.setImageResource(R.drawable.charter_p_lock_normal) + } + LockManager.LockStatus.UNLOCK -> { + aciv_screen_lock.setImageResource(R.drawable.charter_p_unlock) + } + } + aciv_screen_lock_bg?.setImageResource(R.drawable.charger_p_normal) + } + View.VISIBLE -> { + when (lockStatus) { + LockManager.LockStatus.LOCKED -> { + aciv_screen_lock.setImageResource(R.drawable.charter_p_lock) + aciv_screen_lock_bg?.setImageResource(R.drawable.charter_p_lock_bg) + animations?.stop() + } + LockManager.LockStatus.UNLOCKING -> { + aciv_screen_lock.setImageResource(R.drawable.charter_p_lock) + aciv_screen_lock_bg?.setImageDrawable(null) + animations?.reStart() + } + LockManager.LockStatus.UNLOCK -> { + aciv_screen_lock.setImageResource(R.drawable.charter_p_unlock) + aciv_screen_lock_bg?.setImageResource(R.drawable.charger_p_normal) + animations?.stop() + } + } + } + else -> {} + } + } + + + init { + try { + initView() + } catch (e: Exception) { + e.printStackTrace() + } + } +} \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockManager.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockManager.kt index b87b227900..a9a1a7d7ea 100644 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockManager.kt +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockManager.kt @@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger.ui.lockview import android.os.Handler import android.os.HandlerThread import android.os.Message +import android.view.View import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import java.util.concurrent.ConcurrentHashMap @@ -10,7 +11,10 @@ import java.util.concurrent.ConcurrentHashMap object LockManager { @Volatile - private var isLock:Boolean = false + private var lockStatus:LockStatus = LockStatus.UNLOCK + + private var statusView:Int = View.GONE + private var handler:Handler?=null private const val TAG = "LockManager" @@ -24,7 +28,7 @@ object LockManager { override fun handleMessage(msg: Message) { super.handleMessage(msg) CallerLogger.d(SceneConstant.M_BUS_P + TAG, "2分钟没有触摸屏幕导致锁屏") - setLock(true) + setLock(LockStatus.LOCKED) } } reStartCountDown() @@ -46,26 +50,48 @@ object LockManager { fun reStartCountDown(){ + CallerLogger.d(TAG,"重置时间") handler?.removeMessages(1) handler?.sendEmptyMessageDelayed(1,120_000) } @Synchronized - fun isLocak():Boolean{ - CallerLogger.d(TAG,"锁定状态:${isLock}") - return isLock + fun getLockStatus():LockStatus{ + CallerLogger.d(TAG,"锁定状态:${lockStatus}") + return lockStatus } @Synchronized - fun setLock(isLock: Boolean){ - if(this.isLock!=isLock){ - this.isLock = isLock + fun setLock(isLock: LockStatus){ + if(this.lockStatus!=isLock){ + this.lockStatus = isLock mLockChnageListener.forEach { - it.value.lockStatusChange(this.isLock) + it.value.lockStatusChange(this.lockStatus) + } + } + } + + fun getStatusViewVisable():Int{ + return statusView + } + + fun setStatusView(visable:Int){ + if(this.statusView!=visable){ + this.statusView = visable + mLockChnageListener.forEach { + it.value.statusViewvisableChange(this.statusView) } } } interface LockStatusCallback { - fun lockStatusChange(isLock: Boolean) + fun lockStatusChange(isLock: LockStatus) + + fun statusViewvisableChange(statusView:Int){} + } + + enum class LockStatus{ + LOCKED, + UNLOCKING, + UNLOCK } } \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockViewConstrainLayout.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockViewConstrainLayout.kt index 2d1865a42e..bbb57cd9f8 100644 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockViewConstrainLayout.kt +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/LockViewConstrainLayout.kt @@ -3,6 +3,8 @@ package com.mogo.och.bus.passenger.ui.lockview import android.content.Context import android.util.AttributeSet import android.view.MotionEvent +import android.view.View +import androidx.appcompat.widget.AppCompatImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.och.bus.passenger.R @@ -21,7 +23,9 @@ class LockViewConstrainLayout : ConstraintLayout { defStyleAttr ) - private var acivScreenLock:UnLockView?=null + private var acivScreenLock: AppCompatImageView?=null + private var uvOnlyUnlock:AppCompatImageView?=null + private var uv_only_unlock:UnlockView?=null override fun onAttachedToWindow() { super.onAttachedToWindow() @@ -37,30 +41,35 @@ class LockViewConstrainLayout : ConstraintLayout { if (acivScreenLock == null) { acivScreenLock = findViewById(R.id.aciv_screen_lock) } + if (uvOnlyUnlock == null) { + uvOnlyUnlock = findViewById(R.id.aciv_only_unlock) + } + if (uv_only_unlock == null) { + uv_only_unlock = findViewById(R.id.uv_only_unlock) + } LockManager.reStartCountDown() var needInterceptTouch = true - acivScreenLock?.apply { - event?.let { - val location = IntArray(2) - getLocationInWindow(location) - CallerLogger.d("LockViewConstrainLayout", "${location[0]}---${location[1]}--${location[0]+width}---${location[1]+height}---${it.rawX}----${it.rawY}") - val mleft = location[0] - val mtop = location[1] - val mright = location[0]+width - val mbottom = location[1]+height - if (it.rawX > mleft && it.rawX < mright && it.rawY > mtop && it.rawY < mbottom) { - // 不拦截 - needInterceptTouch = false - CallerLogger.d("LockViewConstrainLayout", "不拦截") + event?.let { + var need1 = true + uv_only_unlock?.let { parentImage-> + if(parentImage.visibility!=View.GONE){ + need1 = needIntercept(it,uvOnlyUnlock) } } + val need2 = needIntercept(it,acivScreenLock) + if(!need1||!need2){ + needInterceptTouch = false + } } + + CallerLogger.d("LockViewConstrainLayout", "是否拦截 ${needInterceptTouch}") return if(needInterceptTouch) { - if(LockManager.isLocak()){ - + if(LockManager.getLockStatus()==LockManager.LockStatus.LOCKED){ + LockManager.setStatusView(View.VISIBLE) + uv_only_unlock?.visibility = View.VISIBLE true }else{ super.onInterceptTouchEvent(event) @@ -70,5 +79,27 @@ class LockViewConstrainLayout : ConstraintLayout { } } + private fun needIntercept(event: MotionEvent,view: View?):Boolean { + view?.apply { + val location = IntArray(2) + getLocationInWindow(location) + CallerLogger.d( + "LockViewConstrainLayout", + "${location[0]}---${location[1]}--${location[0] + width}---${location[1] + height}---${event.rawX}----${event.rawY}" + ) + val mleft = location[0] + val mtop = location[1] + val mright = location[0] + width + val mbottom = location[1] + height + if (event.rawX > mleft && event.rawX < mright && event.rawY > mtop && event.rawY < mbottom) { + CallerLogger.d("LockViewConstrainLayout", "不拦截") + // 不拦截 + return false + } + } + return true + } + + } \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/UnLockView.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/UnLockView.kt deleted file mode 100644 index be7d30d297..0000000000 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/UnLockView.kt +++ /dev/null @@ -1,106 +0,0 @@ -package com.mogo.och.bus.passenger.ui.lockview - -import android.content.Context -import android.util.AttributeSet -import android.view.MotionEvent -import android.view.ViewGroup -import android.widget.ImageView -import androidx.appcompat.widget.AppCompatImageView -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.och.bus.passenger.R -import com.mogo.och.common.module.utils.RxUtils -import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer -import io.reactivex.disposables.Disposable - -class UnLockView : AppCompatImageView, LockManager.LockStatusCallback { - - constructor(context: Context) : super(context) - - constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) - - constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super( - context, - attributeSet, - defStyleAttr - ) - - val TAG = "UnLockView" - - private var animations: AnimationsContainer?=null - private var aciv_screen_unlock_ani: ImageView?=null - private var unLockDelay: Disposable? = null - private var downType:DownType = DownType.NONE - - override fun dispatchTouchEvent(event: MotionEvent?): Boolean { - return super.dispatchTouchEvent(event) - } - - override fun onAttachedToWindow() { - super.onAttachedToWindow() - if (parent is ViewGroup) { - aciv_screen_unlock_ani = (parent as ViewGroup).findViewById(R.id.aciv_screen_unlock_ani) - aciv_screen_unlock_ani?.let { - animations = AnimationsContainer(R.array.openlock,12,it) - animations!!.setOnAnimStopListener(object :AnimationsContainer.OnAnimationStoppedListener{ - override fun AnimationStopped() { - it.setImageDrawable(null) - } - }) - } - } - LockManager.setAutoStatusCallback(TAG,this) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - when (event?.action) { - MotionEvent.ACTION_DOWN -> { - if(LockManager.isLocak()){ - downType = DownType.LOCK - animations?.reStart() - RxUtils.disposeSubscribe(unLockDelay) - unLockDelay = RxUtils.createSubscribe { - LockManager.setLock(false) - animations?.stop() - } - }else{ - downType = DownType.UNLOCK - } - CallerLogger.d(TAG,"ACTION_DOWN") - } - MotionEvent.ACTION_MOVE -> {} - MotionEvent.ACTION_UP -> { - if(downType==DownType.LOCK) { - RxUtils.disposeSubscribe(unLockDelay) - animations?.stop() - }else{ - if (!LockManager.isLocak()) { - CallerLogger.d(TAG,"onClick") - LockManager.setLock(true) - } - } - CallerLogger.d(TAG,"ACTION_UP") - } - - MotionEvent.ACTION_CANCEL -> { - RxUtils.disposeSubscribe(unLockDelay) - animations?.stop() - CallerLogger.d(TAG,"ACTION_CANCEL") - } - - else -> {} - } - return true - } - - enum class DownType{ - NONE,LOCK,UNLOCK - } - - override fun lockStatusChange(isLock: Boolean) { - if(isLock){ - setImageResource(R.drawable.charter_p_lock) - }else{ - setImageResource(R.drawable.charter_p_unlock) - } - } -} \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/UnlockView.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/UnlockView.kt new file mode 100644 index 0000000000..81bc154694 --- /dev/null +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/bus/passenger/ui/lockview/UnlockView.kt @@ -0,0 +1,149 @@ +package com.mogo.och.bus.passenger.ui.lockview + +import android.content.Context +import android.os.Handler +import android.os.Looper +import android.os.Message +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.och.bus.passenger.R +import kotlinx.android.synthetic.main.m1_devices_unlock.view.aciv_only_unlock +import kotlinx.android.synthetic.main.m1_devices_unlock.view.actv_lock_status + +class UnlockView : ConstraintLayout, LockManager.LockStatusCallback { + + private val TAG = "UnlockView" + + constructor(context: Context) : super(context) + + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super( + context, + attributeSet, + defStyleAttr + ) + + private var handler: Handler?=null + + private fun initView() { + LayoutInflater.from(context).inflate(R.layout.m1_devices_unlock, this, true) + handler = object : Handler(Looper.myLooper()!!) { + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + when (msg.what) { + 1 -> {// 时间到隐藏view + visibility = View.GONE + } + 2 -> {// 解锁 + LockManager.setLock(LockManager.LockStatus.UNLOCK) + sendEmptyMessageDelayed(1, 2_000) + } + else -> {} + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + LockManager.setAutoStatusCallback(TAG,this) + } + + override fun setVisibility(visibility: Int) { + super.setVisibility(visibility) + LockManager.setStatusView(visibility) + when (visibility) { + View.VISIBLE -> { + CallerLogger.d(TAG,"VISIBLE") + handler?.removeMessages(1) + handler?.sendEmptyMessageDelayed(1,2_000) + } + View.GONE -> { + handler?.removeMessages(1) + CallerLogger.d(TAG,"GONE") + } + View.INVISIBLE -> { + CallerLogger.d(TAG,"INVISIBLE") + } + else -> {} + } + } + + override fun onTouchEvent(event: MotionEvent?): Boolean { + if(LockManager.getLockStatus()!=LockManager.LockStatus.UNLOCK) { + when (event?.action) { + MotionEvent.ACTION_DOWN -> { + handler?.removeMessages(1) + handler?.sendEmptyMessageDelayed(2, 1_000) + LockManager.setLock(LockManager.LockStatus.UNLOCKING) + CallerLogger.d(TAG, "ACTION_DOWN") + } + + MotionEvent.ACTION_MOVE -> {} + MotionEvent.ACTION_UP -> { + handler?.let { + if (it.hasMessages(2)) { + it.removeMessages(2) + LockManager.setLock(LockManager.LockStatus.LOCKED) + handler?.sendEmptyMessageDelayed(1, 2_000) + } + } + CallerLogger.d(TAG, "ACTION_UP") + } + + MotionEvent.ACTION_CANCEL -> { + handler?.let { + if (it.hasMessages(2)) { + it.removeMessages(2) + LockManager.setLock(LockManager.LockStatus.LOCKED) + handler?.sendEmptyMessageDelayed(1, 2_000) + } + } + CallerLogger.d(TAG, "ACTION_CANCEL") + } + + else -> {} + } + } + return true + } + + init { + try { + initView() + } catch (e: Exception) { + e.printStackTrace() + } + } + + override fun lockStatusChange(isLock: LockManager.LockStatus) { + UiThreadHandler.post { + visibility = View.VISIBLE + when (isLock) { + LockManager.LockStatus.LOCKED -> { + // 锁定 + actv_lock_status.text = "长按开锁键1秒,快速解锁" + aciv_only_unlock.setImageResource(R.drawable.charter_p_only_lock) + } + LockManager.LockStatus.UNLOCKING -> { + // 开锁中 + actv_lock_status.text = "开锁中.." + aciv_only_unlock.setImageResource(R.drawable.charter_p_only_unlocking) + } + LockManager.LockStatus.UNLOCK -> { + // 解锁成功 + actv_lock_status.text = "已解锁" + aciv_only_unlock.setImageResource(R.drawable.charter_p_only_unlock) + } + } + } + } + + +} \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/res/drawable-nodpi/charger_p_normal.png b/OCH/charter/passenger/src/main/res/drawable-nodpi/charger_p_normal.png new file mode 100644 index 0000000000..32f2764954 Binary files /dev/null and b/OCH/charter/passenger/src/main/res/drawable-nodpi/charger_p_normal.png differ diff --git a/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_arrow_lock.png b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_arrow_lock.png new file mode 100644 index 0000000000..15a0728979 Binary files /dev/null and b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_arrow_lock.png differ diff --git a/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_lock_normal.png b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_lock_normal.png new file mode 100644 index 0000000000..040084139a Binary files /dev/null and b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_lock_normal.png differ diff --git a/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_lock.png b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_lock.png new file mode 100644 index 0000000000..2dfae68c3b Binary files /dev/null and b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_lock.png differ diff --git a/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_unlock.png b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_unlock.png new file mode 100644 index 0000000000..ae7d535fdf Binary files /dev/null and b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_unlock.png differ diff --git a/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_unlocking.png b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_unlocking.png new file mode 100644 index 0000000000..acfec92788 Binary files /dev/null and b/OCH/charter/passenger/src/main/res/drawable-nodpi/charter_p_only_unlocking.png differ diff --git a/OCH/charter/passenger/src/main/res/drawable/charter_p_only_unlock_bg.xml b/OCH/charter/passenger/src/main/res/drawable/charter_p_only_unlock_bg.xml new file mode 100644 index 0000000000..6a3414b1b9 --- /dev/null +++ b/OCH/charter/passenger/src/main/res/drawable/charter_p_only_unlock_bg.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/res/layout/m1_devices_lock_unlock.xml b/OCH/charter/passenger/src/main/res/layout/m1_devices_lock_unlock.xml new file mode 100644 index 0000000000..e93bed67c9 --- /dev/null +++ b/OCH/charter/passenger/src/main/res/layout/m1_devices_lock_unlock.xml @@ -0,0 +1,39 @@ + + + + + + + + + \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/res/layout/m1_devices_unlock.xml b/OCH/charter/passenger/src/main/res/layout/m1_devices_unlock.xml new file mode 100644 index 0000000000..0797cda389 --- /dev/null +++ b/OCH/charter/passenger/src/main/res/layout/m1_devices_unlock.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/res/layout/m1_main_fragment.xml b/OCH/charter/passenger/src/main/res/layout/m1_main_fragment.xml index ad454095d7..34c8d162de 100644 --- a/OCH/charter/passenger/src/main/res/layout/m1_main_fragment.xml +++ b/OCH/charter/passenger/src/main/res/layout/m1_main_fragment.xml @@ -36,38 +36,11 @@ android:id="@+id/aciv_map_2_default" android:layout_width="@dimen/dp_148" android:layout_height="@dimen/dp_150" + android:layout_marginBottom="-15dp" android:src="@drawable/bus_p_overmap_reset" app:layout_constraintBottom_toTopOf="@+id/bb_boorombar" app:layout_constraintEnd_toEndOf="parent" /> - - - - - - + + + + + \ No newline at end of file diff --git a/OCH/charter/passenger/src/main/res/values/color.xml b/OCH/charter/passenger/src/main/res/values/color.xml index ca22013238..c0a5c39c1e 100644 --- a/OCH/charter/passenger/src/main/res/values/color.xml +++ b/OCH/charter/passenger/src/main/res/values/color.xml @@ -51,4 +51,5 @@ #CCFFFFFF #80FFFFFF #F0E0EFFF + #66000000 \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.kt b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.kt index f8138e6112..52325b172e 100644 --- a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.kt +++ b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.kt @@ -74,6 +74,7 @@ import com.mogo.och.common.module.utils.PinYinUtil import mogo.telematics.pad.MessagePad import mogo.telematics.pad.MessagePad.ArrivalNotification import mogo.telematics.pad.MessagePad.GlobalPathResp +import system_master.SsmInfo import system_master.SystemStatusInfo import java.util.concurrent.ConcurrentHashMap @@ -514,6 +515,8 @@ object BusPassengerModel{ } override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {} + + override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {} } private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener = object : IMoGoPlanningRottingListener { diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java index 34209e95b3..998ae0d68b 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java @@ -39,6 +39,7 @@ import java.util.List; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -248,6 +249,11 @@ public class BusPresenter extends Presenter public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) { } + + @Override + public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) { + } + @Override public void loginSuccess(DriverStatusQueryRespBean data) { CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin()); diff --git a/OCH/mogo-och-shuttle/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java b/OCH/mogo-och-shuttle/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java index 1d0c948311..de2a58d256 100644 --- a/OCH/mogo-och-shuttle/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java +++ b/OCH/mogo-och-shuttle/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java @@ -42,6 +42,7 @@ import java.util.List; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -260,6 +261,11 @@ public class BusPresenter extends Presenter public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) { } + + @Override + public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) { + } + @Override public void loginSuccess(DriverStatusQueryRespBean data) { CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin()); diff --git a/OCH/sweeper/sweeper-cloud/src/main/java/com/mogo/och/sweepercloud/model/SweeperTaskModel.java b/OCH/sweeper/sweeper-cloud/src/main/java/com/mogo/och/sweepercloud/model/SweeperTaskModel.java index 349be74b75..49e6b7b34e 100644 --- a/OCH/sweeper/sweeper-cloud/src/main/java/com/mogo/och/sweepercloud/model/SweeperTaskModel.java +++ b/OCH/sweeper/sweeper-cloud/src/main/java/com/mogo/och/sweepercloud/model/SweeperTaskModel.java @@ -63,6 +63,7 @@ import io.reactivex.plugins.RxJavaPlugins; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; import planning.RoboSweeperTaskIndexOuterClass; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -642,6 +643,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM // CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusRespByQuery status:" + status.getSysState().getNumber()); } + @Override + public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) { + } + + @Override public void onAutopilotRouteLineId(long lineId) { diff --git a/OCH/sweeper/sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java b/OCH/sweeper/sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java index 7e18efb729..288a79755b 100644 --- a/OCH/sweeper/sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java +++ b/OCH/sweeper/sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java @@ -52,6 +52,7 @@ import chassis.ChassisStatesOuterClass; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; import planning.RoboSweeperTaskIndexOuterClass; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -229,6 +230,10 @@ public class SweeperPresenter extends Presenter } + @Override + public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) { + } + @Override public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) { SweeperTaskModel.getInstance().onArriveTaskEnd(arrivalNotification); diff --git a/OCH/taxi/mogo-och-taxi-unmanned/src/main/java/com/mogo/och/taxi/model/TaxiModel.kt b/OCH/taxi/mogo-och-taxi-unmanned/src/main/java/com/mogo/och/taxi/model/TaxiModel.kt index 34b2381c4f..677bf682bb 100644 --- a/OCH/taxi/mogo-och-taxi-unmanned/src/main/java/com/mogo/och/taxi/model/TaxiModel.kt +++ b/OCH/taxi/mogo-och-taxi-unmanned/src/main/java/com/mogo/och/taxi/model/TaxiModel.kt @@ -89,6 +89,7 @@ import mogo.telematics.pad.MessagePad import mogo.telematics.pad.MessagePad.ArrivalNotification import mogo.telematics.pad.MessagePad.GlobalPathResp import mogo_msg.MogoReportMsg.MogoReportMessage +import system_master.SsmInfo import system_master.SystemStatusInfo import java.io.IOException @@ -860,6 +861,8 @@ object TaxiModel { } override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {} + + override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {} } private fun arriveTerminal() { diff --git a/OCH/taxi/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java b/OCH/taxi/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java index a8f1bb625a..17673e2d3b 100644 --- a/OCH/taxi/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java +++ b/OCH/taxi/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java @@ -98,6 +98,7 @@ import io.reactivex.functions.Consumer; import io.reactivex.plugins.RxJavaPlugins; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -1297,6 +1298,9 @@ public class TaxiModel { @Override public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) { } + @Override + public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) { + } }; private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener() { diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/bean/TaxiPassengerStartReqBean.java b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/bean/TaxiPassengerStartReqBean.java index fe2a0d2b59..86ef45ca09 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/bean/TaxiPassengerStartReqBean.java +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/bean/TaxiPassengerStartReqBean.java @@ -8,13 +8,12 @@ public class TaxiPassengerStartReqBean { public String orderNo; public String sn; - public Double gcjLat; - public Double gcjLon; - public TaxiPassengerStartReqBean(String sn, String orderNo, Double gcjLat, Double gcjLon) { + public Long lineId; + + public TaxiPassengerStartReqBean(String sn, String orderNo, Long lineId) { this.sn = sn; this.orderNo = orderNo; - this.gcjLat = gcjLat; - this.gcjLon = gcjLon; + this.lineId = lineId; } } diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt index 52fb785058..2c679a3be0 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt @@ -19,6 +19,7 @@ class TaxiPassengerConst { // 埋点key:接管后点击'自动驾驶'按钮启动 const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_taxi_restart_autopilot" + // 埋点key:开始服务开启自动驾驶(成功/失败) const val EVENT_KEY_START_SERVICE = "event_key_och_taxi_start_service" const val EVENT_PARAM_SN = "sn" @@ -34,6 +35,11 @@ class TaxiPassengerConst { // 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾 const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_taxi_ap_unable_start_reason" - const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason"; + const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason" + + //任务类型 + const val TaskType_VIRTUAL = 1 // 虚拟任务 + const val TaskType_DRIVE_TO_START = 2 // 接驾任务 + const val TaskType_DRIVE_TO_END = 3 //送驾任务 } } \ No newline at end of file diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt index 541df1a3d7..d719e36932 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt @@ -188,11 +188,10 @@ object AutopilotManager : IMoGoAutopilotStatusListener { */ private fun startAutoPilotServiceByPassenger() { if (TaxiPassengerModel.currentOCHOrder == null) return - val currentLocation = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02() + //val currentLocation = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02() TaxiPassengerServiceManager.startAutoPilotServiceByPassenger( TaxiPassengerModel.currentOCHOrder!!.orderNo, - currentLocation.latitude, - currentLocation.longitude, + TaxiPassengerModel.currentLineId, object : OchCommonServiceCallback { override fun onSuccess(data: TaxiPassengerBaseRespBean) { VoiceNotice.showNotice("坐稳扶好,我们出发咯!", AIAssist.LEVEL2) diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt index 2484310e0e..16af968b61 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt @@ -33,6 +33,7 @@ import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst +import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst.Companion.TaskType_DRIVE_TO_END import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum.Companion.valueOf import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager @@ -158,6 +159,11 @@ object TaxiPassengerModel { } return } + //目前后端将一个订单拆分成了多个任务,乘客屏只关心 送驾 类型的任务,这里过滤其他任务避免干扰 + if (data.data.taskType != TaskType_DRIVE_TO_END) { + d(M_TAXI_P + TAG, "queryInAndWaitOrders data.taskType=${data.data.taskType}, discard data") + return + } //1. 处理进行中订单 if (data.data != null && data.data.order != null) { // 1.1. 当存在进行中单时:对本地currentOrder进行更新 diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceApi.kt b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceApi.kt index 2b4764eca9..1dae935590 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceApi.kt +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceApi.kt @@ -81,7 +81,7 @@ internal interface TaxiPassengerServiceApi { * @return */ @Headers("Content-type:application/json;charset=UTF-8") - @POST("/och-taxi-cabin/api/flow/v1/startService") + @POST("/och-taxi-cabin/api/flow/v1/startTask") fun startAutoPilotServiceByPassenger( @Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId, @Header("ticket") ticket: String= MoGoAiCloudClientConfig.getInstance().token, diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceManager.kt b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceManager.kt index bad03776c5..c2b640385f 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceManager.kt +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/network/TaxiPassengerServiceManager.kt @@ -110,15 +110,14 @@ object TaxiPassengerServiceManager { @JvmStatic fun startAutoPilotServiceByPassenger( orderNo: String?, - gcjLat: Double?, - gcjLon: Double?, + lineId: Long?, callback: OchCommonServiceCallback? ) { if (beforeNet()) { return } mOCHTaxiServiceApi.startAutoPilotServiceByPassenger( - data = TaxiPassengerStartReqBean(driverSn, orderNo, gcjLat, gcjLon) + data = TaxiPassengerStartReqBean(driverSn, orderNo, lineId) ) .transformTry() .retry(3) diff --git a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/check/ChekViewModel.kt b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/check/ChekViewModel.kt index 110eb8a90f..8ec10a1f1b 100644 --- a/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/check/ChekViewModel.kt +++ b/OCH/taxi/taxi-unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/check/ChekViewModel.kt @@ -27,8 +27,8 @@ class ChekViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallback { private fun setOrderInfo() { val currentOCHOrder = TaxiPassengerModel.currentOCHOrder currentOCHOrder?.let { order -> - viewCallback?.setOrderInfo(order.orderStartSite.siteName, - order.orderEndSite.siteName, "${order.passengerSize}", order.bookingUserPhone) + viewCallback?.setOrderInfo(order.orderStartSite?.siteName, + order.orderEndSite?.siteName, "${order.passengerSize}", order.bookingUserPhone) } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index 30d22b1487..4f7ff6105a 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -30,6 +30,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeSystemStatus import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotDockerInfo import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility @@ -75,6 +76,7 @@ import perception.TrafficLightOuterClass import planning.RoboSweeperTaskIndexOuterClass import prediction.Prediction import record_cache.RecordPanelOuterClass +import system_master.SsmInfo import system_master.SystemStatusInfo /** @@ -438,6 +440,10 @@ class MoGoAdasListenerImpl : OnAdasListener { invokeAutopilotStatusRespByQuery(statusInfo) } + override fun onSystemStatus(header: MessagePad.Header?, statusInf: SsmInfo.SsmStatusInf?) { + invokeSystemStatus(statusInf) + } + /** * 数据采集配置应答 */ diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt index d1e903d5a3..ceff1aad76 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt @@ -38,6 +38,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : init { CallerCloudListenerManager.addListener(TAG, this) + CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) } override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt index 01044b7daa..e6b92611d7 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt @@ -13,6 +13,7 @@ import com.zhjt.mogo_core_function_devatools.status.flow.IFlow import kotlinx.coroutines.Job import mogo_msg.MogoReportMsg.MogoReportMessage import planning.RoboSweeperTaskIndexOuterClass +import system_master.SsmInfo import system_master.SystemStatusInfo.StatusInfo import java.util.concurrent.atomic.AtomicInteger @@ -115,6 +116,14 @@ internal class CanImpl(ctx: Context) : } } + override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) { + val state = statusInf.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal + Log.d(TAG, "state: $state") + if (state != null) { + this.state.set(state) + } + } + override fun onDestroy() { super.onDestroy() job?.safeCancel() diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt index 20c8b349f9..a25e636ae8 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt @@ -16,7 +16,8 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import system_master.SystemStatusInfo.HealthInfo +import system_master.SsmInfo +import system_master.SsmBase.HealthInfo import system_master.SystemStatusInfo.StatusInfo import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicReference @@ -72,6 +73,17 @@ internal class RTKImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotStatu } } + override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) { + check?.takeIf { it.isActive }?.cancel() + isOldVersion.set(false) + val info = statusInf.healthInfoList?.find { "localization".equals(it.name, true) } + Log.d(TAG, "info: $info") + if (info != null) { + healthInfo.set(info) + send(RTKStatus(getDesc(), getCode())) + } + } + override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) { super.onAutopilotIpcConnectStatusChanged(status, reason) if (!CallerAutoPilotControlManager.isConnected()) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java index fdb750665e..f4f3a42934 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; +import system_master.SsmInfo; import system_master.SystemStatusInfo; public class MogoRouteOverlayManager implements @@ -134,6 +135,10 @@ public class MogoRouteOverlayManager implements public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) { } + @Override + public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) { + } + @Override public void onAutopilotRouteLineId(long lineId) { diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt index abf75fd255..d70810e024 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt @@ -61,6 +61,12 @@ interface IMoGoAutopilotStatusListener { */ fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {} + /** + * 定频SSM + * 老版本 SSM(SystemStatusInfo.StatusInfo) HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + */ + fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {} + /** * 自动驾驶路线ID回调 */ diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index 2e2df750e4..c6eae4c451 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -7,6 +7,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.GsonUtils import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg +import system_master.SsmInfo import system_master.SystemStatusInfo import kotlin.properties.Delegates @@ -207,6 +208,19 @@ object CallerAutoPilotStatusListenerManager : CallerBase + val listener = itx.value + listener.onSystemStatus(it) + } + } + } + /** * 更新自动驾驶控制参数,结束自动驾驶时候需要更新为null,且更新时候同时触发onAutopilotStatusResponse回调 */ diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt index bb494b549e..d2cd6305fe 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt @@ -1,8 +1,6 @@ package com.mogo.eagle.core.function.call.autopilot -import android.util.Log import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isConnected import com.mogo.eagle.core.function.call.base.CallerBase import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason @@ -17,10 +15,9 @@ object CallerAutopilotActionsListenerManager : CallerBase? = null init { -// isConnected = isConnected() //TODO 重复初始 isAutopilotAbility = false unableAutopilotReasons = disconnectedReason() - printLog("初始化") +// printLog("初始化") } private fun disconnectedReason(): ArrayList { @@ -50,7 +47,7 @@ object CallerAutopilotActionsListenerManager : CallerBase old.sortWith(compareBy(UnableAutopilotReason::hashCode)); isEquals = onw.toTypedArray() contentEquals old.toTypedArray() - Log.i( - "ddd", - "都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}" - ) +// Log.i( +// "ddd", +// "都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}" +// ) } } } else isEquals = !(unableAutopilotReasons != null || this.unableAutopilotReasons != null) - Log.i( - "ddd", - " 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}" - ) +// Log.i( +// "ddd", +// " 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}" +// ) if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) { this.isAutopilotAbility = isAutopilotAbility this.unableAutopilotReasons = unableAutopilotReasons notification() - printLog("更新数据") +// printLog("更新数据") } } } @@ -94,10 +91,10 @@ object CallerAutopilotActionsListenerManager : CallerBase=350开始走定频SSM,其他车型360开始 + if ((config.getMapVersion() >= 30500 && (config.getIsJinlvM1() || config.getIsHQ())) || config.getMapVersion() >= 30600) { + return false; + } + } MessagePad.StatusQueryReq req = MessagePad.StatusQueryReq .newBuilder() .build(); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java index c156d93f18..3bf97a5cce 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java @@ -578,6 +578,7 @@ public class AdasManager implements IAdasNetCommApi { * * @return boolean */ + @Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 @Override public boolean sendStatusQueryReq() { return mChannel != null && mChannel.sendStatusQueryReq(); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java index 625d02081a..588a32918c 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java @@ -266,6 +266,7 @@ public interface IAdasNetCommApi { * * @return 加入WS发送消息队列是否成功 */ + @Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 boolean sendStatusQueryReq(); /** diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index bbdcaeb515..67f070b4c2 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -20,7 +20,6 @@ import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus; import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop; import java.util.ArrayList; -import java.util.List; import bag_manager.BagManagerOuterClass; import chassis.ChassisStatesOuterClass; @@ -34,6 +33,7 @@ import perception.TrafficLightOuterClass; import planning.RoboSweeperTaskIndexOuterClass; import prediction.Prediction; import record_cache.RecordPanelOuterClass; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -197,8 +197,19 @@ public interface OnAdasListener { * @param header 头 * @param statusInfo 数据 */ + @Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo); + /** + * 定频SSM接口 + * 1hz hq m1 MAP350开始支持,其他车型MAP360开始支持 + * 定频SSM接入后 onStatusQueryResp 状态查询应答接口将弃用 + * + * @param header 头 + * @param statusInf 数据 + */ + void onSystemStatus(MessagePad.Header header, SsmInfo.SsmStatusInf statusInf); + /** * 数据采集配置应答 * diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java index 8b3d310d69..08428bb6f8 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java @@ -30,6 +30,7 @@ public enum MessageType { TYPE_RECEIVE_FUNCTION_STATES(MessagePad.MessageType.MsgTypeFunctionStates, "重构后功能状态"), TYPE_RECEIVE_BACK_CAMERA_VIDEO(MessagePad.MessageType.MsgTypeBackCameraVideo, "后摄像头"), TYPE_RECEIVE_M1_STITCHED_VIDEO(MessagePad.MessageType.MsgTypeM1StitchedVideo, "M1拼接视频"), + TYPE_RECEIVE_SSM(MessagePad.MessageType.MsgTypeSSMState, "SSM系统状态"), TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"), TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"), diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java index e7c6801119..36202fca78 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java @@ -53,7 +53,7 @@ public class AutopilotAbility230 { Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition(); if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) { isAutopilotAbility = false; - unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "当前档位无法启动自驾"); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常"); } } //TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java index 7dc31cb07f..42ac6a90d9 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java @@ -79,17 +79,14 @@ public class AutopilotAbility250 { SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList(); if (nodeFaultList.getSum() > 0) { List list = nodeFaultList.getNodeList(); - StringBuilder builder = new StringBuilder(); for (SystemStatusInfo.NodeInfo info : list) { - builder.append(info.getNodeName()); + String nodeName = info.getNodeName(); int state = info.getState(); if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) { - builder.append(AutopilotAbilityManager.NODE_INFO_STATE[state]); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]); } else { - builder.append("未知异常 "); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常"); } - unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, builder.toString()); - builder.setLength(0); } } else { unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点"); @@ -144,7 +141,7 @@ public class AutopilotAbility250 { Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition(); if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) { isAutopilotAbility = false; - unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "当前档位无法启动自驾"); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常"); } } //TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java index 1dbcdeb4b9..a11254d0da 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility330.java @@ -82,17 +82,14 @@ public class AutopilotAbility330 { SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList(); if (nodeFaultList.getSum() > 0) { List list = nodeFaultList.getNodeList(); - StringBuilder builder = new StringBuilder(); for (SystemStatusInfo.NodeInfo info : list) { - builder.append(info.getNodeName()); + String nodeName = info.getNodeName(); int state = info.getState(); if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) { - builder.append(AutopilotAbilityManager.NODE_INFO_STATE[state]); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]); } else { - builder.append("未知异常 "); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常"); } - unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, builder.toString()); - builder.setLength(0); } } else { unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点"); @@ -145,7 +142,7 @@ public class AutopilotAbility330 { } } if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) { - unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM未给出原因"); + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常"); } } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java new file mode 100644 index 0000000000..0b94ccc7b7 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility350And360.java @@ -0,0 +1,147 @@ +package com.zhidao.support.adas.high.common.autopilot.ability; + +import androidx.annotation.Nullable; + +import com.zhidao.support.adas.high.AdasManager; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason; + +import java.util.ArrayList; + +import chassis.Chassis; +import chassis.ChassisStatesOuterClass; +import system_master.SsmInfo; + +/** + * 是否可以启动自动驾驶能力检测 工控机版本>=350&&(isHQ||isJinlvM1) || 工控机版本>=360&&!isFutianSweeper 使用此类 + * 目前监控了定频SSM的数据和FSM状态原因查询 + * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 + *

+ */ +public class AutopilotAbility350And360 { + private static final String TAG = AutopilotAbility250.class.getSimpleName(); + private ChassisStatesOuterClass.ChassisStates chassisStates; + private int masterVersion = -1;//Master版本 + private OnAutopilotAbilityListener listener; + + protected interface OnAutopilotAbilityListener { + void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList unableAutopilotReasons); + + } + + protected AutopilotAbility350And360() { + this.masterVersion = -1; + } + + + protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) { + + onCallback(statusInfo); + } + + protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) { + this.chassisStates = chassisStates; + } + + private void onCallback(SsmInfo.SsmStatusInf statusInfo) { + boolean isAutopilotAbility = true;//是否能启动自动驾驶 + ArrayList unableAutopilotReasons = null;//不能启动自动驾驶原因 + //检测节点状态相关 + if (statusInfo != null) { + if (masterVersion == -1 && statusInfo.hasMasterVersion()) { + //截取Master Version + masterVersion = AdasManager.getInstance().parseVersion(false, statusInfo.getMasterVersion()); + } + CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion); + //SSM 3版本兼容 + if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { + isAutopilotAbility = statusInfo.getAutoPilotReady(); + if (!isAutopilotAbility) { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason()); + } + } else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 + isAutopilotAbility = statusInfo.getAutoPilotReady(); + if (!isAutopilotAbility) { + int count = statusInfo.getAutoPilotUnreadyListCount(); + if (count > 0) { + for (int i = 0; i < count; i++) { + SsmInfo.NodeInf info = statusInfo.getAutoPilotUnreadyList(i); + String nodeName = info.getNodeName(); + int state = info.getState().getNumber(); + if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]); + } else { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常"); + } + } + } else { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点"); + } + } + } else { + SsmInfo.ModeState modeState = statusInfo.getModeState(); + if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) { + isAutopilotAbility = false; + String unableAutopilotReason = null; + if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) { + unableAutopilotReason = "系统处于停止模式(未就绪)"; + } else if (modeState == SsmInfo.ModeState.MODE_STOP_READY) { + unableAutopilotReason = "系统处于停止模式"; + } else if (modeState == SsmInfo.ModeState.MODE_IDLE_UNREADY) { + unableAutopilotReason = "系统处于空闲模式(未就绪)"; + } else if (modeState == SsmInfo.ModeState.MODE_IDLE_READY) { + unableAutopilotReason = "系统处于空闲模式"; + } else { + unableAutopilotReason = "未知系统模式"; + } + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason); + } + } + } else { + isAutopilotAbility = false;//是否能启动自动驾驶 + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM数据异常"); + } + //检测底盘相关 + if (chassisStates != null) { + if (chassisStates.hasBrakeSystemStates()) { + float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition(); + if (brake > 0) { + isAutopilotAbility = false; + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "制动踏板被踩下"); + } + } + if (chassisStates.hasGearSystemStates()) { + Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition(); + if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) { + isAutopilotAbility = false; + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常"); + } + } + //TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段 + +// //电子驻车制动系统 +// if (chassisStates.hasEpbSystemStates()) { +// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates(); +// if (epb.hasEpbEnableState()){ +// epb.getEpbWorkState(); +// } +// } + + } + if (listener != null) { + listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons); + } + } + + protected void start(OnAutopilotAbilityListener listener) { + this.listener = listener; + } + + protected void stop() { + this.chassisStates = null; + this.masterVersion = -1; + this.listener = null; + } + + +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java new file mode 100644 index 0000000000..37ea146528 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility360.java @@ -0,0 +1,134 @@ +package com.zhidao.support.adas.high.common.autopilot.ability; + +import android.text.TextUtils; + +import androidx.annotation.Nullable; + +import com.zhidao.support.adas.high.AdasManager; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason; + +import java.util.ArrayList; + +import function_state_management.FSMStatusReasonQueryOuterClass; +import system_master.SsmInfo; + +/** + * 是否可以启动自动驾驶能力检测 工控机版本>=360&&isFutianSweeper 使用此类 + * TODO 目前只用于清扫车,其他车型需要MAP支持 FSM的相关功能 + * 目前监控了定频SSM的数据和FSM状态原因查询 + * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 + */ +public class AutopilotAbility360 { + private static final String TAG = AutopilotAbility360.class.getSimpleName(); + + private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因 + private int masterVersion = -1;//Master版本 + private OnAutopilotAbilityListener listener; + + protected interface OnAutopilotAbilityListener { + void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList unableAutopilotReasons); + + + } + + protected AutopilotAbility360() { + this.masterVersion = -1; + } + + protected synchronized void setFsmStatusReasonRespond(FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) { + this.fsmStatusReasonRespond = fsmStatusReasonRespond; + } + + protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) { + onCallback(statusInfo); + } + + + private void onCallback(SsmInfo.SsmStatusInf statusInfo) { + boolean isAutopilotAbility = true;//是否能启动自动驾驶 + ArrayList unableAutopilotReasons = null;//不能启动自动驾驶原因 + //检测节点状态相关 + if (statusInfo != null) { + if (masterVersion == -1 && statusInfo.hasMasterVersion()) { + //截取Master Version + masterVersion = AdasManager.getInstance().parseVersion(false, statusInfo.getMasterVersion()); + } + CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion); + //SSM 3版本兼容 + if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { + isAutopilotAbility = statusInfo.getAutoPilotReady(); + if (!isAutopilotAbility) { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason()); + } + } else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 + isAutopilotAbility = statusInfo.getAutoPilotReady(); + if (!isAutopilotAbility) { + int count = statusInfo.getAutoPilotUnreadyListCount(); + if (count > 0) { + for (int i = 0; i < count; i++) { + SsmInfo.NodeInf info = statusInfo.getAutoPilotUnreadyList(i); + String nodeName = info.getNodeName(); + int state = info.getState().getNumber(); + if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]); + } else { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常"); + } + } + } else { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点"); + } + } + } else { + SsmInfo.ModeState modeState = statusInfo.getModeState(); + if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) { + isAutopilotAbility = false; + String unableAutopilotReason = null; + if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) { + unableAutopilotReason = "系统处于停止模式(未就绪)"; + } else if (modeState == SsmInfo.ModeState.MODE_STOP_READY) { + unableAutopilotReason = "系统处于停止模式"; + } else if (modeState == SsmInfo.ModeState.MODE_IDLE_UNREADY) { + unableAutopilotReason = "系统处于空闲模式(未就绪)"; + } else if (modeState == SsmInfo.ModeState.MODE_IDLE_READY) { + unableAutopilotReason = "系统处于空闲模式"; + } else { + unableAutopilotReason = "未知系统模式"; + } + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason); + } + } + } else { + isAutopilotAbility = false;//是否能启动自动驾驶 + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM数据异常"); + } + if (fsmStatusReasonRespond != null) { + int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount(); + if (count > 0) { + isAutopilotAbility = false; + for (int i = 0; i < count; i++) { + String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i); + if (!TextUtils.isEmpty(respond)) { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.FSM, respond); + } + } + if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) { + unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常"); + } + } + } + if (listener != null) { + listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons); + } + } + + protected void start(OnAutopilotAbilityListener listener) { + this.listener = listener; + } + + protected void stop() { + this.masterVersion = -1; + this.listener = null; + } +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java index 14e567760e..08b2f45622 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java @@ -2,6 +2,7 @@ package com.zhidao.support.adas.high.common.autopilot.ability; import android.os.Handler; import android.os.Message; +import android.util.Log; import androidx.annotation.Nullable; @@ -20,6 +21,7 @@ import chassis.Chassis; import chassis.ChassisStatesOuterClass; import function_state_management.FSMStatusReasonQueryOuterClass; import mogo.telematics.pad.MessagePad; +import system_master.SsmInfo; import system_master.SystemStatusInfo; /** @@ -29,21 +31,26 @@ import system_master.SystemStatusInfo; *

* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态 */ -public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotAbilityListener, AutopilotAbility250.OnAutopilotAbilityListener, AutopilotAbility330.OnAutopilotAbilityListener { +public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotAbilityListener, AutopilotAbility250.OnAutopilotAbilityListener, AutopilotAbility330.OnAutopilotAbilityListener, AutopilotAbility350And360.OnAutopilotAbilityListener, AutopilotAbility360.OnAutopilotAbilityListener { private static final String TAG = AutopilotAbilityManager.class.getSimpleName(); protected static final int WHAT_TIMEOUT = 0; protected static final int DEFAULT_TIMEOUT = 2500; protected static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测周期 - protected static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "}; + protected static final String[] NODE_INFO_STATE = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "人为启动状态", "人为关闭状态"}; + protected static final String[] NODE_INFO_STATE_FIXED_FREQUENCY = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "非自动启动状态", "非自动关闭状态"}; private static volatile AutopilotAbilityManager INSTANCE; private OnAdasListener listener; private Handler handler; private OnAutopilotAbilityListener onAutopilotAbilityListener; private int mapVersion = -1;//工控机版本 private boolean isFutianSweeper = false;//是否是福田清扫车 + private boolean isJinlvM1 = false;//是否是M1 + private boolean isHQ = false;//是否是HQ private AutopilotAbility230 autopilotAbility230; private AutopilotAbility250 autopilotAbility250; private AutopilotAbility330 autopilotAbility330; + private AutopilotAbility350And360 autopilotAbility350And360; + private AutopilotAbility360 autopilotAbility360; private Timer startTimer; /** * 不能启动自动驾驶的档位 @@ -106,6 +113,8 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA public void setCarConfig(MessagePad.CarConfigResp carConfig) { mapVersion = carConfig.getMapVersion(); isFutianSweeper = carConfig.getIsFutianSweeper(); + isJinlvM1 = carConfig.getIsJinlvM1(); + isHQ = carConfig.getIsHQ(); if (mapVersion != -1) { stopTimer(); CupidLogUtils.i(TAG, "工控机版本=" + mapVersion); @@ -171,6 +180,15 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA } } + public void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) { + if (autopilotAbility350And360 != null) { + autopilotAbility350And360.setStatusInfo(statusInfo); + } + if (autopilotAbility360 != null) { + autopilotAbility360.setStatusInfo(statusInfo); + } + } + /** * 底盘状态更新 * @@ -183,6 +201,9 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA if (autopilotAbility250 != null) { autopilotAbility250.setChassisStates(chassisStates); } + if (autopilotAbility350And360 != null) { + autopilotAbility350And360.setChassisStates(chassisStates); + } } /** @@ -194,6 +215,9 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA if (autopilotAbility330 != null) { autopilotAbility330.setFsmStatusReasonRespond(fsmStatusReasonRespond); } + if (autopilotAbility360 != null) { + autopilotAbility360.setFsmStatusReasonRespond(fsmStatusReasonRespond); + } } public void onHandleMessage(Message msg) { @@ -208,27 +232,54 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA } private void initAutopilotAbility() { - //目前只有MAP330的清扫车用的新的FSM状态原因查询 - if (mapVersion >= 30300 && isFutianSweeper) { - CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用330版本"); + if (mapVersion >= 30600 && isFutianSweeper) { + Log.i(TAG, "能否启动自驾能力检测使用版本:360清扫车专用"); stop230(); stop250(); + stop330(); + stop350And360(); + if (autopilotAbility360 == null) { + autopilotAbility360 = new AutopilotAbility360(); + autopilotAbility360.start(this); + } + + } else if ((mapVersion >= 30500 && (isJinlvM1 || isHQ)) || mapVersion >= 30600) { + Log.i(TAG, "能否启动自驾能力检测使用版本:350和360共用"); + stop230(); + stop250(); + stop330(); + stop360(); + if (autopilotAbility350And360 == null) { + autopilotAbility350And360 = new AutopilotAbility350And360(); + autopilotAbility350And360.start(this); + } + + } else if (mapVersion >= 30300 && isFutianSweeper) {//目前只有MAP330的清扫车用的新的FSM状态原因查询 + Log.i(TAG, "能否启动自驾能力检测使用版本:330清扫车专用"); + stop230(); + stop250(); + stop350And360(); + stop360(); if (autopilotAbility330 == null) { autopilotAbility330 = new AutopilotAbility330(mapVersion); autopilotAbility330.start(this); } } else if (mapVersion >= 20500) { - CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用250版本"); + Log.i(TAG, "能否启动自驾能力检测使用版本:250"); stop230(); stop330(); + stop350And360(); + stop360(); if (autopilotAbility250 == null) { autopilotAbility250 = new AutopilotAbility250(mapVersion); autopilotAbility250.start(this); } } else { - CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用230版本"); + Log.i(TAG, "能否启动自驾能力检测使用版本:230"); stop250(); stop330(); + stop350And360(); + stop360(); if (autopilotAbility230 == null) { autopilotAbility230 = new AutopilotAbility230(); autopilotAbility230.start(this); @@ -258,6 +309,20 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA } } + private void stop350And360() { + if (autopilotAbility350And360 != null) { + autopilotAbility350And360.stop(); + autopilotAbility350And360 = null; + } + } + + private void stop360() { + if (autopilotAbility360 != null) { + autopilotAbility360.stop(); + autopilotAbility360 = null; + } + } + private void stopTimer() { if (startTimer != null) { startTimer.cancel(); @@ -280,7 +345,7 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA initAutopilotAbility(); } } - }, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步 + }, 8000L);//8秒原因:需要后去CarConfig 对象,两个地方调用initAutopilotAbility(); 初始化 一个在这,另一个在setCarConfig(),如果setCarConfig() 证明获取版本还未成功,获取版本会重试3次每次间隔两秒 } } @@ -290,9 +355,13 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA stop230(); stop250(); stop330(); + stop350And360(); + stop360(); handler = null; mapVersion = -1; isFutianSweeper = false; + isHQ = false; + isJinlvM1 = false; } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java index 796296c390..c3195b3de7 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java @@ -30,6 +30,7 @@ public class MyMessageFactory implements IMyMessageFactory { private IMsg warnMessage;//预警数据 private IMsg arrivalNotificationMessage;//到站提醒 private IMsg statusQueryRespMessage;//状态查询应答 + private IMsg systemStatusMessage;//定频SSM private IMsg recordDataConfigRespMessage;//数据采集配置应答 private IMsg planningDecisionStateMessage;//planning决策状态 private IMsg obuWarningDataMessage;//工控机透传OBU V2I数据 @@ -161,6 +162,12 @@ public class MyMessageFactory implements IMyMessageFactory { statusQueryRespMessage = new StatusQueryRespMessage(); } return statusQueryRespMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_SSM.typeCode) { + //定频SSM + if (systemStatusMessage == null) { + systemStatusMessage = new SystemStatusMessage(); + } + return systemStatusMessage; } else if (messageType == MessageType.TYPE_RECEIVE_RECORD_DATA_CONFIG_RESP.typeCode) { //数据采集配置应答 if (recordDataConfigRespMessage == null) { diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java index 2d37f3ced7..987f41b13e 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java @@ -14,6 +14,7 @@ import system_master.SystemStatusInfo; /** * 状态查询应答 */ +@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 public class StatusQueryRespMessage extends MyAbstractMessageHandler { @Override diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/SystemStatusMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/SystemStatusMessage.java new file mode 100644 index 0000000000..863ad996d5 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/SystemStatusMessage.java @@ -0,0 +1,33 @@ +package com.zhidao.support.adas.high.msg; + +import android.os.SystemClock; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.zhidao.support.adas.high.AdasChannel; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; +import com.zhidao.support.adas.high.protocol.RawData; + +import system_master.SsmInfo; + +/** + * 定频SSM 接口 + */ +public class SystemStatusMessage extends MyAbstractMessageHandler { + + @Override + public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { + SsmInfo.SsmStatusInf statusInfo = SsmInfo.SsmStatusInf.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); + AdasChannel.calculateTimeConsumingOnDispatchRaw("定频SSM", raw.receiveTime); + AutopilotAbilityManager.getInstance().setStatusInfo(statusInfo); + long nowTime = 0; + if (CupidLogUtils.isEnableLog()) + nowTime = SystemClock.elapsedRealtime(); + if (adasListener != null) { + adasListener.onSystemStatus(raw.getHeader(), statusInfo); + } + AdasChannel.calculateTimeConsumingBusiness("定频SSM", nowTime); + } + +}