Merge branch 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0' into 'dev_RoboBus_P_230220_1.0.1'

Dev robobus m1 p app module 1.0.0 230112 1.0.0

See merge request zhjt/AndroidApp/MoGoEagleEye!584
This commit is contained in:
wangmingjun
2023-02-21 13:19:39 +00:00
107 changed files with 1729 additions and 982 deletions

View File

@@ -15,7 +15,6 @@ import androidx.annotation.Nullable;
import com.amap.api.maps.model.LatLng;
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
@@ -35,6 +34,7 @@ import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.passenger.R;

View File

@@ -47,15 +47,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:day_light_mode="true"
android:layout_height="wrap_content"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"

View File

@@ -5,7 +5,6 @@ import android.content.Context
import android.net.ConnectivityManager
import android.os.Handler
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.intent.IMogoIntentListener
@@ -29,6 +28,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.R

View File

@@ -2,7 +2,6 @@ package com.mogo.och.bus.passenger.model
import android.content.Context
import android.os.Handler
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
@@ -19,6 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils

View File

@@ -100,7 +100,7 @@ class PM2VideoFragment :
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360154589/7.jpg",
1,
0,
"",
"7"
)

View File

@@ -59,12 +59,21 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
setViewShowState(mTopContainer, GONE)
setViewShowState(mLoadingProgressBar, GONE)
setViewShowState(mThumbImageViewLayout, GONE)
setViewShowState(mThumbImageView, GONE)
setViewShowState(
mLockScreen, GONE
)
setIsTouchWiget(false)
isFocusableInTouchMode = false
}
fun setCacheImageViewVisible() {
setViewShowState(mThumbImageViewLayout, VISIBLE)
setViewShowState(mThumbImageView, VISIBLE)
}
fun setCacheImageViewGone() {
setViewShowState(mThumbImageViewLayout, GONE)
setViewShowState(mThumbImageView, GONE)
}
}

View File

