eagle_1030 限速标识 接入hmi
This commit is contained in:
@@ -55,23 +55,15 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLimitingVelocity"
|
||||
android:layout_width="130px"
|
||||
android:layout_height="130px"
|
||||
android:layout_marginTop="30px"
|
||||
android:background="@drawable/bg_waring_limiting_velocity"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:text="60"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="74px"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewTrafficLightVr"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewTrafficLightVr"
|
||||
app:layout_goneMarginEnd="40px"
|
||||
app:layout_goneMarginTop="40px"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.SpeedLimitStatusView-->
|
||||
<!-- android:id="@+id/viewSpeedLimitStatusView"-->
|
||||
<!-- android:layout_width="130px"-->
|
||||
<!-- android:layout_height="130px"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@+id/viewTrafficLightVr"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/viewTrafficLightVr"-->
|
||||
<!-- tools:ignore="MissingConstraints"/>-->
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.PerspectiveSwitchView
|
||||
android:id="@+id/viewPerspectiveSwitch"
|
||||
@@ -104,4 +96,23 @@
|
||||
app:layout_constraintEnd_toStartOf="@id/viewTrafficLightVr"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLimitingVelocity"
|
||||
android:layout_width="130px"
|
||||
android:layout_height="130px"
|
||||
android:layout_marginTop="30px"
|
||||
android:background="@drawable/bg_waring_limiting_velocity"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:text="60"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="74px"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewTrafficLightVr"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
|
||||
app:layout_goneMarginEnd="40px"
|
||||
app:layout_goneMarginTop="40px"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_V2X_MODULE
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightManager
|
||||
import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDataManager
|
||||
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
|
||||
|
||||
@Route(path = PATH_V2X_MODULE)
|
||||
@@ -16,6 +17,7 @@ class V2XProvider : IMoGoFunctionServerProvider {
|
||||
override fun init(context: Context) {
|
||||
CallTrafficLightManager.getTrafficLightProvider().initTrafficLightServer(context)
|
||||
VipCarManager.INSTANCE.initServer(context)
|
||||
SpeedLimitDataManager.getInstance().start();
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.mogo.eagle.core.function.v2x.speedlimit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class SpeedLimitDataManager implements IMogoCarLocationChangedListener2 {
|
||||
|
||||
private static SpeedLimitDataManager instance ;
|
||||
private Location mLocation;
|
||||
// private static Context mContext;
|
||||
private Timer mTimer;
|
||||
private SpeedLimitDataManager(){
|
||||
}
|
||||
public static SpeedLimitDataManager getInstance(){
|
||||
if (instance == null){
|
||||
synchronized (SpeedLimitDataManager.class){
|
||||
if (instance == null){
|
||||
instance = new SpeedLimitDataManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
private class SpeedTimerTask extends TimerTask{
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLocation != null){
|
||||
int speedLimmit = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getSpeedLimmit(mLocation.getLongitude(),mLocation.getLatitude(),mLocation.getBearing());
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int speed = (int) (mLocation.getSpeed() * 3.6f);
|
||||
Logger.e("lianglihui","SpeedTimerTask : "+ speed+" - "+ speedLimmit);
|
||||
if (speed > speedLimmit){
|
||||
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimmit);
|
||||
}else {
|
||||
CallerHmiManager.INSTANCE.disableLimitingVelocity();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void start(){
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerCarLocationChangedListener("SpeedLimitDataManager",this);
|
||||
mTimer = new Timer();
|
||||
mTimer.schedule(new SpeedTimerTask(), new Date(),1000);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
mLocation = latLng;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user