diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index dd79d5f32c..a60f127288 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -6,7 +6,6 @@ import android.os.Handler import android.os.Looper import android.os.Message import com.mogo.cloud.commons.utils.CoordinateUtils -import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.data.trafficlight.* import com.mogo.eagle.core.data.v2x.VipMessage import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener @@ -16,7 +15,6 @@ import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerMa import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager import com.mogo.eagle.core.function.v2x.vip.network.VipNetWorkModel -import com.mogo.map.navi.IMogoCarLocationChangedListener2 import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.enums.EventTypeEnum import com.mogo.service.cloud.socket.IMogoOnMessageListener @@ -25,7 +23,7 @@ import com.mogo.utils.logger.Logger import kotlin.math.abs class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListener, - IMogoCarLocationChangedListener2, Handler.Callback { + Handler.Callback { companion object { @@ -55,8 +53,6 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe fun initServer(context: Context) { mContext = context - MogoApisHandler.getInstance() - .apis.registerCenterApi.registerCarLocationChangedListener(TAG, this) MogoApisHandler.getInstance() .apis.getSocketManagerApi(context) .registerOnMessageListener(401025, this) @@ -109,7 +105,10 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe return } if (trafficLightResult.currentRoadTrafficLight() == null) { - Logger.d(TAG, "vip 获取到灯态,但没找到对应车道数据 result : $trafficLightResult , then resetConditions") + Logger.d( + TAG, + "vip 获取到灯态,但没找到对应车道数据 result : $trafficLightResult , then resetConditions" + ) resetConditions() return } @@ -132,7 +131,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe lastResult?.let { //如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗 if (abs(currentResult!!.remain - it.remain) > 5) { - Logger.d(TAG,"调用showWarningV2X to show") + Logger.d(TAG, "调用showWarningV2X to show") CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(), EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, @@ -233,12 +232,15 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe private fun turnLight(controlTime: Int) { result?.let { + val bearing = + MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).lastKnowLocation.bearing.toDouble() + Logger.d(TAG, "turnLight -- bearing : $bearing") MogoTrafficLightManager.INSTANCE.turnLightToGreen( - it.lightId, - it.crossId, - mLocation!!.bearing.toDouble(), controlTime, { + it.lightId, it.crossId, bearing, controlTime, + { Logger.d(TAG, "变灯请求成功") - }, { errorMsg -> + }, + { errorMsg -> Logger.e(TAG, "变灯请求失败 msg : $errorMsg") }) } @@ -250,13 +252,4 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe mContext = null } - override fun onCarLocationChanged(latLng: MogoLatLng?) { - } - - override fun onCarLocationChanged2(latLng: Location?) { - latLng?.let { - mLocation = it - } - } - } \ No newline at end of file diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java index fce687b201..c07448e51f 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java @@ -32,7 +32,7 @@ public class ALocationClient implements IMogoLocationClient { private static final String TAG = "ALocationClient"; private MogoLocation mLastLocation; - private LocationListener mListener = new InternalLocationListener(); + private final LocationListener mListener = new InternalLocationListener(); private boolean mIsDestroyed = false;