@@ -6,7 +6,6 @@ import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
/**
@@ -47,12 +46,12 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
if (viewList.size > 0) {
if (viewList[mViewPager.currentItem] is AdvanceVideoView) {//有人反应第一个是视频不播放这边优化了一下
Logger.d("onPageScrollStateChanged", "第一个是视频")
Logger.d(ImageAndVideoRotation.TAG, "第一个是视频")
val video = viewList[mViewPager.currentItem] as AdvanceVideoView
video.setVideo(gsySampleCallBack,mViewPager.currentItem)
video.setVideo(gsySampleCallBack)
} else if (viewList[mViewPager.currentItem] is AdvanceImageView) {
Logger.d("onPageScrollStateChanged", "startTimer()_1")
Logger.d(ImageAndVideoRotation.TAG, "startTimer()_1")
current = 0//换页重新计算时间
startTimer()
}
@@ -120,7 +119,7 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
// 由于viewpager的预加载机制onPageSelected这里面加载videoview 放的跟玩一样 等操作完成后再播放videoview就香了 很丝滑
if (state == 0) { //静止,什么都没做
val currentItem = mViewPager.currentItem
Logger.d("onPageScrollStateChanged",
Logger.d(ImageAndVideoRotation.TAG,
"state = $state currentItem = $currentItem lastPosition = $lastPosition")
if (viewList.size > 1) { //多于1才会循环跳转
@@ -128,11 +127,11 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
if (viewList[mViewPager.currentItem] is AdvanceVideoView) {
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
videoView.setCacheImageView()
videoView.setVideo(gsySampleCallBack,mViewPager.currentItem)
videoView.setCacheImageViewVisible()
videoView.setVideo(gsySampleCallBack)
} else if (viewList[mViewPager.currentItem] is AdvanceImageView) {
Logger.d("onPageScrollStateChanged", "startTimer()")
Logger.d(ImageAndVideoRotation.TAG, "startTimer()")
current = 0//换页重新计算时间
startTimer()
}
@@ -144,51 +143,55 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
private var gsySampleCallBack = object : GSYSampleCallBack() {
override fun onPrepared(url: String?, vararg objects: Any?) {
Logger.d("onPageScrollStateChanged", "onPrepared")
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
UiThreadHandler.postDelayed({
Logger.d("onPageScrollStateChanged", "cacheImg gone")
Logger.d(ImageAndVideoRotation.TAG, "onPrepared")
if (viewList[mViewPager.currentItem] is AdvanceVideoView){
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
videoView.setCacheImageViewGone()
},1000)
}
}
override fun onAutoComplete(url: String?, vararg objects: Any?) {
Logger.d("onPageScrollStateChanged", "onAutoComplete()")
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
videoView.onVideoReset()
videoView.setCacheImageView()
goNextItemView()
Logger.d(ImageAndVideoRotation.TAG, "onAutoComplete()")
if (viewList[mViewPager.currentItem] is AdvanceVideoView){
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
videoView.onVideoReset()
videoView.setCacheImageViewVisible()
goNextItemView()
}
}
override fun onPlayError(url: String?, vararg objects: Any?) {
super.onPlayError(url, *objects)
Logger.d("onPageScrollStateChanged", "onPlayError()")
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
videoView.onVideoReset()
videoView.setCacheImageView()
goNextItemView()
Logger.d(ImageAndVideoRotation.TAG, "onPlayError()-${objects}")
if (viewList[mViewPager.currentItem] is AdvanceVideoView){
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
videoView.onVideoReset()
videoView.setCacheImageViewVisible()
videoView.clearLocalErrorVideo()
goNextItemView()
}
}
}
private fun startTimer() {
if (null != thread && !thread?.isInterrupted!!) {
Logger.d("onPageScrollStateChanged", "thread.interrupt()")
Logger.d(ImageAndVideoRotation.TAG, "thread.interrupt()")
thread?.interrupt()
thread = null
}
thread = Thread {
while (null != thread && !thread?.isInterrupted!!) {
try {
Logger.d("onPageScrollStateChanged", "sleep")
Logger.d(ImageAndVideoRotation.TAG, "sleep")
Thread.sleep(1000)
if (viewList[mViewPager.currentItem] is AdvanceImageView) {
Logger.d("onPageScrollStateChanged", "增加1s")
Logger.d(ImageAndVideoRotation.TAG, "增加1s")
current += 1000
}else{
break
}
if (current >= time) {
Logger.d("onPageScrollStateChanged", "5s到跳转")
Logger.d(ImageAndVideoRotation.TAG, "5s到跳转")
goNextItemView()
current = 0
break

View File

@@ -7,12 +7,18 @@ import android.widget.ImageView
import android.widget.RelativeLayout
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.mogo.eagle.core.utilcode.breakpoint.Config
import com.mogo.eagle.core.utilcode.breakpoint.bean.ThreadBean
import com.mogo.eagle.core.utilcode.breakpoint.callback.IDownload
import com.mogo.eagle.core.utilcode.breakpoint.utils.DownloadUtils
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.BitmapHelper
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.bus.passenger.R
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import java.lang.Exception
/**
* @author: wangmingjun
@@ -26,7 +32,9 @@ class AdvanceVideoView @JvmOverloads constructor(
private var cacheImage: ImageView? = null
private var videoViewPlayer: AdvanceGSYVideoPlayer? = null
private var gsyVideoOptionBuilder: GSYVideoOptionBuilder? = null
private var path: String? = null
private var mOnCompletionListener: GSYSampleCallBack? = null
private var downloadVideoName = ""
private var fileNetPath: String? = ""
init {
initView()
@@ -40,7 +48,6 @@ class AdvanceVideoView @JvmOverloads constructor(
private fun initCacheImgView() {
cacheImage = ImageView(context)
cacheImage?.scaleType = ImageView.ScaleType.FIT_XY
addView(cacheImage, LayoutParams(-1, -1))
}
private fun initVideoView() {
@@ -63,14 +70,25 @@ class AdvanceVideoView @JvmOverloads constructor(
}
fun setVideoPath(path: String) {
this.path = path
// BitmapHelper.getVideoThumbnail(path) /*获取第一帧图*/
cacheImage?.visibility = VISIBLE
// https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v
// https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4
this.fileNetPath = path
val pathList = path.split("/")
if (pathList.isNotEmpty()){
this.downloadVideoName = pathList[pathList.size - 1]
}
loadCacheImg()
}
private fun loadCacheImg() {
// BitmapHelper.getVideoThumbnail(path) /*获取第一帧图*/
setCacheImageViewVisible()
Thread{
var bitmap = BitmapHelper.getVideoThumbnail(path)
Logger.d("onPageScrollStateChanged", "setVideoPath")
var bitmap = BitmapHelper.getVideoThumbnail(fileNetPath)
Logger.d(ImageAndVideoRotation.TAG, "setVideoPath")
ThreadUtils.runOnUiThread {
Logger.d("onPageScrollStateChanged", "bitmap加载")
Logger.d(ImageAndVideoRotation.TAG, "bitmap加载")
cacheImage?.let {
Glide.with(context).load(bitmap)
.apply(
@@ -78,35 +96,67 @@ class AdvanceVideoView @JvmOverloads constructor(
)
.into(it)
}
videoViewPlayer?.thumbImageView = cacheImage
}
}.start()
}
@SuppressLint("CheckResult")
fun setCacheImageView() {
cacheImage?.visibility = VISIBLE
fun clearLocalErrorVideo(){
if (downloadVideoName.isNotEmpty()
&& FileUtils.isFileExists(Config.downLoadPath + downloadVideoName)){
FileUtils.delete(Config.downLoadPath + downloadVideoName)
}
}
fun setVideo(onCompletionListener: GSYSampleCallBack,position: Int) {
Logger.d("onPageScrollStateChanged", "setVideoPlay")
gsyVideoOptionBuilder = GSYVideoOptionBuilder()
gsyVideoOptionBuilder?.setUrl(path)
?.setPlayTag(path + position)
?.setCacheWithPlay(false)
?.setThumbPlay(false)
?.build(videoViewPlayer)
@SuppressLint("CheckResult")
fun setCacheImageViewVisible() {
videoViewPlayer?.setCacheImageViewVisible()
}
videoViewPlayer?.isFocusableInTouchMode = false
videoViewPlayer?.setVideoAllCallBack(onCompletionListener)
videoViewPlayer?.startPlayLogic()
fun setCacheImageViewGone() {
videoViewPlayer?.setCacheImageViewGone()
}
fun setVideo(onCompletionListener: GSYSampleCallBack) {
Logger.d(ImageAndVideoRotation.TAG, "setVideo")
mOnCompletionListener = onCompletionListener
//判断是否已经下载
if (downloadVideoName.isNotEmpty()){
if (FileUtils.isFileExists(Config.downLoadPath + downloadVideoName)){
startPlay()
return
}
startDownLoadVideo()
}
}
private fun startDownLoadVideo(){
//下载视频, 下载成功后再播放
DownloadUtils.downLoad(context,fileNetPath, Config.downLoadPath
,downloadVideoName,5,downListener)
}
private fun startPlay(){
try {
Logger.d(ImageAndVideoRotation.TAG, "startPlay")
gsyVideoOptionBuilder = GSYVideoOptionBuilder()
gsyVideoOptionBuilder?.setUrl("file:///mnt/sdcard/downloads/$downloadVideoName")
?.setPlayTag(downloadVideoName)
?.setCacheWithPlay(false)
?.setThumbPlay(false)
?.build(videoViewPlayer)
videoViewPlayer?.isFocusableInTouchMode = false
videoViewPlayer?.setVideoAllCallBack(mOnCompletionListener)
videoViewPlayer?.startPlayLogic()
}catch (e: Exception){
Logger.d(ImageAndVideoRotation.TAG, "startPlay e = ${e.message}")
}
}
fun onVideoReset(){
videoViewPlayer?.onVideoReset()
}
fun setCacheImageViewGone() {
cacheImage?.visibility = INVISIBLE
mOnCompletionListener = null
}
fun setPause() {
@@ -120,4 +170,36 @@ class AdvanceVideoView @JvmOverloads constructor(
videoViewPlayer?.startPlayLogic()
}
}
private val downListener = object : IDownload{
override fun onStart(url: String?) {
Logger.d(ImageAndVideoRotation.TAG, "download-onStart")
}
override fun onPause(url: String?, threadBean: ThreadBean?) {
Logger.d(ImageAndVideoRotation.TAG, "download-onPause")
}
override fun onProgress(url: String?, length: Int) {
Logger.d(ImageAndVideoRotation.TAG, "download-onProgress")
}
override fun onFinished(url: String?, threadBean: ThreadBean?) {
Logger.d(ImageAndVideoRotation.TAG, "download-onFinished")
//下载完成
ThreadUtils.runOnUiThread {
startPlay()
}
}
override fun onError(url: String?, errorMsg: String?) {
Logger.d(ImageAndVideoRotation.TAG, "download-onError-$errorMsg")
//出错再次下载
if (errorMsg != null) {
if (errorMsg.startsWith("initFailed")){
startDownLoadVideo()
}
}
}
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.och.bus.passenger.ui.widget.video
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.viewpager.widget.ViewPager
/**
* @author: wangmingjun
* @date: 2023/2/21
*/
class AdvanceViewPager: ViewPager{
constructor(context: Context) : super(context)
constructor(context: Context,attrs: AttributeSet?) : super(context,attrs)
override fun onTouchEvent(ev: MotionEvent?): Boolean {
return false
}
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
return false
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.och.bus.passenger.ui.widget.video
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
@@ -12,15 +13,20 @@ class ImageAndVideoRotation @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : RelativeLayout(context, attrs) {
private var viewPager: ViewPager? = null
private var viewPager: AdvanceViewPager? = null
private var pagerAdapter: AdvancePagerAdapter? = null
companion object {
const val TAG = "ImageAndVideoRotation"
}
init {
initView()
}
@SuppressLint("ClickableViewAccessibility")
private fun initView() {
viewPager = ViewPager(context)
viewPager = AdvanceViewPager(context)
pagerAdapter = AdvancePagerAdapter(context, viewPager!!)
viewPager?.adapter = pagerAdapter

View File

@@ -16,7 +16,6 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.amap.api.maps.model.LatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
@@ -33,6 +32,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;

View File

@@ -50,14 +50,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"

View File

@@ -16,7 +16,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.amap.api.maps.model.LatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;

View File

@@ -10,7 +10,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListene
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
/**
* Created on 2022/10/9

View File

@@ -5,9 +5,9 @@ import android.location.Location;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.model.LatLng;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import java.util.ArrayList;
import java.util.HashMap;

View File

@@ -10,7 +10,6 @@ import androidx.annotation.Nullable;
import com.amap.api.maps.model.LatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
@@ -28,6 +27,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;

View File

@@ -37,14 +37,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"

View File

@@ -55,10 +55,10 @@ public class TaxiPassengerGeocodeSearchModel implements GeocodeSearch.OnGeocodeS
//通过经纬度逆地理编码得到位置
try {
mGeocodeSearch = new GeocodeSearch(mContext);
mGeocodeSearch.setOnGeocodeSearchListener(this);
} catch (AMapException e) {
e.printStackTrace();
}
mGeocodeSearch.setOnGeocodeSearchListener(this);
timer = new Timer();
timerTask = new TimerTask() {
@Override

View File

@@ -14,7 +14,6 @@ import com.amap.api.maps.model.LatLng;
import com.amap.api.navi.model.NaviLatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
@@ -41,6 +40,7 @@ import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManag
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;

View File

@@ -45,15 +45,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:day_light_mode="true"
android:layout_height="wrap_content"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"

View File

@@ -16,7 +16,6 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.amap.api.maps.model.LatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
@@ -36,6 +35,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;

View File

@@ -107,14 +107,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"

View File

@@ -14,7 +14,6 @@ repositories {
mogo-och 使用到的依赖
implementation "com.mogo.commons:mogo-utils:2.0.63"
implementation "com.mogo.commons:mogo-commons:2.0.63"
implementation "com.mogo.module:module-common:2.0.63"
implementation "com.mogo.eagle.core:data:0.0.6"
implementation "com.mogo.eagle.core.function:call:0.0.6"

View File

@@ -325,7 +325,6 @@ dependencies {
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_map
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_datacenter
implementation rootProject.ext.dependencies.mogo_core_function_devatools
implementation rootProject.ext.dependencies.mogo_core_function_chat

View File

@@ -104,7 +104,7 @@ object ConfigStartUp {
}
val mapParams = MapParams.init()
mapParams.setDebugMode(false) //todo 1-使用本地地图数据0-使用在线地图数据
mapParams.setDebugMode(false) // 1-使用本地地图数据0-使用在线地图数据
//.setDataFileSource(1)
.setDebugMode(false)
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)

View File

@@ -100,7 +100,7 @@ import com.zhidao.support.adas.high.AdasOptions;
import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.OnMultiDeviceListener;
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhidao.support.adas.high.common.ByteUtil;
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;

View File

@@ -45,7 +45,7 @@ import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.AdasOptions;
import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
import com.zhidao.support.adas.high.common.CupidLogUtils;

View File

@@ -125,10 +125,6 @@ ext {
mogocustommap : "com.zhidaoauto.machine:map:${MAP_SDK_VERSION}",
mogocustommapoperational : "com.zhidaoauto.map:operational:${MAP_SDK_OPERATION_VERSION}",
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
// V2X
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
// 基础服务实现
mogowebsocket : "com.mogo.module.carchatting:module-carchatt-socket:${WEBSOCKET_VERSION}",
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
@@ -169,8 +165,6 @@ ext {
mogo_core_function_devatools : "com.mogo.eagle.core.function.impl:devatools:${MOGO_CORE_FUNCTION_DEVATOOLS_VERSION}",
mogo_core_function_hmi : "com.mogo.eagle.core.function.impl:hmi:${MOGO_CORE_FUNCTION_HMI_VERSION}",
mogo_core_function_map : "com.mogo.eagle.core.function.impl:map:${MOGO_CORE_FUNCTION_MAP_VERSION}",
mogo_core_function_obu_mogo : "com.mogo.eagle.core.function.impl:obu-mogo:${MOGO_CORE_FUNCTION_OBU_MOGO_VERSION}",
mogo_core_function_v2x : "com.mogo.eagle.core.function.impl:v2x:${MOGO_CORE_FUNCTION_V2X_VERSION}",
mogo_core_function_api : "com.mogo.eagle.core.function:api:${MOGO_CORE_FUNCTION_API_VERSION}",
mogo_core_function_call : "com.mogo.eagle.core.function:call:${MOGO_CORE_FUNCTION_CALL_VERSION}",
mogo_core_data : "com.mogo.eagle.core:data:${MOGO_CORE_DATA_VERSION}",

View File

@@ -5,7 +5,6 @@ import android.os.Handler
import android.os.Message
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
@@ -21,6 +20,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_RESULT_AFFIRM
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_RESULT_MANUAL_CANCEL
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_RESULT_TIMER_CANCEL

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.function.biz.notice.network;
import android.util.ArrayMap;
import com.mogo.cloud.network.NetConstants;
import com.mogo.cloud.network.RetrofitFactory;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.commons.constants.HostConst;

View File

@@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
* 处理obu分发出来在消息盒子展示的消息
*/
object V2xObuEventManager : IMoGoObuSaveMessageListener {
private const val TAG = "V2xObuEventManager"
fun init(context: Context) {
@@ -33,7 +32,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
* @param content 事件内容
* @param tts 事件语音播报
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String) {
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
@@ -43,7 +42,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
tts
)
).apply {
sourceType = DataSourceType.OBU
sourceType = source
}
)
}

View File

@@ -20,6 +20,6 @@ public class V2XConst {
/**
* V2X预警日志tag
*/
public static final String LOG_NAME_WARN = "liyz";
public static final String LOG_NAME_WARN = "PersonWarn";
}

View File

@@ -6,7 +6,6 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -22,6 +21,7 @@ import com.mogo.eagle.function.biz.v2x.v2n.marker.V2XMarkerAdapter;
import com.mogo.eagle.function.biz.v2x.v2n.utils.MapUtils;
import com.mogo.eagle.core.data.v2x.V2XMarkerCardResult;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;

View File

@@ -3,10 +3,10 @@ package com.mogo.eagle.function.biz.v2x.v2n.remove
import android.os.Handler
import android.os.HandlerThread
import android.util.Log
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.map.marker.IMogoMarker
import com.mogo.map.overlay.IMogoPolyline

View File

@@ -6,7 +6,6 @@ import android.os.Handler
import android.os.Looper
import android.view.animation.DecelerateInterpolator
import androidx.core.util.Pair
import com.mogo.cloud.commons.utils.*
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.call.autopilot.*
@@ -22,6 +21,7 @@ import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.ConcurrentHashMap
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerRemoveManager
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerWrapper
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
/**
* Ai云道路施工事件道路颜色标记类

View File

@@ -4,7 +4,6 @@ import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_STO
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.utils.Trigonometric;
@@ -22,6 +21,7 @@ import com.mogo.eagle.core.data.v2x.V2XLocation;
import com.mogo.eagle.core.data.v2x.V2XWarningTarget;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.overlay.IMogoPolyline;

View File

@@ -55,7 +55,6 @@ dependencies {
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.datacenter.autopilot
import android.Manifest.permission
import android.content.Context
import android.util.Log
import androidx.annotation.RequiresPermission
import chassis.SpecialVehicleTaskCmdOuterClass
import com.alibaba.android.arouter.facade.annotation.Route
@@ -737,4 +736,37 @@ class MoGoAutopilotControlProvider :
MessageType.TYPE_RECEIVE_POINT_CLOUD)
}
}
override fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd)
}
override fun sendRoboBusJinlvM1AirConditionerCmd(
switchCmd: Int,
modeCmd: Int,
windSpeedCmd: Int,
temperatureCmd: Int
): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd)
}
override fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd)
}
override fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(switchCmd)
}
override fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(switchCmd)
}
override fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(switchCmd)
}
override fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd)
}
}

View File

@@ -59,7 +59,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.AutopilotStatistics
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import com.zhidao.support.adas.high.common.ProtocolStatus
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
@@ -173,7 +173,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
CallerChassisSteeringStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
//挂档位数据
//挂档位数据
CallerChassisGearStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
//加速度
CallerChassisAccStateListenerManager.invokeAutopilotAcc(vehicleState.accel)
@@ -237,7 +237,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
chassisStates.gearSystemStates?.let { gearSystemStates ->
gearSystemStates.gearPosition?.let {
//挂档位数据
//挂档位数据
CallerChassisGearStateListenerManager.invokeAutopilotGearData(it)
}
}

View File

@@ -1,26 +1,21 @@
package com.mogo.eagle.core.function.datacenter.location
import com.amap.api.location.AMapLocation
import com.amap.api.location.AMapLocationClient
import com.amap.api.location.AMapLocationClientOption
import com.amap.api.location.AMapLocationListener
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssListener
import com.mogo.eagle.core.function.api.map.listener.IGaoDeMapLocationListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerGaoDeMapLocationListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.support.obu.model.MogoObuHvBasicsData
import mogo.telematics.pad.MessagePad
/**
@@ -31,12 +26,11 @@ import mogo.telematics.pad.MessagePad
object MoGoLocationDispatcher :
IMoGoChassisGnssListener,
IMoGoObuLocationWGS84Listener,
AMapLocationListener {
IGaoDeMapLocationListener {
private const val TAG = "MoGoLocationManager"
private var mCityCode: String? = null
private var mapLocation: AMapLocation? = null
/**
* 最后一次工控机GNSS返回更新的位置
@@ -54,33 +48,10 @@ object MoGoLocationDispatcher :
private var lastGaoDeLocation: MogoLocation = MogoLocation()
fun initListener() {
// 高德SDK隐私政策
AMapLocationClient.updatePrivacyShow(Utils.getApp(), true, true)
AMapLocationClient.updatePrivacyAgree(Utils.getApp(), true)
try {
val mLocationClient = AMapLocationClient(Utils.getApp())
//初始化定位参数
//声明mLocationOption对象
val mLocationOption = AMapLocationClientOption()
//设置定位监听
mLocationClient.setLocationListener(this)
//设置定位模式为高精度模式Battery_Saving为低功耗模式Device_Sensors是仅设备模式
mLocationOption.locationMode = AMapLocationClientOption.AMapLocationMode.Hight_Accuracy
//设置定位间隔,单位毫秒,默认为2000ms
mLocationOption.interval = 1000
//设置定位参数
mLocationClient.setLocationOption(mLocationOption)
// 启动定位监听
mLocationClient.startLocation()
} catch (e: Exception) {
e.printStackTrace()
}
// 初始化监听订阅工控机位置信息
CallerChassisGnssListenerManager.addListener(TAG, this)
CallerObuLocationWGS84ListenerManager.addListener(TAG, this)
CallerGaoDeMapLocationListenerManager.addListener(TAG, this)
}
override fun onChassisGnss(gnssInfo: MessagePad.GnssInfo) {
@@ -88,13 +59,13 @@ object MoGoLocationDispatcher :
lastGnssLocation.gnssInfo = gnssInfo
lastGnssLocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let {
lastGaoDeLocation.let {
//agps 高德
//agps_rtk 高德-高精
lastGnssLocation.locType = 1000 // 定位类型为WGS84进行转译的坐标
lastGnssLocation.satellite = 4
lastGnssLocation.cityName = it.city
lastGnssLocation.cityName = it.cityName
lastGnssLocation.cityCode = it.cityCode
lastGnssLocation.provider = it.provider
lastGnssLocation.address = it.address
@@ -128,79 +99,42 @@ object MoGoLocationDispatcher :
MultiDisplayUtils.getOtherDisplay()
}
/**
* 高德地图位置改变回调
* @param aMapLocation 位置信息
* @param mogoLocation 位置信息
*/
override fun onLocationChanged(aMapLocation: AMapLocation) {
mapLocation = aMapLocation
// 更新GNSS 信息
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let {
// 转换 GCJ02-->WGS84 坐标
val wgs84Location =
CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude)
lastGaoDeLocation.longitude = wgs84Location[0]
lastGaoDeLocation.latitude = wgs84Location[1]
lastGaoDeLocation.heading = it.bearing.toDouble()
lastGaoDeLocation.gnssSpeed = it.speed
lastGaoDeLocation.altitude = it.altitude
lastGaoDeLocation.satelliteTime = it.time
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
lastGaoDeLocation.locType = 1 // 定位类型为高德坐标(网路或者硬件定位)
lastGaoDeLocation.satellite = 4
lastGaoDeLocation.cityName = it.city
lastGaoDeLocation.cityCode = it.cityCode
lastGaoDeLocation.provider = it.provider
lastGaoDeLocation.address = it.address
lastGaoDeLocation.district = it.district
lastGaoDeLocation.province = it.province
lastGaoDeLocation.adCode = it.adCode
lastGaoDeLocation.locationDetail = it.locationDetail
lastGaoDeLocation.poiName = it.poiName
lastGaoDeLocation.aoiName = it.aoiName
lastGaoDeLocation.street = it.street
lastGaoDeLocation.streetNum = it.streetNum
lastGaoDeLocation.description = it.description
lastGaoDeLocation.buildingId = it.buildingId
lastGaoDeLocation.floor = it.floor
lastGaoDeLocation.errorCode = it.errorCode
lastGaoDeLocation.errorInfo = it.errorInfo
}
override fun onMoGoLocationChanged(mogoLocation: MogoLocation) {
// 更新GaoDe 信息
lastGaoDeLocation = mogoLocation
// 计算最后一次工控机同步的定位是否超时,如果超时则切换为高德地图定位,暂定超过30秒需要切换
if (1 == FunctionBuildConfig.gpsProvider) {
if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 30000) {
if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 10000) {
syncGaoDeLocation()
}
} else if (2 == FunctionBuildConfig.gpsProvider) {
if (TimeUtils.getNowMills() - lastOBULocation.lastReceiveTime > 30000) {
if (TimeUtils.getNowMills() - lastOBULocation.lastReceiveTime > 10000) {
syncGaoDeLocation()
}
}
// 本地SP缓存城市Code
val cityCode = aMapLocation.cityCode
val cityCode = mogoLocation.cityCode
if (cityCode != null && cityCode.isNotEmpty()) {
mCityCode = aMapLocation.cityCode
mCityCode = mogoLocation.cityCode
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LATITUDE,
aMapLocation.latitude.toString()
mogoLocation.latitude.toString()
)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LONGITUDE,
aMapLocation.longitude.toString()
mogoLocation.longitude.toString()
)
}
@@ -236,13 +170,13 @@ object MoGoLocationDispatcher :
lastOBULocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let {
lastGaoDeLocation.let {
//agps 高德
//agps_rtk 高德-高精
lastOBULocation.locType = 1000 // 定位类型为WGS84进行转译的坐标
lastOBULocation.satellite = 4
lastOBULocation.cityName = it.city
lastOBULocation.cityName = it.cityName
lastOBULocation.cityCode = it.cityCode
lastOBULocation.provider = it.provider
lastOBULocation.address = it.address
@@ -274,4 +208,5 @@ object MoGoLocationDispatcher :
)
}
}
}

View File

@@ -2,16 +2,13 @@ package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CommonUtils
import com.mogo.support.obu.MogoObuManager
/**
* @author xiaoyuzhou

View File

@@ -6,29 +6,22 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.obu.*
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.constants.MogoObuConstants
import kotlin.math.roundToInt
/**
*
* @author lixiaopeng
@@ -78,7 +71,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
onMogoObuMapMath(mapMatchData)
}
/**
* RSI预警信息 CvxRtiThreatIndInfo交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/
@@ -140,9 +132,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (rsiWarningData.warningMsgList[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = V2iEventTypeEnum.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
@@ -191,10 +180,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
@@ -258,11 +243,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.ADD -> {
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
@@ -272,14 +252,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据,删除标牌?
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
// ?.let {
// // 事件结束,还原车辆颜色
// it.threatLevel = 0x01
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficInfo(it)
// }
}
}
}
@@ -296,25 +268,55 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participant != null) {
var v2xType = ""
if (rsmWarningData.participant.ptcType == 1) { //机动车
v2xType =
var v2xType = when (rsmWarningData.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participant.ptcType == 2) { //非机动车
v2xType =
}
2 -> { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participant.ptcType == 3) { //行人
v2xType =
}
3 -> { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
else -> { //未知
EventTypeEnumNew.TYPE_ERROR.poiType
}
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction =
getMessageDirection(rsmWarningData.participant.targetPosition) //TODO 只有一个
val direction = getMessageDirection(rsmWarningData.participant.targetPosition)
//模型的显示
when (rsmWarningData.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
// 更新数据模型变色的时候是不是update,如果不是更新可能导致模型不变色add的时候是否有level高的 TODO
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
}
}
if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) {
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
CallerLogger.d(
@@ -323,45 +325,36 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
rsmWarningData.warningMsg.warningDataList[0].status
} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//更新模型的颜色
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
// 更新数据 TODO 由于obu通过域控需要转换单位这里临时转换后面3.0不需要转换
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
// // 事件结束,还原交通参与者颜色
// it.threatLevel = 0x01
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
}
}
}
}
}
}
/**
@@ -383,10 +376,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
fun onMogoObuMapMath(data: ObuScene.MapMatchData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView
)
if (HmiBuildConfig.isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d(
@@ -398,7 +387,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} --- data.speedMaxLimit = ${data.speedMaxLimit}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
MogoObuConstants.STATUS.ADD -> { // 添加
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),
DataSourceType.OBU
@@ -469,6 +458,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
}
@@ -598,18 +588,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 保存obu通过工控机传输的数据到消息盒子
*/
private fun saveObuToDcData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.TELEMATIC)
}
/**

View File

@@ -4,18 +4,13 @@ import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.angle.Default
import com.mogo.eagle.core.function.api.map.angle.TooClose
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
@@ -107,7 +102,7 @@ class MogoPrivateObuNewManager private constructor() {
fun setObuLog(isChecked: Boolean) {
ObuManager.getInstance().setEnableLog(isChecked)
val builder: com.mogo.support.obu.option.MogoObuLog.Builder =
val builder: MogoObuLog.Builder =
MogoObuLog.newBuilder().setEnableStdio(isChecked)
if (isChecked) {
builder.setStdioLevel(MogoObuLogLevel.DBG)
@@ -437,27 +432,24 @@ class MogoPrivateObuNewManager private constructor() {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (data != null && data.participant != null) {
var v2xType = ""
if (data.participant.ptcType == 1) { //机动车
v2xType =
var v2xType = when (data.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 2) { //非机动车
v2xType =
}
2 -> { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 3) { //行人
v2xType =
}
3 -> { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
else -> { //未知
EventTypeEnumNew.TYPE_ERROR.poiType
}
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
val alertContent = EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction = getMessageDirection(data.participant.targetPosition)
//物体数据绘制
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRsmWarning ---- data.status = ${data.status} ---data.participant.ptcId = ${data.participant.ptcId} ---data.participant.ptcType = ${data.participant.ptcType} ---data.warningMsg = ${data.warningMsg} -----data = ${data.toString()}"
@@ -745,11 +737,6 @@ class MogoPrivateObuNewManager private constructor() {
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType
}
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> {
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
}
}
when (status) {
@@ -830,9 +817,9 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
}
}
}
@@ -864,10 +851,6 @@ class MogoPrivateObuNewManager private constructor() {
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus 闯红灯 --------> "
)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
@@ -969,7 +952,7 @@ class MogoPrivateObuNewManager private constructor() {
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.OBU)
}
/**

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.msgbox
import android.content.Context
import android.os.Looper
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
@@ -87,7 +88,16 @@ object DataManager {
msg.timestamp = System.currentTimeMillis()
msg.bean2Json = GsonUtils.toJson(msg.bean)
when (type) {
MsgBoxType.V2X, MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> {
MsgBoxType.V2X -> {
// 汇总消息不存数据库
if (msg.sourceType != DataSourceType.SUMMARY) {
synchronized(this) {
notifyList.add(msg)
}
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
}
MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> {
synchronized(this) {
notifyList.add(msg)
}

View File

@@ -7,18 +7,33 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.view.KeyEvent
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.eagle.core.data.mofang.MfConstants
import com.mogo.eagle.core.function.api.mofang.IMoGoMoFangListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorChangeLaneLeft
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorChangeLaneRight
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorSetAcceleratedSpeed
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorSetHorn
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager.invokeMoFangStatus
import com.mogo.eagle.core.function.call.mofang.CallerMofangListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_F
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import java.util.*
/**
* 魔方连接状态和设备管理
*/
@SuppressLint("StaticFieldLeak")
class MoFangManager private constructor() {
class MoFangManager private constructor() : IMoGoMoFangListener{
companion object {
val moFangManager: MoFangManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
@@ -31,6 +46,29 @@ class MoFangManager private constructor() {
private lateinit var mBluetoothAdapter: BluetoothAdapter
private var isMfConnect: Boolean = false //添加状态判断
private val isShowToast = false //toast 控制,自测使用
private var startPressTime: Long = 0 //开始按键时间
private var isPressEnd = false //按键是否结束
@Volatile
private var isCombinationKey = 0 //是否是组合按键 1单击2长按3组合
private var pressADownTime: Long = 0
private var pressAUpTime: Long = 0
private var pressBDownTime: Long = 0
private var pressBUpTime: Long = 0
private var pressCDownTime: Long = 0
private var pressCUpTime: Long = 0
private var pressDDownTime: Long = 0
private var pressDUpTime: Long = 0
private var pressEDownTime: Long = 0
private var pressEUpTime: Long = 0
private val clickTime = 300 //单击
private val clickTimeInterval = 330
private val longPressTime = 670
private val longPressTimeInterval = 700
private var timerHorn: Timer? = null
private var timerAcc: Timer? = null
fun init(context: Context) {
mContext = context
@@ -41,6 +79,12 @@ class MoFangManager private constructor() {
}
mBluetoothAdapter.startDiscovery()
showBondedDevice(mBluetoothAdapter)
CallerMofangListenerManager.addListener(TAG, this)
}
fun release() {
CallerMofangListenerManager.removeListener(TAG)
}
/**
@@ -89,7 +133,7 @@ class MoFangManager private constructor() {
private val bluetoothMonitorReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态 TODO
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态
CallerLogger.d("$M_F${TAG}","bluetoothMonitorReceiver ACTION_STATE_CHANGED action = ${intent.action}")
}
@@ -115,5 +159,190 @@ class MoFangManager private constructor() {
}
}
/**
* 魔方按键处理
*/
override fun onMofangHandle(keyCode: Int, action: Int): Boolean {
val bluetoothName = SharedPrefsMgr.getInstance(ContextHolderUtil.getContext()).getString(MfConstants.BLUETOOTH_NAME)
if (bluetoothName == "MINI_KEYBOARD") {
if (!isPressEnd) {
isPressEnd = true
startPressTime = System.currentTimeMillis()
}
e(M_F + "MoFangManager",
"dispatchKeyEvent ------ bluetoothName = $bluetoothName ---code = $keyCode -----action = $action ")
if (keyCode == KeyEvent.KEYCODE_A) { //单击 -1长按无操作AB组合-2
if (action == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime)
if (pressADownTime - startPressTime in (clickTimeInterval + 1) until longPressTime && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 +1 ")
}
sendAcc(true, +1.0)
isCombinationKey = 3
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if (pressADownTime - startPressTime > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按A -2 ")
}
sendAcc(true, -2.0)
isCombinationKey = 2
}
}
} else if (action == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime + "---isCombinationKey = $isCombinationKey")
if (pressAUpTime - startPressTime < clickTime && isCombinationKey != 3) {
isCombinationKey = 1
if (isShowToast) {
ToastUtils.showShort("方块 单击A -1 ")
}
sendAcc(true, -1.0)
}
pressADownTime = 0
isPressEnd = false
UiThreadHandler.postDelayed({ isCombinationKey = 0 }, 300)
}
} else if (keyCode == KeyEvent.KEYCODE_B) { //单击复原,长按+1AB组合-2
if (action == KeyEvent.ACTION_DOWN) {
pressBDownTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime
)
if (pressBDownTime - startPressTime > clickTimeInterval && pressBDownTime - startPressTime < longPressTime && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 +1 ")
}
sendAcc(true, +1.0)
isCombinationKey = 3
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if (pressBDownTime - startPressTime > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按B 无操作 ")
}
isCombinationKey = 2
}
}
} else if (action == KeyEvent.ACTION_UP) {
pressBUpTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime + "----isCombinationKey = $isCombinationKey")
if (pressBUpTime - startPressTime < clickTime && isCombinationKey != 3) {
if (isShowToast) {
ToastUtils.showShort("方块 单击B 0 ")
}
sendAcc(false, 0.0)
isCombinationKey = 1
}
pressBDownTime = 0
isPressEnd = false
UiThreadHandler.postDelayed({ isCombinationKey = 0 }, 300)
}
} else if (keyCode == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
if (action == KeyEvent.ACTION_DOWN) {
pressCDownTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime))
if (pressCDownTime - startPressTime > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按C 无操作 ")
}
}
} else if (action == KeyEvent.ACTION_UP) {
pressCUpTime = System.currentTimeMillis()
isPressEnd = false
d(M_F + "MoFangManager",
"dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime))
if (pressCUpTime - startPressTime < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ")
}
sendOperatorChangeLaneLeft()
}
}
} else if (keyCode == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
if (action == KeyEvent.ACTION_DOWN) {
pressDDownTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime))
if (pressDDownTime - startPressTime > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按D 无操作 ")
}
}
} else if (action == KeyEvent.ACTION_UP) {
pressDUpTime = System.currentTimeMillis()
isPressEnd = false
d(M_F + "MoFangManager",
"dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime))
if (pressDUpTime - startPressTime < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ")
}
sendOperatorChangeLaneRight()
}
}
} else if (keyCode == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
if (action == KeyEvent.ACTION_DOWN) {
pressEDownTime = System.currentTimeMillis()
d(M_F + "MoFangManager",
"dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime))
if (pressEDownTime - startPressTime > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ")
}
sendOperatorSetHorn(1.0)
if (timerHorn == null) {
timerHorn = Timer()
}
timerHorn!!.schedule(object : TimerTask() {
override fun run() {
sendOperatorSetHorn(2.0)
timerHorn = null
}
}, 500)
}
} else if (action == KeyEvent.ACTION_UP) {
pressEUpTime = System.currentTimeMillis()
isPressEnd = false
d(M_F + "MoFangManager",
"方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime))
if (pressEUpTime - startPressTime < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ")
}
startAutoPilot(getAutoPilotStatusInfo().autopilotControlParameters)
}
}
}
}
return true
}
@Synchronized
private fun sendAcc(isSend: Boolean, acc: Double) {
if (isSend) {
if (timerAcc == null) {
timerAcc = Timer()
timerAcc!!.schedule(object : TimerTask() {
override fun run() {
sendOperatorSetAcceleratedSpeed(acc)
}
}, 0, 500)
}
} else {
if (timerAcc != null) {
timerAcc!!.cancel()
timerAcc = null
}
sendOperatorSetAcceleratedSpeed(acc)
}
}
}

