[6.1.0] code syle

This commit is contained in:
zhongchao
2023-09-25 17:53:46 +08:00
parent 906f9c29f2
commit 741bbf4e8c
9 changed files with 134 additions and 147 deletions

View File

@@ -4,9 +4,9 @@ import android.annotation.SuppressLint
import android.content.Context
import android.net.ConnectivityManager
import android.os.Handler
import android.os.Looper
import com.amap.api.maps.model.LatLng
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.intent.IMogoIntentListener
import com.mogo.commons.module.intent.IntentManager
import com.mogo.commons.module.status.IMogoStatusChangedListener
@@ -31,7 +31,6 @@ import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
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.Logger
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.GsonUtils
@@ -42,11 +41,7 @@ import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult
import com.mogo.och.bus.passenger.bean.BusPassengerStation
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback
import com.mogo.och.bus.passenger.callback.*
import com.mogo.och.bus.passenger.constant.BusPassengerConst
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
@@ -82,7 +77,7 @@ import java.util.concurrent.ConcurrentHashMap
* Created on 2022/3/31
*/
@SuppressLint("StaticFieldLeak")
object BusPassengerModel{
object BusPassengerModel {
private val TAG = BusPassengerModel::class.java.simpleName
private const val MSG_QUERY_BUS_P_STATION = 1001
@@ -105,7 +100,7 @@ object BusPassengerModel{
var mStations: MutableList<BusPassengerStation> = ArrayList()
private var mNextStationIndex = 0 // 要到达站的index
private val mTwoStationsRouts: MutableList<MogoLocation> = ArrayList()
private val handler = Handler(Handler.Callback { msg ->
private val handler = Handler(Looper.getMainLooper(), Handler.Callback { msg ->
if (msg.what == MSG_QUERY_BUS_P_STATION) {
queryDriverOperationStatus()
return@Callback true
@@ -119,7 +114,6 @@ object BusPassengerModel{
fun init(context: Context) {
mContext = context.applicationContext
initListeners()
// TODO: 2022/3/31
queryDriverOperationStatus()
startOrStopOrderLoop(true)
}
@@ -150,8 +144,8 @@ object BusPassengerModel{
"queryDriverOperationStatus = %s",
data.data.plateNumber
)
mDriverStatusCallback!!.changeOperationStatus(data.data.driverStatus == 1)
mDriverStatusCallback!!.updatePlateNumber(data.data.plateNumber)
mDriverStatusCallback?.changeOperationStatus(data.data.driverStatus == 1)
mDriverStatusCallback?.updatePlateNumber(data.data.plateNumber)
}
}
@@ -182,9 +176,7 @@ object BusPassengerModel{
mNextStationIndex = 0
}
cleanStation("queryDriverSiteByCoordinate")
if (mRouteLineInfoCallback != null) {
mRouteLineInfoCallback!!.showNoTaskView()
}
mRouteLineInfoCallback?.showNoTaskView()
mRoutePoints.clear()
return
}
@@ -219,9 +211,12 @@ object BusPassengerModel{
private fun updatePassengerRouteInfo(result: BusPassengerRoutesResult) {
if (mRouteLineInfoCallback != null) {
Logger.d(M_BUS_P + TAG, "order = BusPassengerRoutesResult= " +GsonUtil.jsonFromObject(result))
mRouteLineInfoCallback!!.updateLineInfo(result.name, result.runningDur)
mRouteLineInfoCallback!!.hideNoTaskView()
d(
M_BUS_P + TAG,
"order = BusPassengerRoutesResult= " + GsonUtil.jsonFromObject(result)
)
mRouteLineInfoCallback?.updateLineInfo(result.name, result.runningDur)
mRouteLineInfoCallback?.hideNoTaskView()
if (result.sites != null) {
val stations = result.sites
mStations.clear()
@@ -229,9 +224,9 @@ object BusPassengerModel{
for (i in stations.indices) {
val station = stations[i]
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && station.isLeaving && i + 1 < stations.size) { //离站
Logger.d(M_BUS_P + TAG, "order = station= leave")
d(M_BUS_P + TAG, "order = station= leave")
isGoingToNextStation = true
mRouteLineInfoCallback!!.updateStationsInfo(stations, i + 1, false)
mRouteLineInfoCallback?.updateStationsInfo(stations, i + 1, false)
if (mNextStationIndex != i + 1) {
mTwoStationsRouts.clear()
}
@@ -250,9 +245,9 @@ object BusPassengerModel{
suspendCalculate()
Logger.d(M_BUS_P + TAG, "order = station= arrive")
d(M_BUS_P + TAG, "order = station= arrive")
mRouteLineInfoCallback!!.updateStationsInfo(stations, i, true)
mRouteLineInfoCallback?.updateStationsInfo(stations, i, true)
clearAutopilotControlParameters()
return
}
@@ -386,17 +381,17 @@ object BusPassengerModel{
override fun distanceCallback(distance: Float) {
val lastTime: Double = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
d(M_BUS_P + TAG, "轨迹排查==lastSumLength = $distance")
for (site in routesResult!!.sites) {
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
return
routesResult?.let {
for (site in it.sites) {
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
return
}
}
}
if (mAutopilotPlanningCallback != null) {
mAutopilotPlanningCallback!!.routePlanningToNextStationChanged(
distance.toLong(),
lastTime.toLong()
)
}
mAutopilotPlanningCallback?.routePlanningToNextStationChanged(
distance.toLong(),
lastTime.toLong()
)
}
}
private val trajectoryListener: ITrajectoryListener =
@@ -407,19 +402,19 @@ object BusPassengerModel{
location: MogoLocation
) {
if (mAutopilotPlanningCallback != null) {
val routeArriviedTemp: MutableList<LatLng> = ArrayList()
val routeArrivedTemp: MutableList<LatLng> = ArrayList()
val routeArrivingTemp: MutableList<LatLng> = ArrayList()
var temp: LatLng
for (mogoLocation in routeArrivied) {
temp = LatLng(mogoLocation.latitude, mogoLocation.longitude)
routeArriviedTemp.add(temp)
routeArrivedTemp.add(temp)
}
for (mogoLocation in routeArriving) {
temp = LatLng(mogoLocation.latitude, mogoLocation.longitude)
routeArrivingTemp.add(temp)
}
mAutopilotPlanningCallback!!.routeResult(
routeArriviedTemp,
mAutopilotPlanningCallback?.routeResult(
routeArrivedTemp,
routeArrivingTemp,
location
)
@@ -428,16 +423,14 @@ object BusPassengerModel{
}
private val mReceivedMsgListener: IReceivedMsgListener = object : IReceivedMsgListener {
override fun onReceivedServerSn(sn: String?) {
Logger.d(M_BUS_P + TAG, "onReceivedServerSn = $sn")
if (mDriverStatusCallback != null) {
mDriverStatusCallback!!.updateDriverSn(sn)
}
d(M_BUS_P + TAG, "onReceivedServerSn = $sn")
mDriverStatusCallback?.updateDriverSn(sn)
}
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
if (OchCommonConst.BUSINESS_STRING == type) {
val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
Logger.d(
d(
M_BUS_P + TAG,
"onReceivedMsg = " + GsonUtils.toJson(baseMsg)
)
@@ -493,27 +486,29 @@ object BusPassengerModel{
private var arriveAtEnd = false //乘客app专用字段
override fun onAutopilotStatusResponse(state: Int) {
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
mADASStatusCallback?.onAutopilotRunning()
} else {
if (FunctionBuildConfig.isDemoMode &&
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1
&& isGoingToNextStation){
mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1
&& isGoingToNextStation
) {
d(M_BUS_P + TAG, "FunctionBuildConfig.isDemoMode is true")
return
}
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
mTwoStationsRouts.clear()
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotEnable()
mADASStatusCallback?.onAutopilotEnable()
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
mTwoStationsRouts.clear()
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotDisable()
mADASStatusCallback?.onAutopilotDisable()
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
mTwoStationsRouts.clear()
if (mADASStatusCallback != null) mADASStatusCallback!!.onAutopilotRunning()
mADASStatusCallback?.onAutopilotRunning()
}
}
}
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivalNotification?) {
if (FunctionBuildConfig.isDemoMode
&& isPassenger(FunctionBuildConfig.appIdentityMode)
@@ -521,13 +516,10 @@ object BusPassengerModel{
arriveAtEnd = true
}
// TODO: 2022/3/31
if (DebugConfig.isDebug()) {
// ToastUtils.showShort("到达目的地");
}
if (mADASStatusCallback != null) {
mADASStatusCallback!!.onAutopilotArriveEnd()
}
// if (DebugConfig.isDebug()) {
// ToastUtils.showShort("到达目的地");
// }
mADASStatusCallback?.onAutopilotArriveEnd()
}
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
@@ -548,7 +540,8 @@ object BusPassengerModel{
fun updateRoutePoints(routePoints: List<MessagePad.Location>) {
mRoutePoints.clear()
val latLngModels: List<MogoLocation> = coordinateConverterWgsToGcjLocations(mContext, routePoints)
val latLngModels: List<MogoLocation> =
coordinateConverterWgsToGcjLocations(mContext, routePoints)
mRoutePoints.addAll(latLngModels)
calculateTwoStationsRoute()
}
@@ -589,9 +582,7 @@ object BusPassengerModel{
val sumLength = calculateRouteSumLength(mTwoStationsRouts)
SharedPrefsMgr.getInstance(mContext!!)
.putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS, sumLength.toInt())
if (mAutopilotPlanningCallback != null) {
mAutopilotPlanningCallback!!.updateTotalDistance()
}
mAutopilotPlanningCallback?.updateTotalDistance()
}
}
}
@@ -619,7 +610,7 @@ object BusPassengerModel{
setStationPoint(startStation, endStation, lineId.toLong())
}
fun cleanStation(type:String) {
fun cleanStation(type: String) {
d(M_BUS_P + TAG, "清理站点 $type")
setStationPoint(null, null, -1L)
}

View File

@@ -152,8 +152,8 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
}
@Override
public void routeResult(List<LatLng> routeArrivied,List<LatLng> routeArriving,MogoLocation location) {
runOnUIThread(() ->mView.routeResult(routeArrivied,routeArriving,location));
public void routeResult(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
runOnUIThread(() ->mView.routeResult(routeArrived,routeArriving,location));
}
@Override

View File

@@ -4,7 +4,6 @@ import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.widget.RelativeLayout
import com.amap.api.maps.AMap
@@ -56,7 +55,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
private var mArrivedRes: BitmapDescriptor? = null
private var mUnArrivedRes: BitmapDescriptor? = null
private val routeArrivied: MutableList<LatLng> = ArrayList()
private val routeArrived: MutableList<LatLng> = ArrayList()
private val routeArriving: MutableList<LatLng> = ArrayList()
private var location: MogoLocation? = null
@@ -165,7 +164,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
try {
//圈定地图显示范围
val boundsBuilder = LatLngBounds.Builder()
routeArrivied.forEach {
routeArrived.forEach {
boundsBuilder.include(it)
}
routeArriving.forEach {
@@ -190,26 +189,28 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
}
override fun drawablePolyline() {
if (routeArrivied.isEmpty() && routeArriving.isEmpty()) {
if (routeArrived.isEmpty() && routeArriving.isEmpty()) {
d(SceneConstant.M_TAXI + TAG, "没有点")
return
}
texIndexList.clear()
val allPoints = ArrayList(routeArrivied)
for (i in routeArrivied.indices) {
if (routeArrivied.size > 1 && i < routeArrivied.size - 1) {
val allPoints = ArrayList(routeArrived)
for (i in routeArrived.indices) {
if (routeArrived.size > 1 && i < routeArrived.size - 1) {
texIndexList.add(0)
}
}
texIndexList.add(0)
allPoints.add(LatLng(location!!.latitude, location!!.longitude))
location?.let {
allPoints.add(LatLng(it.latitude, it.longitude))
}
allPoints.addAll(routeArriving)
for (ignored in routeArrivied) {
for (ignored in routeArrived) {
texIndexList.add(1)
}
if (mPolyline != null) {
mPolyline!!.points = allPoints
mPolyline!!.options.customTextureIndex = texIndexList
mPolyline?.let {
it.points = allPoints
it.options.customTextureIndex = texIndexList
return
}
if(textureList.isEmpty()) {
@@ -231,10 +232,8 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
}
override fun clearPolyline() {
if (mPolyline != null) {
mPolyline!!.remove()
mPolyline = null
}
mPolyline?.remove()
mPolyline = null
}
override fun setLineMarker() {}
@@ -242,7 +241,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
fun clearCoordinatesLatLng() {
textureList.clear()
texIndexList.clear()
routeArrivied.clear()
routeArrived.clear()
routeArriving.clear()
mLineStationLatLng.clear()
d(M_BUS_P + TAG, " mCoordinatesLatLng.clear ")
@@ -265,14 +264,14 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
}
fun setCoordinatesLatLng(
routeArrivied: List<LatLng>?,
routeArriving: List<LatLng>?,
routeArrived: List<LatLng>,
routeArriving: List<LatLng>,
location: MogoLocation?
) {
this.routeArrivied.clear()
this.routeArrivied.addAll(routeArrivied!!)
this.routeArrived.clear()
this.routeArrived.addAll(routeArrived)
this.routeArriving.clear()
this.routeArriving.addAll(routeArriving!!)
this.routeArriving.addAll(routeArriving)
this.location = location
}

View File

@@ -240,9 +240,9 @@ public class BusPassengerRouteFragment extends
}
}
public void routeResult(List<LatLng> routeArrivied,List<LatLng> routeArriving,MogoLocation location) {
if (routeArrivied.size() > 0||routeArriving.size()>0) {
drawablePolyline(routeArrivied,routeArriving,location);
public void routeResult(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
if (routeArrived.size() > 0||routeArriving.size()>0) {
drawablePolyline(routeArrived,routeArriving,location);
} else {
clearMapView();
}
@@ -250,12 +250,10 @@ public class BusPassengerRouteFragment extends
/**
* 绘制
*
* @param coordinates
*/
private void drawablePolyline(List<LatLng> routeArrivied,List<LatLng> routeArriving,MogoLocation location) {
private void drawablePolyline(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
if (mMapDirectionView != null) {
mMapDirectionView.setCoordinatesLatLng(routeArrivied,routeArriving,location);
mMapDirectionView.setCoordinatesLatLng(routeArrived,routeArriving,location);
UiThreadHandler.post(() -> mMapDirectionView.drawablePolyline());
}
}

View File

@@ -1,19 +1,13 @@
package com.mogo.och.bus.passenger.ui
import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.och.bus.passenger.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.bus.passenger.ui.MapAndLiveVideoView.Companion.TAG
import java.lang.Exception
/**
* @author: wangmingjun
@@ -33,7 +27,7 @@ class MapAndLiveVideoView @JvmOverloads constructor(
}
init {
initView()
initView()
}
private fun initView() {
@@ -46,53 +40,54 @@ class MapAndLiveVideoView @JvmOverloads constructor(
viewPager?.addOnPageChangeListener(this)
}
fun setData(list: MutableList<View>){
fun setData(list: MutableList<View>) {
pagerAdapter?.setData(list)
pagerAdapter?.notifyDataSetChanged()
}
fun setItemChangeListener(listener : ChangeItemListener?){
fun setItemChangeListener(listener: ChangeItemListener?) {
changeItemListener = listener
}
fun changeToSecondView(){
if (viewPager?.currentItem == 0){
fun changeToSecondView() {
if (viewPager?.currentItem == 0) {
startPosition = 0
}
viewPager?.currentItem = 1
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
Logger.d(TAG, "onPageScrolled--position = $position")
CallerLogger.d(TAG, "onPageScrolled--position = $position")
}
override fun onPageSelected(position: Int) {
Logger.d(TAG, "onPageSelected--position = $position")
CallerLogger.d(TAG, "onPageSelected--position = $position")
}
var startPosition = 1
override fun onPageScrollStateChanged(state: Int) {
Logger.d(TAG, "onPageScrollStateChanged--state = $state")
CallerLogger.d(TAG, "onPageScrollStateChanged--state = $state")
viewPager?.let {
val position = it.currentItem
if (state == 0) { //静止
if (startPosition == position){
if (position==0){
if (startPosition == position) {
if (position == 0) {
it.currentItem = 1
}else{
} else {
it.currentItem = 0
}
}else{
} else {
changeItemListener?.changeToItem(it.currentItem)
}
}else if (state == 1){ // 开始滑动
} else if (state == 1) { // 开始滑动
startPosition = it.currentItem
}else{
} else {
}
}
}
interface ChangeItemListener{
interface ChangeItemListener {
fun changeToItem(position: Int)
}
}
@@ -101,25 +96,25 @@ class AdvancePagerAdapter : PagerAdapter(),
ViewPager.OnPageChangeListener {
private var views: List<View>? = null
fun setData(views: List<View>?){
fun setData(views: List<View>?) {
this.views = views
}
override fun instantiateItem(container: View, position: Int): Any {
Logger.d(TAG, "instantiateItem--position = $position")
CallerLogger.d(TAG, "instantiateItem--position = $position")
return try {
val currentItem = position % views!!.size
(container as ViewPager).addView(views!![currentItem])
views!![currentItem]
}catch (e: Exception){
} catch (e: Exception) {
container
}
}
override fun getCount(): Int {
return if (views == null){
return if (views == null) {
0
}else{
} else {
views!!.size
}
}
@@ -129,14 +124,14 @@ class AdvancePagerAdapter : PagerAdapter(),
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
// Logger.d(TAG, "onPageScrolled--position = $position")
// CallerLogger.d(TAG, "onPageScrolled--position = $position")
}
override fun onPageSelected(position: Int) {
// Logger.d(TAG, "onPageSelected--position = $position")
// CallerLogger.d(TAG, "onPageSelected--position = $position")
}
override fun onPageScrollStateChanged(state: Int) {
// Logger.d(TAG, "onPageScrollStateChanged--state = $state")
// CallerLogger.d(TAG, "onPageScrollStateChanged--state = $state")
}
}

View File

@@ -140,7 +140,7 @@ class MoGoAutopilotControlProvider :
timer = Timer()
}
// 10s同步一次数据到乘客屏
timer!!.schedule(object : TimerTask() {
timer?.schedule(object : TimerTask() {
override fun run() {
// 同步是否开启美化模式
setDemoMode(FunctionBuildConfig.isDemoMode)
@@ -424,7 +424,7 @@ class MoGoAutopilotControlProvider :
}
override fun cancelAutoPilot() {
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
if (AdasManager.getInstance().ipcConnectionStatus == IPC_CONNECTION_STATUS.CONNECTED) {
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
} else {
CallerLogger.e("$M_D_C$TAG", "车机与工控机链接失败,无法断开自动驾驶")
@@ -687,10 +687,6 @@ class MoGoAutopilotControlProvider :
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
override fun sendBagManagerCmd(bagManagerEntity: BagManagerEntity): Boolean {
val bagManager = BagManagerOuterClass.BagManager

View File

@@ -492,7 +492,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header?,
spatWarningData: ObuScene.SpatWarningData?
) {
CallerObuWarningSpatListenerManager.invokeObuSpatWarning(spatWarningData!!)
spatWarningData?.let {
CallerObuWarningSpatListenerManager.invokeObuSpatWarning(it)
}
}
/**
@@ -505,7 +507,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header?,
rsiWarningData: ObuScene.RsiWarningData?
) {
CallerObuWarningRsiListenerManager.invokeObuRsiWarning(rsiWarningData!!)
rsiWarningData?.let {
CallerObuWarningRsiListenerManager.invokeObuRsiWarning(it)
}
}
/**
@@ -518,7 +522,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header?,
rsmWarningData: ObuScene.RsmWarningData?
) {
CallerObuWarningRsmListenerManager.invokeObuRsmWarning(rsmWarningData!!)
rsmWarningData?.let {
CallerObuWarningRsmListenerManager.invokeObuRsmWarning(it)
}
}
/**
@@ -528,7 +534,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
* @param mapMatchData 数据
*/
override fun onObuMapMath(header: MessagePad.Header?, mapMatchData: ObuScene.MapMatchData?) {
CallerObuMapMathListenerManager.invokeObuMapMath(mapMatchData!!)
mapMatchData?.let {
CallerObuMapMathListenerManager.invokeObuMapMath(it)
}
}
/**

View File

@@ -332,7 +332,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participant != null) {
var v2xType = when (rsmWarningData.participant.ptcType) {
val v2xType = when (rsmWarningData.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
}
@@ -434,12 +434,12 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
fun onMogoObuDcSpatWarning(spatWarningData: ObuScene.SpatWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}"
"onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData.status} --lightsList = ${spatWarningData.lightsList}"
)
handlerTrafficLight(
spatWarningData!!.warningType,
spatWarningData?.status,
spatWarningData?.lightsList
spatWarningData.warningType,
spatWarningData.status,
spatWarningData.lightsList
)
}
@@ -520,7 +520,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuShowConstants.STATUS.ADD,
MogoObuShowConstants.STATUS.UPDATE
-> {
if (lights != null && lights.isNotEmpty()) {
if (lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
}

View File

@@ -65,8 +65,8 @@ object TrafficMarkerDrawer {
* 更新识别数据,V2V预警的时候需要修改车辆颜色
*/
fun updateITrafficInfo(trafficData: TrafficData) {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
trafficData.uuid?.let {
mTrafficMap[it] = trafficData
}
}
@@ -85,12 +85,12 @@ object TrafficMarkerDrawer {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
trafficData.uuid?.let {
mTrafficMap[it] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
trafficData.uuid?.let {
mTrafficMap[it] = trafficData
}
}
}
@@ -111,12 +111,12 @@ object TrafficMarkerDrawer {
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
tempTraffic.threatLevel = trafficData.threatLevel
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
trafficData.uuid?.let {
mTrafficMap[it] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
trafficData.uuid?.let {
mTrafficMap[it] = trafficData
}
}
}
@@ -197,8 +197,8 @@ object TrafficMarkerDrawer {
// 缓存3D资源
mMarkerCachesResMd5Values[resIdVal] = options.resName ?: "" // 缓存数据
if (trafficData.uuid != null) {
mMarkersCaches[trafficData.uuid!!] = point
trafficData.uuid?.let {
mMarkersCaches[it] = point
}
}