[dev_arch_opt_3.0]
[Change] [ 1、更替项目中用到的高德地图的地方,使用IMoGoChassisLocationGCJ02Listener ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -4,29 +4,30 @@ import android.util.Log
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_GREEN
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnum
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
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.data.trafficlight.*
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
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.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
|
||||
import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnum
|
||||
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.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.util.LocationUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.floor
|
||||
@@ -34,7 +35,7 @@ import kotlin.math.min
|
||||
|
||||
|
||||
class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
IMoGoMapLocationListener {
|
||||
IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
private var vip: Boolean = false
|
||||
|
||||
@@ -44,7 +45,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
// 是否已进入到路口(停止线处)
|
||||
private var isEnter = false
|
||||
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var mLocation: MessagePad.GnssInfo? = null
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -84,7 +85,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
|
||||
fun listenTrafficLight() {
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
|
||||
CallVipSetListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
// 路口100m闯红灯预警
|
||||
mLocation?.let {
|
||||
// 单位m/s
|
||||
val speed = it.speed
|
||||
val speed = it.vehicleSpeed
|
||||
// 车停止或者速度非常慢,可能返回负数或者很小的值,需要过滤
|
||||
CallerLogger.d("$M_V2X$TAG", "speed is:$speed")
|
||||
if (speed <= 2.5f) return// 小于等于9km/h不处理
|
||||
@@ -208,9 +209,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
|
||||
V2XMsg(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.content,
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.tts)
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.tts
|
||||
)
|
||||
)
|
||||
)
|
||||
CallerHmiManager.warningV2X(
|
||||
@@ -246,9 +249,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
V2XMsg(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
content,
|
||||
tts)
|
||||
tts
|
||||
)
|
||||
)
|
||||
)
|
||||
CallerHmiManager.warningV2X(
|
||||
@@ -270,11 +275,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
fun onDestroy() {
|
||||
CallVipSetListenerManager.removeListener(TAG)
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
CallerMapLocationListenerManager.removeListener(TAG,false)
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
location?.let {
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
|
||||
gnssInfo?.let {
|
||||
mLocation = it
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ import static com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.V2I;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -18,16 +17,18 @@ import com.zhjt.service_biz.BizConfig;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*
|
||||
* @author mogoauto
|
||||
*/
|
||||
public class SpeedLimitDataManager implements IMoGoMapLocationListener {
|
||||
public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
private final static String TAG = "SpeedLimitDataManager";
|
||||
private static SpeedLimitDataManager instance;
|
||||
private MogoLocation mLocation;
|
||||
private MessagePad.GnssInfo mLocation;
|
||||
|
||||
private SpeedLimitDataManager() {
|
||||
}
|
||||
@@ -44,8 +45,8 @@ public class SpeedLimitDataManager implements IMoGoMapLocationListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
|
||||
mLocation = location;
|
||||
public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) {
|
||||
mLocation = gnssInfo;
|
||||
}
|
||||
|
||||
private class SpeedTimerTask extends TimerTask {
|
||||
@@ -61,7 +62,7 @@ public class SpeedLimitDataManager implements IMoGoMapLocationListener {
|
||||
@BizConfig(biz = V2I, dependentBizNode = "", bizNode = BIZ_SLW)
|
||||
private void getSpeedLimit() {
|
||||
if (!isShowObuLimitSpeedView) {
|
||||
int speedLimit = CallerMapUIServiceManager.INSTANCE.getMapUIController().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), mLocation.getBearing());
|
||||
int speedLimit = CallerMapUIServiceManager.INSTANCE.getMapUIController().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
|
||||
UiThreadHandler.post(() -> {
|
||||
if (speedLimit > 0) {
|
||||
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit);
|
||||
@@ -73,7 +74,7 @@ public class SpeedLimitDataManager implements IMoGoMapLocationListener {
|
||||
}
|
||||
|
||||
public void start() {
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
|
||||
CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
Timer mTimer = new Timer();
|
||||
mTimer.schedule(new SpeedTimerTask(), 3000, 1000);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.mogo.eagle.core.function.v2x.trafficlight.core
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
|
||||
@@ -17,8 +16,9 @@ import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHand
|
||||
import com.mogo.eagle.core.function.v2x.trafficlight.network.TrafficLightNetWorkModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -31,7 +31,7 @@ class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
|
||||
private var mContext: Context? = null
|
||||
private val trafficLightNetWorkModel = TrafficLightNetWorkModel()
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var mLocation: MessagePad.GnssInfo? = null
|
||||
private var roadIDResult: RoadIDResult? = null
|
||||
private var trafficLightResult: TrafficLightResult? = null
|
||||
|
||||
@@ -42,7 +42,7 @@ class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
|
||||
mThreadHandler =
|
||||
TrafficLightThreadHandler(Looper.getMainLooper(), {
|
||||
//第一次查询路口时,如果红绿灯显示,则隐藏掉
|
||||
@@ -55,7 +55,7 @@ class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
val tileId = CallerMapUIServiceManager.getMapUIController()
|
||||
?.getTileId(it.longitude, it.latitude) ?: 0
|
||||
trafficLightNetWorkModel.requestRoadID(
|
||||
tileId, it.latitude, it.longitude, it.bearing.toDouble(),
|
||||
tileId, it.latitude, it.longitude, it.heading,
|
||||
{
|
||||
mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD)
|
||||
roadIDResult = it
|
||||
@@ -75,7 +75,7 @@ class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
val road =
|
||||
if (roadIDResult?.rsCrossId.isNullOrBlank()) "" else roadIDResult?.rsCrossId
|
||||
trafficLightNetWorkModel.requestTrafficLight(
|
||||
it.latitude, it.longitude, it.bearing.toDouble(), road, { result ->
|
||||
it.latitude, it.longitude, it.heading, road, { result ->
|
||||
trafficLightResult = result
|
||||
// TrafficLightHMIManager.INSTANCE.updateTrafficLight(result)
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightStatus(result)
|
||||
@@ -173,13 +173,6 @@ class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
)
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
location?.let {
|
||||
mLocation = it
|
||||
checkOutOfRange()
|
||||
}
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
mThreadHandler = null
|
||||
mContext = null
|
||||
@@ -187,5 +180,12 @@ class MogoTrafficLightManager : IMoGoMapLocationListener {
|
||||
trafficLightResult = null
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
|
||||
gnssInfo?.let {
|
||||
mLocation = it
|
||||
checkOutOfRange()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user