View File

@@ -60,8 +60,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
leftView?.setOnClickListener {
when {
isConfirm -> {
cacheHDOfflineData()
showNewContent(isLoading = true, false)
cacheHDOfflineData()
}
else -> {
dismiss()
@@ -72,6 +72,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
rightView?.setOnClickListener {
when {
isRetry -> {
showNewContent(isLoading = true, false)
cacheHDOfflineData()
}
else -> {
@@ -81,6 +82,9 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
}
okView?.setOnClickListener {
if (isLoading) {
CallerMapUIServiceManager.cancelDownloadCacheData()
}
dismiss()
}
}
@@ -90,6 +94,12 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
updateProgress(progress.toInt())
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
}
})
}
@@ -131,6 +141,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
@SuppressLint("UseCompatLoadingForDrawables")
private fun showNewContent(isLoading: Boolean, isSuccess: Boolean) {
this.isLoading = isLoading
change2NewStyle()
when {
isLoading -> {
@@ -150,11 +161,14 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
downloadResultImg?.background = ContextCompat.getDrawable(context, R.drawable.download_success_icon)
}
else -> {
isRetry = true
isConfirm = false
offlineTitleView?.text = context.resources.getString(R.string.offline_download_failure)
okView?.visibility = View.GONE
progressBar?.visibility = View.GONE
downloadPercentView?.visibility = View.GONE
leftView?.visibility = View.VISIBLE
leftView?.text = context.resources.getString(R.string.ok_tip)
rightView?.visibility = View.VISIBLE
vertLineView?.visibility = View.VISIBLE
rightView?.text = context.resources.getString(R.string.retry)

View File

@@ -8,7 +8,6 @@ import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
@@ -31,6 +30,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.BitmapHelper
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.eagle.core.widget.media.video.NoticeSimpleSmallVideoPlayer
import com.shuyu.gsyvideoplayer.GSYVideoManager

View File

@@ -672,11 +672,6 @@ internal class DebugSettingView @JvmOverloads constructor(
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
}
//TODO
tbIsDrawPath.setOnCheckedChangeListener { _, isChecked ->
}
// 初始化 GSP数据源 数据
rgGpsProvider.check(
when (FunctionBuildConfig.gpsProvider) {
@@ -1931,12 +1926,12 @@ internal class DebugSettingView @JvmOverloads constructor(
}
/**
* 车辆挂档位
* 车辆挂档位
* @param gear 档位
*/
override fun onAutopilotGearData(gear: Chassis.GearPosition) {
ThreadUtils.runOnUiThread {
tvGearInfo.text = "档位:${gear}"
tvGearInfo.text = "档位:${gear}"
}
}

View File

@@ -117,7 +117,6 @@ internal class SOPSettingView @JvmOverloads constructor(
tbObuToDcView.setOnCheckedChangeListener { _, isChecked ->
// 默认开启
HmiBuildConfig.isShowObuToDcV2iView = !isChecked
// Log.d("liyz", "HmiBuildConfig.isShowObuToDcV2iView = " + HmiBuildConfig.isShowObuToDcV2iView)
}
//红绿灯标识

View File

@@ -60,7 +60,7 @@ class VersionNameView @JvmOverloads constructor(
@SuppressLint("SetTextI18n")
private fun showCurrentPadVersion() {
tvAppVersionName?.let {
// it.text = "APP:${AppUtils.getAppVersionName()}"
it.text = "APP:${AppUtils.getAppVersionName()}"
}
}

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_START_UP;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_F;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
@@ -21,20 +20,15 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.mofang.MfConstants;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.mofang.CallerMofangListenerManager;
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.rousetime.android_startup.model.CostTimesModel;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
@@ -43,8 +37,6 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
* 针对作为Launcher的情况做个性化操作
@@ -57,31 +49,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private final static Handler handlerV2XEvent = new Handler();
private static Runnable runnableV2XEvent;
private volatile double accelerated;//加速度
private Timer timerHorn;
private Timer timerAcc;
private boolean isShowToast = false; //toast 控制
private long startPressTime = 0; //开始按减时间
private boolean isPressEnd = false; //按键是否结束
private volatile int isCombinationKey = 0; //是否是组合按键 1单击2长按3组合
private long pressADownTime = 0;
private long pressAUpTime = 0;
private long pressBDownTime = 0;
private long pressBUpTime = 0;
private long pressCDownTime = 0;
private long pressCUpTime = 0;
private long pressDDownTime = 0;
private long pressDUpTime = 0;
private long pressEDownTime = 0;
private long pressEUpTime = 0;
private int clickTime = 300; //单击
private int clickTimeInterval = 330;
private int longPressTime = 670;
private int longPressTimeInterval = 700;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -240,200 +207,15 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString(MfConstants.BLUETOOTH_NAME);
if (!isPressEnd) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName);
if(CallerMofangListenerManager.INSTANCE.invokeMofangHandle(event.getKeyCode(), event.getAction())) {
return true;
} else {
return super.dispatchKeyEvent(event);
}
if (bluetoothName.equals("MINI_KEYBOARD")) {
if (!isPressEnd) {
isPressEnd = true;
startPressTime = System.currentTimeMillis();
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction());
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1长按无操作AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
if ((pressADownTime - startPressTime) > clickTimeInterval && (pressADownTime - startPressTime) < longPressTime && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 +1 ");
}
sendAcc(true, +1);
isCombinationKey = 3;
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressADownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按A -2 ");
}
sendAcc(true, -2);
isCombinationKey = 2;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
if ((pressAUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
isCombinationKey = 1;
if (isShowToast) {
ToastUtils.showShort("方块 单击A -1 ");
}
sendAcc(true, -1);
}
pressADownTime = 0;
isPressEnd = false;
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
isCombinationKey = 0;
}
}, 300);
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击复原,长按+1AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressBDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
if ((pressBDownTime - startPressTime) > clickTimeInterval && (pressBDownTime - startPressTime) < longPressTime && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 +1 ");
}
sendAcc(true, +1);
isCombinationKey = 3;
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressBDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按B 无操作 ");
}
isCombinationKey = 2;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressBUpTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
if ((pressBUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
if (isShowToast) {
ToastUtils.showShort("方块 单击B 0 ");
}
sendAcc(false, 0.0);
isCombinationKey = 1;
}
pressBDownTime = 0;
isPressEnd = false;
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
isCombinationKey = 0;
}
}, 300);
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressCDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
if ((pressCDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按C 无操作 ");
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressCUpTime = System.currentTimeMillis();
isPressEnd = false;
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
if ((pressCUpTime - startPressTime) < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneLeft();
}
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressDDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
if ((pressDDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按D 无操作 ");
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressDUpTime = System.currentTimeMillis();
isPressEnd = false;
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
if ((pressDUpTime - startPressTime) < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressEDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
if ((pressEDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressEUpTime = System.currentTimeMillis();
isPressEnd = false;
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
if ((pressEUpTime - startPressTime) < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
}
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
}
return true;
}
}
return super.dispatchKeyEvent(event);
}
@Override
public void onSkinModeChange(int skinMode) {
}
private synchronized void sendAcc(boolean isSend, double acc) {
if (isSend) {
accelerated = acc;
if (timerAcc == null) {
timerAcc = new Timer();
timerAcc.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
}
}, 0, 500);
}
} else {
if (timerAcc != null) {
timerAcc.cancel();
timerAcc = null;
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
}
}
}

View File

@@ -1009,7 +1009,7 @@
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="挂档位:" />
android:text="挂档位:" />
<View
android:layout_width="match_parent"

View File

@@ -60,7 +60,6 @@ dependencies {
implementation rootProject.ext.dependencies.mogocustommap
implementation rootProject.ext.dependencies.amapnavi3dmap
// implementation rootProject.ext.dependencies.amaplocation
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler

View File

@@ -1,4 +1,3 @@
-keep class com.mogo.module.small.map.*{*;}
-keep class com.android.internal.policy.MyPhoneLayoutInflater{*;}
-keep class com.amap.api.col.n3.*{*;}

View File

@@ -4,12 +4,12 @@ import static com.mogo.eagle.core.function.business.identify.TrackManager.LIMIT_
import android.annotation.SuppressLint;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import java.util.Arrays;
import java.util.Comparator;

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.impl.marker.drawer;
import android.text.TextUtils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
@@ -16,6 +15,7 @@ import com.mogo.eagle.core.function.impl.marker.view.EmptyMarkerView;
import com.mogo.eagle.core.function.impl.marker.view.IMarkerView;
import com.mogo.eagle.core.function.impl.marker.view.MapMarkerAdapter;
import com.mogo.eagle.core.function.impl.marker.view.OnlineCarMarkerView;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.util.Log
import com.amap.api.maps.CoordinateConverter
import com.amap.api.maps.model.LatLng
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.android.schedulers.AndroidSchedulers

View File

@@ -1,18 +0,0 @@
package com.mogo.eagle.core.function.smp.view;
/**
* @author xiaoyuzhou
* @date 2021/6/24 11:33 上午
*/
public interface ISmallMapDirectionView {
/**
* 绘制路径线
*/
void drawablePolyline();
/**
* 清除路径线
*/
void clearPolyline();
}

View File

@@ -10,7 +10,6 @@ import android.widget.RelativeLayout
import androidx.annotation.UiThread
import com.amap.api.maps.*
import com.amap.api.maps.model.*
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLatLng
@@ -27,6 +26,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import mogo.telematics.pad.MessagePad
import kotlin.math.floor

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.eagle.core.function.smp.SmallMapDirectionView
android:id="@+id/smallMapDirectionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -11,15 +11,16 @@ import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.network.NetConfigUtils
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_RECONNECT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.map.MogoLocation
@@ -29,29 +30,35 @@ import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAIN
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.*
import com.rousetime.android_startup.AndroidStartup
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import kotlin.properties.Delegates
class HttpDnsStartUp : AndroidStartup<Boolean>() {
private val TAG = "MogoApplication"
companion object {
private const val TAG = "HttpDnsStartUp"
}
// 配置云服务API
private val clientConfig by lazy {
MoGoAiCloudClientConfig.getInstance()
}
// 缓存IP地址
private var cacheIp: String? = null
private var context: Context? = null
private var gotToken = false
private var httpDnsSimpleLocation by Delegates.observable(getDefaultSimpleLocation()) { _, oldValue, newValue ->
if (oldValue.cityCode != newValue.cityCode) {
reConnectSocket(oldValue.cityCode, newValue.cityCode)
}
}
override fun callCreateOnMainThread() = true
override fun waitOnMainThread() = false
@@ -90,9 +97,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
clientConfig.passportUrl = FunctionBuildConfig.urlJson.passportUrl
clientConfig.socketBaseUrl = FunctionBuildConfig.urlJson.socketBaseUrl
clientConfig.socketTechUrl = FunctionBuildConfig.urlJson.socketTechUrl
// clientConfig.passportUrl //todo 亚坤
// clientConfig.socketBaseUrl
// clientConfig.socketTechUrl
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {
@@ -121,7 +128,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun getCurrentLocation(): HttpDnsSimpleLocation {
val envConfig = CallerDevaToolsManager.getEnvConfig()
if (envConfig != null) {
return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
// 更新
httpDnsSimpleLocation =
HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
return httpDnsSimpleLocation
}
var mogoLocation: MogoLocation? = null
val locationClient =
@@ -129,49 +139,26 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
if (locationClient != null) {
mogoLocation = locationClient
}
val httpDnsSimpleLocation =
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) {
if (mogoLocation.cityCode.isNullOrEmpty()
&& !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
) {
HttpDnsSimpleLocation(
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
?: "010",
mogoLocation.latitude,
mogoLocation.longitude
)
} else {
HttpDnsSimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
}
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) {
// 更新
httpDnsSimpleLocation = if (
mogoLocation.cityCode.isNullOrEmpty() &&
!CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
) {
HttpDnsSimpleLocation(
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
?: "010",
mogoLocation.latitude,
mogoLocation.longitude
)
} else {
val ciyCode =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_CITY_CODE)
val latitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LATITUDE)
val longitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LONGITUDE)
try {
HttpDnsSimpleLocation(
ciyCode, latitude.toDouble(), longitude.toDouble()
)
} catch (e: NumberFormatException) {
// e.printStackTrace();
HttpDnsSimpleLocation("010", 1.0, 1.0)
}
HttpDnsSimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
}
}
return httpDnsSimpleLocation
}
}
@@ -186,10 +173,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientConfig.token = token
// 由于存在token过期问题在更新后会回调至此处增加二次判定
if (!gotToken) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"onTokenGot token : $token , sn :$sn"
)
CallerLogger.d("$M_MAIN$TAG", "onTokenGot token : $token , sn :$sn")
CallerCloudListenerManager.invokeCloudTokenGot(token, sn)
// 异步初始化NetConfig
asyncInit()
@@ -202,7 +186,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun onError(code: Int, msg: String) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"$M_MAIN$TAG",
"初始化MogoAiCloudSdk failed ,reason : $msg , 未能开启长链服务和初始化Modules服务"
)
}
@@ -250,13 +234,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
}
private fun startSocketService() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "startSocketService")
CallerLogger.d("$M_MAIN$TAG", "startSocketService")
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
// 关闭长链服务
MogoAiCloudSocketManager.getInstance(context).destroy()
MogoAiCloudSocketManager.getInstance(context)
.registerLifecycleListener(10020, object : IMogoLifecycleListener {
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
@@ -266,7 +247,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onConnectFailure() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectFailure")
CallerLogger.d("$M_MAIN$TAG", "socket-onConnectFailure")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, false)
}
@@ -279,7 +260,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onConnectSuccess() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectSuccess")
CallerLogger.d("$M_MAIN$TAG", "socket-onConnectSuccess")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, true)
}
@@ -292,7 +273,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onConnectLost() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectLost")
CallerLogger.d("$M_MAIN$TAG", "socket-onConnectLost")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, false)
}
@@ -305,10 +286,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onError(code: String, msg: String?) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"socket-onError code : $code , msg : $msg"
)
CallerLogger.d("$M_MAIN$TAG", "socket-onError code : $code , msg : $msg")
}
})
// 开启Socket长链服务
@@ -319,4 +297,45 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
MogoAiCloudSocketManager.getInstance(context)
.init(context, DebugConfig.getSocketAppId(), lat, lon)
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_RECONNECT,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
private fun reConnectSocket(oldCityCode: String, newCityCode: String) {
CallerLogger.d(
"$M_MAIN$TAG",
"reConnectSocket oldCityCode : $oldCityCode , newCityCode : $newCityCode"
)
MogoAiCloudSocketManager.getInstance(context).reConnect()
}
private fun getDefaultSimpleLocation(): HttpDnsSimpleLocation {
val ciyCode =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_CITY_CODE)
val latitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LATITUDE)
val longitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LONGITUDE)
return try {
HttpDnsSimpleLocation(
ciyCode, latitude.toDouble(), longitude.toDouble()
)
} catch (e: NumberFormatException) {
HttpDnsSimpleLocation("010", 1.0, 1.0)
}
}
}

View File

@@ -58,6 +58,7 @@ class ChainConstant {
const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL"
const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS"
const val CHAIN_ALIAS_CODE_CLOUD_RECONNECT = "CHAIN_ALIAS_CODE_CLOUD_RECONNECT"
const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST"
const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_ERROR = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_ERROR"
const val CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED = "CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED"

View File

@@ -290,4 +290,26 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
* @param isDrawPointCloud 是否绘制点云
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean
fun sendRoboBusJinlvM1AirConditionerCmd(
switchCmd: Int,
modeCmd: Int,
windSpeedCmd: Int,
temperatureCmd: Int
): Boolean
fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean
fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean
fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean
/**
* 车门控制
*/
fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean
fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean
}

View File

@@ -1,6 +1,6 @@
package com.mogo.eagle.core.function.api.autopilot
import com.zhidao.support.adas.high.bean.AutopilotStatistics
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
/**
* 启动自动驾驶状态统计监听

View File

@@ -3,12 +3,12 @@ package com.mogo.eagle.core.function.api.autopilot
import chassis.Chassis
/**
* 车辆挂档位 数据 回调监听
* 车辆挂档位 数据 回调监听
*/
interface IMoGoChassisGearStateListener {
/**
* 车辆挂档位
* 车辆挂档位
* @param gear 档位
*/
fun onAutopilotGearData(gear: Chassis.GearPosition)

View File

@@ -14,5 +14,5 @@ interface IGaoDeMapLocationListener {
*
* @param location 新定位点
*/
fun onLocationChanged(location: MogoLocation, from: Int, isGps: Boolean)
fun onMoGoLocationChanged(location: MogoLocation)
}

View File

@@ -0,0 +1,17 @@
package com.mogo.eagle.core.function.api.mofang
/**
* 魔方数据的数据处理
* @author lixiaopeng
* @date 2023-02-20
*/
interface IMoGoMoFangListener {
/**
* 魔方数据的数据处理
* @param keyCode 按键类型
* @param action 按键状态
*/
fun onMofangHandle(keyCode: Int, action: Int): Boolean
}

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.api.obu
import com.mogo.eagle.core.data.enums.DataSourceType
/**
* OBU 数据保存
* @author lixiaopeng
@@ -11,8 +13,8 @@ interface IMoGoObuSaveMessageListener {
* @param type 事件id类似与uuid
* @param content 事件内容
* @param tts 事件语音播报
*
* @param sourceType 来源
*/
fun onMoGoObuSaveMessage(type: String, content: String, tts: String)
fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType)
}

View File

@@ -415,4 +415,39 @@ object CallerAutoPilotControlManager {
providerApi?.setIsDrawPointCloud(isDrawPointCloud)
}
fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
return providerApi?.sendRoboBusJinlvM1FrontDoorCmd(switchCmd) ?: false
}
fun sendRoboBusJinlvM1AirConditionerCmd(
switchCmd: Int,
modeCmd: Int,
windSpeedCmd: Int,
temperatureCmd: Int
): Boolean {
return providerApi?.sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd) ?: false
}
fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean {
return providerApi?.sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd) ?: false
}
fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean {
return providerApi?.sendRoboBusJinlvM1MainLamp1Cmd(switchCmd) ?: false
}
fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean {
return providerApi?.sendRoboBusJinlvM1MainLamp2Cmd(switchCmd) ?: false
}
/**
* 车门控制
*/
fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean {
return providerApi?.sendRoboBusJinlvM1SmallLampCmd(switchCmd) ?: false
}
fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean {
return providerApi?.sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd) ?: false
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.zhidao.support.adas.high.bean.AutopilotStatistics
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
object CallerAutopilotStatisticsListenerManager : CallerBase<IMoGoAutopilotStatisticsListener>() {

View File

@@ -4,7 +4,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆挂挡档位 回调监听
* 车辆刹车 回调监听
*/
object CallerChassisBrakeStateListenerManager : CallerBase<IMoGoChassisBrakeStateListener>() {

View File

@@ -5,12 +5,12 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆挂档位 回调监听
* 车辆挂档位 回调监听
*/
object CallerChassisGearStateListenerManager : CallerBase<IMoGoChassisGearStateListener>() {
/**
* 车辆挂档位
* 车辆挂档位
* @param gear 档位
*/
fun invokeAutopilotGearData(gear: Chassis.GearPosition) {

View File

@@ -35,8 +35,6 @@ object CallerChassisLocationGCJ02ListenerManager : CallerBase<IMoGoChassisLocati
setListenerHz(tag, callBackHz)
}
//todo 宏宇 添加HZ的移除操作
fun getChassisLocationGCJ02(): MogoLocation? {
return mGnssInfo
}

View File

@@ -70,6 +70,16 @@ open class CallerBase<T : Any> {
return
}
M_LISTENERS.remove(tag)
if (!M_LISTENERS_HZ.containsKey(tag)) {
return
}
M_LISTENERS_HZ.remove(tag)
if (!M_LISTENERS_HZ_LAST_SEND_TIME.containsKey(tag)) {
return
}
M_LISTENERS_HZ_LAST_SEND_TIME.remove(tag)
}
/**
@@ -83,6 +93,16 @@ open class CallerBase<T : Any> {
M_LISTENERS.forEach {
if (it.value == listener) {
M_LISTENERS.remove(it.key)
if (!M_LISTENERS_HZ.containsKey(it.key)) {
return
}
M_LISTENERS_HZ.remove(it.key)
if (!M_LISTENERS_HZ_LAST_SEND_TIME.containsKey(it.key)) {
return
}
M_LISTENERS_HZ_LAST_SEND_TIME.remove(it.key)
}
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.eagle.core.function.call.map
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.map.listener.IGaoDeMapLocationListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 高德地图定位监听
*/
object CallerGaoDeMapLocationListenerManager : CallerBase<IGaoDeMapLocationListener>() {
/**
* 高德位置改变监听
*/
@Synchronized
fun invokeMoGoLocationChanged(location: MogoLocation) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onMoGoLocationChanged(location)
}
}
}

View File

@@ -36,7 +36,7 @@ object CallerMapUIServiceManager {
}
fun isCityDataCached(): Boolean {
return serviceProvider?.mapUIController?.isCityDataCached ?: true
return serviceProvider?.mapUIController?.isCityDataCached ?: false
}
fun getOverlayManager(): IMogoOverlayManager?{
@@ -46,4 +46,8 @@ object CallerMapUIServiceManager {
fun getGDLocationServer(context: Context): IMogoGDLocationClient?{
return serviceProvider?.getGDLocationServer(context)
}
fun cancelDownloadCacheData() {
serviceProvider?.mapUIController?.cancelDownloadCacheData()
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function.call.mofang
import com.mogo.eagle.core.function.api.mofang.IMoGoMoFangListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 魔方按键的处理
*/
object CallerMofangListenerManager : CallerBase<IMoGoMoFangListener>() {
fun invokeMofangHandle(keyCode: Int, action: Int): Boolean {
var isConsume = false
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
if (listener.onMofangHandle(keyCode, action))
isConsume = true
}
return isConsume
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.call.obu
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.obu.IMoGoObuSaveMessageListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.call.base.CallerBase
@@ -11,11 +12,11 @@ import com.mogo.support.obu.ObuScene
*/
object CallerObuSaveMessageListenerManager : CallerBase<IMoGoObuSaveMessageListener>() {
fun invokeObuSaveMessage(type: String, content: String, tts: String) {
fun invokeObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onMoGoObuSaveMessage(type, content, tts)
listener.onMoGoObuSaveMessage(type, content, tts, sourceType)
}
}

View File

@@ -31,7 +31,6 @@ object AppIdentityModeUtils {
private fun getInfo(appIdentityMode: String): Array<String> {
val split = appIdentityMode.split("_")
if (split.size == 3) {
@@ -40,6 +39,14 @@ object AppIdentityModeUtils {
return arrayOf("", "", "")
}
fun getBuildCarType(appIdentityMode: String): String {
val (_, _, carType) = getInfo(appIdentityMode)
if(carType.isNotEmpty()){
return carType
}
return ""
}
/**
* 是否是 司机端(这里不细分具体是:小巴、出租车等类型)
*

View File

@@ -0,0 +1,132 @@
package com.mogo.eagle.core.utilcode.util;
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
/**
* @author donghongyu
*/
public class CoordinateUtils {
/**
* @param lon1
* @param lat1
* @param lon2
* @param lat2
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance( double lon1, double lat1, double lon2, double lat2 ) {
try {
double var2 = lon1;
double var4 = lat1;
double var6 = lon2;
double var8 = lat2;
var2 *= 0.01745329251994329D;
var4 *= 0.01745329251994329D;
var6 *= 0.01745329251994329D;
var8 *= 0.01745329251994329D;
double var10 = Math.sin( var2 );
double var12 = Math.sin( var4 );
double var14 = Math.cos( var2 );
double var16 = Math.cos( var4 );
double var18 = Math.sin( var6 );
double var20 = Math.sin( var8 );
double var22 = Math.cos( var6 );
double var24 = Math.cos( var8 );
double[] var28 = new double[3];
double[] var29 = new double[3];
var28[0] = var16 * var14;
var28[1] = var16 * var10;
var28[2] = var12;
var29[0] = var24 * var22;
var29[1] = var24 * var18;
var29[2] = var20;
return ( float ) ( Math.asin( Math.sqrt( ( var28[0] - var29[0] ) * ( var28[0] - var29[0] ) + ( var28[1] - var29[1] ) * ( var28[1] - var29[1] ) + ( var28[2] - var29[2] ) * ( var28[2] - var29[2] ) ) / 2.0D ) * 1.27420015798544E7D );
} catch ( Throwable var26 ) {
var26.printStackTrace();
return 0.0F;
}
}
// ------
private static final double x_PI = 52.35987755982988D;
private static final double PI = 3.141592653589793D;
private static final double a = 6378245.0D;
private static final double ee = 0.006693421622965943D;
public static final boolean outOfChina( double lat, double lng ) {
return lng <= 73.66D || lng >= 135.05D || lat <= 3.86D || lat >= 53.55D;
}
private static final double transformLat( double lng, double lat ) {
double ret = -100.0D + 2.0D * lng + 3.0D * lat + 0.2D * lat * lat + 0.1D * lng * lat + 0.2D * Math.sqrt( Math.abs( lng ) );
ret += ( 20.0D * Math.sin( 6.0D * lng * 3.141592653589793D ) + 20.0D * Math.sin( 2.0D * lng * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 20.0D * Math.sin( lat * 3.141592653589793D ) + 40.0D * Math.sin( lat / 3.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 160.0D * Math.sin( lat / 12.0D * 3.141592653589793D ) + ( double ) 320 * Math.sin( lat * 3.141592653589793D / 30.0D ) ) * 2.0D / 3.0D;
return ret;
}
private static final double transformLon( double lng, double lat ) {
double ret = 300.0D + lng + 2.0D * lat + 0.1D * lng * lng + 0.1D * lng * lat + 0.1D * Math.sqrt( Math.abs( lng ) );
ret += ( 20.0D * Math.sin( 6.0D * lng * 3.141592653589793D ) + 20.0D * Math.sin( 2.0D * lng * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 20.0D * Math.sin( lng * 3.141592653589793D ) + 40.0D * Math.sin( lng / 3.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 150.0D * Math.sin( lng / 12.0D * 3.141592653589793D ) + 300.0D * Math.sin( lng / 30.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
return ret;
}
@NotNull
// World Geodetic System ==> Mars Geodetic System
public static final double[] transformWgsToGcj( double wgLat, double wgLon ) {
double[] point = new double[2];
if ( outOfChina( wgLat, wgLon ) ) {
point[0] = wgLon;
point[1] = wgLat;
return point;
} else {
double dLat = transformLat( wgLon - 105.0D, wgLat - 35.0D );
double dLon = transformLon( wgLon - 105.0D, wgLat - 35.0D );
double radLat = wgLat / 180.0D * 3.141592653589793D;
double magic = Math.sin( radLat );
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
double sqrtMagic = Math.sqrt( magic );
dLat = dLat * 180.0D / ( 6335552.717000426D / ( magic * sqrtMagic ) * 3.141592653589793D );
dLon = dLon * 180.0D / ( 6378245.0D / sqrtMagic * Math.cos( radLat ) * 3.141592653589793D );
double mgLat = wgLat + dLat;
double mgLon = wgLon + dLon;
point[0] = dealRound( mgLon );
point[1] = dealRound( mgLat );
return point;
}
}
@NotNull
public static final double[] transformGcj02toWgs84( double lat, double lng ) {
double[] var10000;
if ( outOfChina( lat, lng ) ) {
var10000 = new double[]{lng, lat};
} else {
double dlat = transformLat( lng - 105.0D, lat - 35.0D );
double dlng = transformLon( lng - 105.0D, lat - 35.0D );
double radlat = lat / 180.0D * 3.141592653589793D;
double magic = Math.sin( radlat );
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
double sqrtmagic = Math.sqrt( magic );
dlat = dlat * 180.0D / ( 6335552.717000426D / ( magic * sqrtmagic ) * 3.141592653589793D );
dlng = dlng * 180.0D / ( 6378245.0D / sqrtmagic * Math.cos( radlat ) * 3.141592653589793D );
double mglat = lat + dlat;
double mglng = lng + dlng;
var10000 = new double[]{dealRound( lng * ( double ) 2 - mglng ), dealRound( lat * ( double ) 2 - mglat )};
}
return var10000;
}
private static final double dealRound( double value ) {
BigDecimal bg = new BigDecimal( value );
double result = bg.setScale( 6, 4 ).doubleValue();
return result;
}
}

View File

@@ -21,6 +21,11 @@ public interface IMogoSocketManager extends IProvider {
*/
void init( Context context, String appId , double lat, double lon);
/**
* 重新连接
*/
void reConnect();
/**
* 注册消息监听
*

View File

@@ -74,6 +74,11 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem
SocketManager.getInstance().init(context, lat, lon);
}
@Override
public void reConnect() {
SocketManager.getInstance().reConnect();
}
@Override
public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) {
if (mListeners.containsKey(msgType)) {

View File

@@ -66,26 +66,26 @@ SERVICE_BIZ_VERSION=1.2.4
LOGLIB_VERSION=1.5.10
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.4.2
MOGO_NETWORK_VERSION=1.4.4.8
# 鉴权
MOGO_PASSPORT_VERSION=1.4.4.2
MOGO_PASSPORT_VERSION=1.4.4.8
# 常链接
MOGO_SOCKET_VERSION=1.4.4.2
MOGO_SOCKET_VERSION=1.4.4.8
# 数据采集
MOGO_REALTIME_VERSION=1.4.4.2
MOGO_REALTIME_VERSION=1.4.4.8
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.4.2
MOGO_TANLU_VERSION=1.4.4.8
# 直播推流
MOGO_LIVE_VERSION=1.4.4.2
MOGO_LIVE_VERSION=1.4.4.8
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.4.2
MOGO_TRAFFICLIVE_VERSION=1.4.4.8
# 定位服务
MOGO_LOCATION_VERSION=1.4.4.2
MOGO_LOCATION_VERSION=1.4.4.8
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.4.2
MOGO_TELEMATIC_VERSION=1.4.4.8
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.10.0.2_test_01
MAP_SDK_VERSION=2.10.0.9
MAP_SDK_OPERATION_VERSION=1.1.4.1
# websocket
WEBSOCKET_VERSION=1.1.7
@@ -99,8 +99,6 @@ versionName=1.0.1
################# 新架构模块Maven版本管理 #################
MOGO_CORE_FUNCTION_HMI_VERSION=0.0.58.10
MOGO_CORE_FUNCTION_MAP_VERSION=0.0.58.10
MOGO_CORE_FUNCTION_OBU_MOGO_VERSION=0.0.58.10
MOGO_CORE_FUNCTION_V2X_VERSION=0.0.58.10
MOGO_CORE_DATA_VERSION=0.0.58.10
MOGO_CORE_FUNCTION_API_VERSION=0.0.58.10
MOGO_CORE_FUNCTION_CALL_VERSION=0.0.58.10
@@ -113,8 +111,6 @@ MOGO_CORE_NETWORK_VERSION=0.0.58.10
MOGO_COMMONS_VERSION=2.1.16.10
MOGO_MAP_VERSION=2.1.16.10
MOGO_MAP_API_VERSION=2.1.16.10
MOGO_MODULE_MAP_VERSION=2.1.16.10
MOGO_MODULE_V2X_VERSION=2.1.16.10
# obu
MOGO_MODULE_OBU_MOGO_VERSION=2.1.16.10
# bugly
@@ -138,11 +134,6 @@ MOGO_OCH_TAXI_VERSION=2.0.66
# mogoAiCloud sdk services
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10
################# 旧版本架构模块版本 #################
# ADAS LIB Maven配置用于地图部门测试使用鹰眼项目中使用本地依赖 #
ADAS_LIB_GROUP=com.zhidao.support.adas
ADAS_LIB_POM_ARTIFACT_ID=high
@@ -152,6 +143,5 @@ ADAS_DATA_LIB_GROUP=com.zhjt.mogo.adas.data
ADAS_DATA_LIB_POM_ARTIFACT_ID=adas-data
ADAS_DATA_LIB_CHILD_VERSION=.0
# 线程优化版本
THREAD_OPT_VERSION=4.0.0

View File

@@ -1,23 +1,38 @@
package com.zhidao.support.adas.high.bean;
package com.zhjt.mogo.adas.data.bean;
import com.zhidao.support.adas.high.common.Define;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
/**
* 自动驾驶启动统计 todo 凤坤后续封装成pb或者放入adas-data
* 自动驾驶启动统计
*/
public class AutopilotStatistics {
/**
* 启动自动驾驶后的状态
*/
public interface AUTOPILOT_START_STATUS {
/**
* 成功
*/
int SUCCESSFUL = 0;
/**
* 失败
*/
int FAILED = 1;
/**
* 取消
*/
int CANCEL = 2;
}
/**
* 启动自动驾驶后状态
* 0 成功
* 1 失败
* 2 取消
* {@link com.zhidao.support.adas.high.common.Constants.AUTOPILOT_START_STATUS}
* {@link AUTOPILOT_START_STATUS}
*/
@Define.AutopilotStartStatus
public final int status;
/**
@@ -36,7 +51,7 @@ public class AutopilotStatistics {
*/
public final MogoReportMsg.MogoReportMessage failedMessage;
public AutopilotStatistics(@Define.AutopilotStartStatus int status, long usedTime, MessagePad.SetAutopilotModeReq req, MogoReportMsg.MogoReportMessage failedMessage) {
public AutopilotStatistics(int status, long usedTime, MessagePad.SetAutopilotModeReq req, MogoReportMsg.MogoReportMessage failedMessage) {
this.status = status;
this.usedTime = usedTime;
this.req = req;

View File

@@ -21,9 +21,8 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhidao.support.adas.high.common.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.AutopilotReview;
import com.zhidao.support.adas.high.common.ByteUtil;
import com.zhidao.support.adas.high.common.Constants;
@@ -34,6 +33,7 @@ import com.zhidao.support.adas.high.common.MessageType;
import com.zhidao.support.adas.high.common.ProtocolStatus;
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
import com.zhidao.support.adas.high.common.RegexUtils;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.msg.IMsg;
import com.zhidao.support.adas.high.msg.MyMessageFactory;
import com.zhidao.support.adas.high.protocol.RawData;
@@ -129,6 +129,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
* 乘客屏无法进行注册或取消注册,因为乘客屏无法感知司机屏与工控机连接状态。无法重置已注册或未注册接口列表
*/
private SubscribeInterface subscribeInterface;
private Timer carConfigReqTimer;//车辆基础信息请求 多次请求防止无法收到基础信息情况出现
public void setOnMultiDeviceListener(OnMultiDeviceListener onMultiDeviceListener) {
this.onMultiDeviceListener = onMultiDeviceListener;
@@ -535,7 +536,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
@Override
public void onWebSocketConnectSuccess(String ipAddress, int port) {
sendCarConfigReq();
startCarConfigReq();
ipcConnectedIp = ipAddress;
ipcConnectedPort = port;
subscribeInterface = new SubscribeInterface(this);
@@ -662,6 +663,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
if (status == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
AdasManager.getInstance().setCarConfig(null);
stopDispatchHandler();
stopCarConfigReq();
}
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), reason);
@@ -775,6 +777,40 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
CupidLogUtils.setEnableLog(isEnableLog);
}
//车辆基础信息请求
private void startCarConfigReq() {
if (carConfigReqTimer == null) {
carConfigReqTimer = new Timer();
carConfigReqTimer.schedule(new TimerTask() {
int num = 0;
@Override
public void run() {
if (getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
if (AdasManager.getInstance().getCarConfig() == null) {
num++;
if (num > 3) {
CupidLogUtils.i(TAG, "最后一次也未获取到车机基础信息");
stopCarConfigReq();
} else {
CupidLogUtils.i(TAG, "" + num + "次获取车机基础信息");
sendCarConfigReq();
}
} else {
stopCarConfigReq();
}
}
}
}, 10, 2000L);
}
}
private synchronized void stopCarConfigReq() {
if (carConfigReqTimer != null) {
carConfigReqTimer.cancel();
carConfigReqTimer = null;
}
}
/**************************************************************************************************************************/
/**
@@ -1284,6 +1320,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
.build());
}
/**
* 金旅M1顶灯1控制
*
* @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯
* @return boolean
*/
@Override
public boolean sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd) {
return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder()
@@ -1291,6 +1333,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
.build());
}
/**
* 金旅M1顶灯2控制
*
* @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯
* @return boolean
*/
@Override
public boolean sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd) {
return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder()
@@ -1298,7 +1346,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
.build());
}
/**
* 金旅M1小灯(氛围灯)控制
*

View File

@@ -685,9 +685,9 @@ public class AdasManager implements IAdasNetCommApi {
}
/**
* 金旅M1车门控制
* 金旅M1小灯(氛围灯)控制
*
* @param switchCmd //0: default, 1: 开启车门, 2: 关闭车门
* @param switchCmd //0: default, 1: 开启小灯(氛围灯), 2: 关闭小灯(氛围灯)
* @return boolean
*/
@Override

View File

@@ -1,6 +1,6 @@
package com.zhidao.support.adas.high;
import com.zhidao.support.adas.high.common.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.subscribe.SubscribeInterfaceOptions;
import java.util.HashSet;

View File

@@ -1,7 +1,7 @@
package com.zhidao.support.adas.high;
import com.mogo.support.obu.ObuScene;
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhidao.support.adas.high.common.ProtocolStatus;
import bag_manager.BagManagerOuterClass;

View File

@@ -4,7 +4,8 @@ import android.os.SystemClock;
import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import java.util.Timer;
import java.util.TimerTask;
@@ -60,7 +61,7 @@ public class AutopilotReview {
startReq = req;
startTime = SystemClock.elapsedRealtime();
} else {
onCallback(Constants.AUTOPILOT_START_STATUS.CANCEL);
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL);
}
}
@@ -72,7 +73,7 @@ public class AutopilotReview {
public void onReportResult(MogoReportMsg.MogoReportMessage message) {
if (startReq != null && message != null) {
failedMessage = message;
onCallback(Constants.AUTOPILOT_START_STATUS.FAILED);
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
}
}
@@ -83,7 +84,7 @@ public class AutopilotReview {
*/
public void onAutopilotResult(MessagePad.AutopilotState state) {
if (startReq != null && state != null && state.getState() == 2) {
onCallback(Constants.AUTOPILOT_START_STATUS.SUCCESSFUL);
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL);
}
}
}

View File

@@ -110,23 +110,6 @@ public class Constants {
}
/**
* 启动自动驾驶后的状态
*/
public interface AUTOPILOT_START_STATUS {
/**
* 成功
*/
int SUCCESSFUL = 0;
/**
* 失败
*/
int FAILED = 1;
/**
* 取消
*/
int CANCEL = 2;
}
/**
* 使用底盘数据类型

View File

@@ -3,6 +3,7 @@ package com.zhidao.support.adas.high.common;
import androidx.annotation.IntDef;
import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -47,9 +48,9 @@ public final class Define {
public @interface SubscribeType {
}
@IntDef(flag = true, value = {Constants.AUTOPILOT_START_STATUS.SUCCESSFUL,
Constants.AUTOPILOT_START_STATUS.FAILED,
Constants.AUTOPILOT_START_STATUS.CANCEL})
@IntDef(flag = true, value = {AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL,
AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED,
AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL})
@Retention(RetentionPolicy.SOURCE)
public @interface AutopilotStartStatus {
}

View File

@@ -0,0 +1,118 @@
package com.zhidao.support.adas.high.common.autopilot.ability;
import com.zhidao.support.adas.high.OnAdasListener;
import java.util.Timer;
import java.util.TimerTask;
import java.util.regex.Pattern;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
/**
* 是否可以启动自动驾驶能力检测 工控机版本>=230&& <250 使用此类
* 目前监控了底盘的一些状态和查询节点状态应答的数据
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
* <p>
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/
public class AutopilotAbility230 {
private static final String TAG = AutopilotAbility230.class.getSimpleName();
private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
private volatile Timer timer;
private ChassisStatesOuterClass.ChassisStates chassisStates;
public AutopilotAbility230() {
}
public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
this.chassisStates = chassisStates;
}
private void onCallback() {
//金旅、开沃小巴乘客端 不能启动自动驾驶
if (AutopilotAbilityManager.getInstance().isBusPassenger()) {
return;
}
boolean isAutopilotAbility = true;//是否能启动自动驾驶
String unableAutopilotReason = null;//不能启动自动驾驶原因
//检测底盘相关
if (chassisStates != null) {
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
if (brake > 0) {
isAutopilotAbility = false;
unableAutopilotReason = "制动踏板被踩下";
}
}
if (isAutopilotAbility) {
/**
* 档位状态判断 目前判断的车型包括 东风Taxi 红旗Taxi 金旅Bus 金旅M1 金旅M1 福田清扫车 开沃
* TODO 如果 identityMode 未赋值以及目前已知其他车型判断逻辑跟东风Taxi和红旗 走
*/
//开沃任何档位都能启动自驾
if (!AutopilotAbilityManager.getInstance().isBusDriverVan()) {
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
//金旅Bus和清扫车 档位不正常
if (AutopilotAbilityManager.getInstance().isBusDriver()) {
if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
unableAutopilotReason = "档位不正常";
}
} else if (AutopilotAbilityManager.getInstance().isSweeperDriverFutian()) {
if (gear == Chassis.GearPosition.GEAR_N) {
isAutopilotAbility = false;
unableAutopilotReason = "档位不正常";
}
} else {
//东风Taxi和红旗 司机端和乘客端 档位不正常
if (gear == Chassis.GearPosition.GEAR_P || gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
unableAutopilotReason = "档位不正常";
}
}
}
}
}
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
// if (isAutopilotAbility) {
// //电子驻车制动系统
// if (chassisStates.hasEpbSystemStates()) {
// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
// if (epb.hasEpbEnableState()){
// epb.getEpbWorkState();
// }
// }
// }
}
if (AutopilotAbilityManager.getInstance().getListener() != null) {
AutopilotAbilityManager.getInstance().getListener().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
}
}
public synchronized void start() {
if (timer == null) {
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
onCallback();
}
}, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
}
}
public synchronized void stop() {
if (timer != null) {
timer.cancel();
timer = null;
}
this.chassisStates = null;
}
}

View File

@@ -1,106 +1,41 @@
package com.zhidao.support.adas.high.common;
package com.zhidao.support.adas.high.common.autopilot.ability;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import system_master.SystemStatusInfo;
/**
* 是否可以启动自动驾驶能力检测
* 是否可以启动自动驾驶能力检测 工控机版本>=250使用此类
* 目前监控了底盘的一些状态和查询节点状态应答的数据
* 没有使用监控事件报告的原因是因为部分异常没进行正常恢复通知例如收到了异常监控数据但是异常恢复之后没有恢复的通知
* <p>
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/
public class AutopilotAbilityManager {
private static final String TAG = AutopilotAbilityManager.class.getSimpleName();
public class AutopilotAbility250 {
private static final String TAG = AutopilotAbility250.class.getSimpleName();
private static final int WHAT_TIMEOUT = 0;
private static final int DEFAULT_TIMEOUT = 1500;
private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
private static volatile AutopilotAbilityManager INSTANCE;
private OnAdasListener listener;
private volatile Timer timer;
private final Pattern pattern = Pattern.compile("\\d+.\\d+.\\d+");
private ChassisStatesOuterClass.ChassisStates chassisStates;
private Handler handler;
private OnAutopilotAbilityListener onAutopilotAbilityListener;
/**
* 身份/车型
*/
private String identityMode;
public interface OnAutopilotAbilityListener {
void onStatusQuery();//查询是被调用
public AutopilotAbility250() {
}
/**
* 身份规则定义根据app/productFlavors/README.md
* * taxi司机屏 Taxi_Driver_Base 东风红旗司机端
* * taxi乘客屏 Taxi_Passenger_Base 东风红旗乘客端
* * bus司机屏 Bus_Driver_Base 金旅小巴司机端
* * Bus_Driver_Van 开沃小巴司机端
* * bus乘客屏 Bus_Passenger_Base 金旅开沃小巴乘客端
* * Bus_Passenger_M1 M1小巴乘客端
* * Bus_Passenger_M2 M2小巴乘客端
* * 清扫车 Sweeper_Driver_FT 福田清扫车司机端
* <p>
* 此定义不区分角色只区分业务线和车型
*/
private interface IDENTITY_MODE {
String TAXI_DRIVER_BASE = "Taxi_Driver_Base";//东风红旗司机端
String TAXI_PASSENGER_BASE = "Taxi_Passenger_Base";//东风红旗乘客端
String BUS_DRIVER_BASE = "Bus_Driver_Base";//金旅小巴司机端
String BUS_DRIVER_VAN = "Bus_Driver_Van";//开沃小巴司机端
String BUS_PASSENGER_BASE = "Bus_Passenger_Base";//金旅开沃小巴乘客端
String BUS_PASSENGER_M1 = "Bus_Passenger_M1";//M1小巴乘客端
String BUS_PASSENGER_M2 = "Bus_Passenger_M2";//M2小巴乘客端
String SWEEPER_DRIVER_FT = "Sweeper_Driver_FT";//福田清扫车司机端
}
public void setIdentityMode(String identityMode) {
this.identityMode = identityMode;
}
public void setOnAdasListener(OnAdasListener listener) {
this.listener = listener;
}
public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) {
this.onAutopilotAbilityListener = onAutopilotAbilityListener;
}
private AutopilotAbilityManager() {
}
public static AutopilotAbilityManager getInstance() {
if (INSTANCE == null) {
synchronized (AutopilotAbilityManager.class) {
if (INSTANCE == null) {
INSTANCE = new AutopilotAbilityManager();
}
}
}
return INSTANCE;
}
public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
if (handler != null) {
if (handler.hasMessages(WHAT_TIMEOUT))
handler.removeMessages(WHAT_TIMEOUT);
if (AutopilotAbilityManager.getInstance().getHandler() != null) {
if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
}
onCallback(statusInfo);
}
@@ -111,7 +46,7 @@ public class AutopilotAbilityManager {
private void onCallback(SystemStatusInfo.StatusInfo statusInfo) {
//金旅开沃小巴乘客端 不能启动自动驾驶
if (IDENTITY_MODE.BUS_PASSENGER_BASE.equalsIgnoreCase(identityMode)) {
if (AutopilotAbilityManager.getInstance().isBusPassenger()) {
return;
}
boolean isAutopilotAbility = true;//是否能启动自动驾驶
@@ -122,20 +57,7 @@ public class AutopilotAbilityManager {
if (statusInfo.hasMasterVersion()) {
//截取Master Version
String masterVersion = statusInfo.getMasterVersion();
if (!TextUtils.isEmpty(masterVersion)) {
try {
Matcher matcher = pattern.matcher(masterVersion);
if (matcher.find()) {
String group = matcher.group();
if (!TextUtils.isEmpty(group)) {
String v = group.split("\\.")[0];
version = Integer.parseInt(v);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
version = AutopilotAbilityManager.getInstance().parseVersion(false, masterVersion);
}
//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
if (version > 1 && statusInfo.hasAutoPilotReady()) {
@@ -204,24 +126,26 @@ public class AutopilotAbilityManager {
* 档位状态判断 目前判断的车型包括 东风Taxi 红旗Taxi 金旅Bus 金旅M1 金旅M1 福田清扫车 开沃
* TODO 如果 identityMode 未赋值以及目前已知其他车型判断逻辑跟东风Taxi和红旗
*/
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (TextUtils.isEmpty(identityMode)) {
identityMode = "";
}
//开沃任何档位都能启动自驾
if (!IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode)) {
//开沃任何档位都能启动自驾
if (!AutopilotAbilityManager.getInstance().isBusDriverVan()) {
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
//金旅Bus和清扫车 档位不正常
if (IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode) || IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode)) {
if (AutopilotAbilityManager.getInstance().isBusDriver()) {
if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
unableAutopilotReason = "位不正常";
unableAutopilotReason = "位不正常";
}
} else if (AutopilotAbilityManager.getInstance().isSweeperDriverFutian()) {
if (gear == Chassis.GearPosition.GEAR_N) {
isAutopilotAbility = false;
unableAutopilotReason = "档位不正常";
}
} else {
//东风Taxi和红旗 司机端和乘客端 档位不正常
if (gear == Chassis.GearPosition.GEAR_P || gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
unableAutopilotReason = "位不正常";
unableAutopilotReason = "位不正常";
}
}
}
@@ -239,8 +163,8 @@ public class AutopilotAbilityManager {
// }
// }
}
if (listener != null) {
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
if (AutopilotAbilityManager.getInstance().getListener() != null) {
AutopilotAbilityManager.getInstance().getListener().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
}
}
@@ -250,14 +174,14 @@ public class AutopilotAbilityManager {
timer.schedule(new TimerTask() {
@Override
public void run() {
if (onAutopilotAbilityListener != null) {
onAutopilotAbilityListener.onStatusQuery();
if (AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener() != null) {
AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener().onStatusQuery();
}
AdasManager.getInstance().sendStatusQueryReq();
if (handler != null) {
if (handler.hasMessages(WHAT_TIMEOUT))
handler.removeMessages(WHAT_TIMEOUT);
handler.sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
if (AutopilotAbilityManager.getInstance().getHandler() != null) {
if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
AutopilotAbilityManager.getInstance().getHandler().sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
}
}
}, 2000L, DEFAULT_DETECTION_TIME);//延迟执行避免刚连接成功后底盘信息无法及时同步
@@ -269,18 +193,15 @@ public class AutopilotAbilityManager {
timer.cancel();
timer = null;
}
handler = null;
this.chassisStates = null;
}
public void setHandler(Handler handler) {
this.handler = handler;
}
public void onHandleMessage(Message msg) {
if (msg.what == WHAT_TIMEOUT) {
onCallback(null);
}
}
}

View File

@@ -0,0 +1,274 @@
package com.zhidao.support.adas.high.common.autopilot.ability;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.Constants;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import java.util.Timer;
import java.util.TimerTask;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import chassis.ChassisStatesOuterClass;
import mogo.telematics.pad.MessagePad;
import system_master.SystemStatusInfo;
/**
* 是否可以启动自动驾驶能力检测
* 目前监控了底盘的一些状态和查询节点状态应答的数据
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
* <p>
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/
public class AutopilotAbilityManager {
private static final String TAG = AutopilotAbilityManager.class.getSimpleName();
private static volatile AutopilotAbilityManager INSTANCE;
private OnAdasListener listener;
private final Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
private Handler handler;
private OnAutopilotAbilityListener onAutopilotAbilityListener;
private int dockerVersion = -1;//工控机版本
private AutopilotAbility230 autopilotAbility230;
private AutopilotAbility250 autopilotAbility250;
private Timer startTimer;
/**
* 身份/车型
*/
private String identityMode;
public interface OnAutopilotAbilityListener {
void onStatusQuery();//查询是被调用
}
/**
* 身份规则定义根据app/productFlavors/README.md
* * taxi司机屏 Taxi_Driver_Base (东风、红旗司机端)
* * taxi乘客屏 Taxi_Passenger_Base (东风、红旗乘客端)
* * bus司机屏 Bus_Driver_Base (金旅小巴司机端)
* * Bus_Driver_Van (开沃小巴司机端)
* * bus乘客屏 Bus_Passenger_Base (金旅、开沃小巴乘客端)
* * Bus_Passenger_M1 M1小巴乘客端
* * Bus_Passenger_M2 M2小巴乘客端
* * 清扫车 Sweeper_Driver_FT (福田清扫车司机端)
* <p>
* 此定义不区分角色,只区分业务线和车型
*/
private interface IDENTITY_MODE {
String TAXI_DRIVER_BASE = "Taxi_Driver_Base";//(东风、红旗司机端)
String TAXI_PASSENGER_BASE = "Taxi_Passenger_Base";//(东风、红旗乘客端)
String BUS_DRIVER_BASE = "Bus_Driver_Base";//(金旅小巴司机端)
String BUS_DRIVER_VAN = "Bus_Driver_Van";//(开沃小巴司机端)
String BUS_PASSENGER_BASE = "Bus_Passenger_Base";//(金旅、开沃小巴乘客端)
String BUS_PASSENGER_M1 = "Bus_Passenger_M1";//M1小巴乘客端
String BUS_PASSENGER_M2 = "Bus_Passenger_M2";//M2小巴乘客端
String SWEEPER_DRIVER_FT = "Sweeper_Driver_FT";//(福田清扫车司机端)
}
private AutopilotAbilityManager() {
}
public static AutopilotAbilityManager getInstance() {
if (INSTANCE == null) {
synchronized (AutopilotAbilityManager.class) {
if (INSTANCE == null) {
INSTANCE = new AutopilotAbilityManager();
}
}
}
return INSTANCE;
}
public void setIdentityMode(String identityMode) {
this.identityMode = identityMode;
}
public void setCarConfig(MessagePad.CarConfigResp carConfig) {
if (dockerVersion == -1) {
String v = carConfig.getDockVersion();
int version = parseVersion(true, v);
if (version != -1) {
stopTimer();
dockerVersion = version;
Log.i("dddd", "工控机版本=" + dockerVersion);
initAutopilotAbility();
}
}
}
public void setOnAdasListener(OnAdasListener listener) {
this.listener = listener;
}
public OnAdasListener getListener() {
return listener;
}
public void setHandler(Handler handler) {
this.handler = handler;
}
public Handler getHandler() {
return handler;
}
public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) {
this.onAutopilotAbilityListener = onAutopilotAbilityListener;
}
public OnAutopilotAbilityListener getOnAutopilotAbilityListener() {
return onAutopilotAbilityListener;
}
public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
if (autopilotAbility250 != null) {
autopilotAbility250.setStatusInfo(statusInfo);
}
}
public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
if (autopilotAbility230 != null) {
autopilotAbility230.setChassisStates(chassisStates);
}
if (autopilotAbility250 != null) {
autopilotAbility250.setChassisStates(chassisStates);
}
}
public void onHandleMessage(Message msg) {
if (autopilotAbility250 != null) {
autopilotAbility250.onHandleMessage(msg);
}
}
private void initAutopilotAbility() {
if (dockerVersion >= 250) {
stop230();
if (autopilotAbility250 == null) {
autopilotAbility250 = new AutopilotAbility250();
autopilotAbility250.start();
}
} else {
stop250();
if (autopilotAbility230 == null) {
autopilotAbility230 = new AutopilotAbility230();
autopilotAbility230.start();
}
}
}
private void stop230() {
if (autopilotAbility230 != null) {
autopilotAbility230.stop();
autopilotAbility230 = null;
}
}
private void stop250() {
if (autopilotAbility250 != null) {
autopilotAbility250.stop();
autopilotAbility250 = null;
}
}
private void stopTimer() {
if (startTimer != null) {
startTimer.cancel();
startTimer = null;
}
}
/**
* 连接工控机成功调用此函数如果dockerVersion还未获取到将启动最低版本的启动自动驾驶能力检测
* 此函数为保险措施 以防无法获取工控机版本时 也能 正常执行逻辑
*/
public synchronized void start() {
if (startTimer == null) {
startTimer = new Timer();
startTimer.schedule(new TimerTask() {
@Override
public void run() {
if (dockerVersion == -1 && AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
dockerVersion = 230;
initAutopilotAbility();
}
}
}, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步
}
}
public synchronized void stop() {
stopTimer();
stop230();
stop250();
handler = null;
dockerVersion = -1;
}
/**
* 解析版本 格式 xxx.xxx.xxx(x的数量不固定)
*
* @param isUserAll 是否使用全部截取数据 true表示 12.34.56 截取之后 123456 false表示12.34.56 截取之后 12
* @param ver 版本字符串
* @return -1表示解析失败
*/
public int parseVersion(boolean isUserAll, String ver) {
int version = -1;
if (!TextUtils.isEmpty(ver)) {
try {
Matcher matcher = pattern.matcher(ver);
if (matcher.find()) {
String group = matcher.group();
if (!TextUtils.isEmpty(group)) {
if (isUserAll) {
group = group.replace(".", "");
} else {
group = group.split("\\.")[0];
}
version = Integer.parseInt(group);
}
}
} catch (Exception e) {
CupidLogUtils.e(TAG, "版本解析失败=" + ver, e);
}
}
return version;
}
/**
* 金旅、开沃小巴乘客端
*/
public boolean isBusPassenger() {
return IDENTITY_MODE.BUS_PASSENGER_BASE.equalsIgnoreCase(identityMode);
}
/**
* 开沃小巴司机端
*/
public boolean isBusDriverVan() {
return IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode);
}
/**
* 金旅小巴司机端
*/
public boolean isBusDriver() {
return IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode);
}
/**
* 福田清扫车司机端
*/
public boolean isSweeperDriverFutian() {
return IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode);
}
}

View File

@@ -7,6 +7,7 @@ import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.AdasManager;
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 mogo.telematics.pad.MessagePad;
@@ -20,6 +21,7 @@ public class CarConfigRespMessage extends MyAbstractMessageHandler {
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
MessagePad.CarConfigResp carConfigResp = MessagePad.CarConfigResp.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
AdasChannel.calculateTimeConsumingOnDispatchRaw("车机基础信息应答", raw.receiveTime);
AutopilotAbilityManager.getInstance().setCarConfig(carConfigResp);
AdasManager.getInstance().setCarConfig(carConfigResp);
long nowTime = 0;
if (CupidLogUtils.isEnableLog())

View File

@@ -2,7 +2,7 @@ package com.zhidao.support.adas.high.msg;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData;
import chassis.ChassisStatesOuterClass;

View File

@@ -5,7 +5,7 @@ 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.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.protocol.RawData;

View File

@@ -5,7 +5,7 @@ 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.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.protocol.RawData;
@@ -141,7 +141,7 @@ public class VehicleStateMessage extends MyAbstractMessageHandler {
ChassisStatesOuterClass.GearSystemStates.Builder gearSystemStates = null;
if (vehicleState.hasGear()) {
gearSystemStates = ChassisStatesOuterClass.GearSystemStates.newBuilder();
//挂挡档位数据
//档位数据
gearSystemStates.setGearPosition(vehicleState.getGear());//鹰眼已用
}
if (vehicleState.hasGearSwitchInference()) {

View File

@@ -2,4 +2,6 @@ package com.mogo.map.hdcache
interface IHdCacheListener {
fun onMapHdCacheProgress(cityId: Int, progress: Double)
fun onMapHdCacheResult(cityId: Int, state: Int)// 0失败1成功
}

View File

@@ -358,4 +358,6 @@ public interface IMogoMapUIController {
* @return
*/
boolean isCityDataCached();
void cancelDownloadCacheData();
}

Some files were not shown because too many files have changed in this diff Show More