Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into mutidev_robotaxi-d-app-module_2130_221116_2.13.0_multi_display

# Conflicts:
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
This commit is contained in:
donghongyu
2022-11-29 18:06:42 +08:00
44 changed files with 1223 additions and 820 deletions

View File

@@ -570,10 +570,11 @@ class DebugSettingView @JvmOverloads constructor(
}
}
Log.i(
"1026-emArrow",
"debug setting FunctionBuildConfig.isDemoMode : ${FunctionBuildConfig.isDemoMode}"
)
btnDrawFusion.isChecked = FunctionBuildConfig.isFusionColor
btnDrawFusion.setOnCheckedChangeListener{_, isChecked ->
FunctionBuildConfig.isFusionColor = isChecked
}
// 演示模式,上一次勾选的数据
tbIsDemoMode.isChecked = FunctionBuildConfig.isDemoMode

View File

@@ -4,6 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.temp.EventLogout
import com.mogo.eagle.core.function.api.hmi.view.IOchBusView
import com.mogo.eagle.core.function.hmi.R
@@ -31,6 +32,14 @@ class BusOperationView @JvmOverloads constructor(
clickPersonalRightView();
}
private fun initPersonalIcon() {
if("fPadLenovoOchTaxi" == DebugConfig.getProductFlavor()){
ivGotoPersonalInfo.visibility = VISIBLE
}else{
ivGotoPersonalInfo.visibility = GONE
}
}
private fun clickPersonalRightView() {
ivGotoPersonalInfo.onClick {
EventBus.getDefault().post(EventLogout(EventLogout.PERSONAL_TYPE))
@@ -39,6 +48,7 @@ class BusOperationView @JvmOverloads constructor(
override fun showBusOperation() {
ochBusOperationStatus.visibility = View.VISIBLE
initPersonalIcon()
}
override fun changerOperationStatus(isOut: Boolean) {

View File

@@ -62,7 +62,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
if (directionLight == 1 || directionLight == 2) {
if (!isVisualAngleChanged) {
isVisualAngleChanged = true
CallerVisualAngleManager.changeVisualAngle(Turning)
CallerVisualAngleManager.changeVisualAngle(Turning(true))
}
}
@@ -96,7 +96,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
} else { //消失
if (isVisualAngleChanged) {
isVisualAngleChanged = false
CallerVisualAngleManager.changeVisualAngle(Default())
CallerVisualAngleManager.changeVisualAngle(Turning(false))
}
if (!isDisappare) {
isDisappare = true

View File

@@ -36,6 +36,7 @@ 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.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;
@@ -68,6 +69,20 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private BluetoothMonitorReceiver mBluetoothReceiver = null;
private BluetoothAdapter mBluetoothAdapter;
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;
@Override
@@ -225,24 +240,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
return super.onKeyDown(keyCode, event);
}
private long startPressTime = 0; //开始按减时间
private boolean isPressEnd = false; //按键是否结束
private boolean isCombinationKey = false; //是否是组合按键
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;
/**
* 魔方按键分发 提测前注释 ToastUtils TODO
* 魔方按键分发
*
* @param event
* @return
@@ -264,26 +263,40 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis();
Log.d(TAG, "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
if ((pressADownTime - startPressTime) > 320 && (pressADownTime - startPressTime) < 1600 && pressBDownTime > 0) {
ToastUtils.showShort("方块 A 按AB组合 -2 ");
if ((pressADownTime - startPressTime) > 320 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 -2 ");
}
sendAcc(true, -2);
isCombinationKey = true;
isCombinationKey = 3;
}
if (!isCombinationKey) {
if ((pressADownTime - startPressTime) > 1700) {
ToastUtils.showShort("方块 长按A 无 操作 ");
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressADownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按A 无 操作 ");
}
isCombinationKey = 2;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis();
Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
if ((pressAUpTime - startPressTime) < 300 && !isCombinationKey) {
ToastUtils.showShort("方块 单击A -1 ");
if ((pressAUpTime - startPressTime) < 300 && isCombinationKey != 3) {
isCombinationKey = 1;
if (isShowToast) {
ToastUtils.showShort("方块 单击A -1 ");
}
sendAcc(true, -1);
}
pressADownTime = 0;
isPressEnd = false;
isCombinationKey = false;
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
isCombinationKey = 0;
}
}, 300);
}
return true;
@@ -291,44 +304,59 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressBDownTime = System.currentTimeMillis();
Log.d(TAG, "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
if ((pressBDownTime - startPressTime) > 320 && (pressBDownTime - startPressTime) < 1600 && pressADownTime > 0) {
ToastUtils.showShort("方块 B 按AB组合 ");
if ((pressBDownTime - startPressTime) > 320 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 ");
}
sendAcc(true, -2);
isCombinationKey = true;
isCombinationKey = 3;
}
if (!isCombinationKey) {
if ((pressBDownTime - startPressTime) > 1700) {
ToastUtils.showShort("方块 长按B =1 ");
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressBDownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按B +1 ");
}
sendAcc(true, +1);
isCombinationKey = 2;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressBUpTime = System.currentTimeMillis();
Log.e(TAG, "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
if ((pressBUpTime - startPressTime) < 300 && !isCombinationKey) {
ToastUtils.showShort("方块 单击B 0 ");
if ((pressBUpTime - startPressTime) < 300 && isCombinationKey != 3) {
if (isShowToast) {
ToastUtils.showShort("方块 单击B 0 ");
}
sendAcc(false, 0.0);
isCombinationKey = 1;
}
pressBDownTime = 0;
isPressEnd = false;
isCombinationKey = 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();
if (!isCombinationKey) {
if ((pressCDownTime - startPressTime) > 1700) {
if ((pressCDownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按C 无操作 ");
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressCUpTime = System.currentTimeMillis();
isPressEnd = false;
isCombinationKey = false;
if ((pressCUpTime - startPressTime) < 300) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
}
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
}
}
@@ -336,17 +364,18 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressDDownTime = System.currentTimeMillis();
if (!isCombinationKey) {
if ((pressDDownTime - startPressTime) > 1700) {
if ((pressDDownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按D 无操作 ");
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressDUpTime = System.currentTimeMillis();
isPressEnd = false;
isCombinationKey = false;
if ((pressDUpTime - startPressTime) < 300) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
}
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
@@ -355,28 +384,29 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressEDownTime = System.currentTimeMillis();
if (!isCombinationKey) {
if ((pressEDownTime - startPressTime) > 1700) {
if ((pressEDownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
}
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressEUpTime = System.currentTimeMillis();
isPressEnd = false;
isCombinationKey = false;
if ((pressEUpTime - startPressTime) < 300) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
}
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

View File

@@ -1508,6 +1508,20 @@
app:layout_constraintRight_toLeftOf="@id/btnDrawTrolley"
app:layout_constraintTop_toBottomOf="@id/reset_changesight" />
<ToggleButton
android:id="@+id/btnDrawFusion"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="打开fusion融合颜色替换"
android:textOn="关闭fusion融合颜色替换"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/changesight_cross_btn"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/reset_changesight" />
<Button
android:id="@+id/btnDrawTrolley"
android:layout_width="0dp"
@@ -1862,7 +1876,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/dp_10"
android:text="融合感知数据"
android:text="车端感知数据"
android:textColor="#000"
android:textSize="@dimen/dp_24" />
@@ -1882,7 +1896,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/dp_10"
android:text="融合V2I感知数据"
android:text="V2I感知数据"
android:textColor="#000"
android:textSize="@dimen/dp_24" />
@@ -1892,7 +1906,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/dp_10"
android:text="融合V2N-RSM感知数据"
android:text="V2N-RSM感知数据"
android:textColor="#000"
android:textSize="@dimen/dp_24" />

View File

@@ -63,9 +63,11 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivGotoPersonalInfo"
android:layout_width="@dimen/dp_17"
android:layout_height="@dimen/dp_32"
android:src="@drawable/icon_right"
android:layout_width="@dimen/dp_64"
android:layout_height="@dimen/dp_64"
android:src="@drawable/och_arrow_right"
android:visibility="gone"
android:scaleType="center"
android:layout_marginRight="@dimen/dp_40"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/actvAccountPhone"

View File

@@ -9,9 +9,9 @@ object TrackerSourceColorHelper {
@SuppressLint("NewApi")
fun filterData(data: TrackedObject): Boolean {
if (!FunctionBuildConfig.isDrawUnknownIdentifyData
&& data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
) {
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type
) {
return true
}
var trackIPCFilter = true
@@ -96,7 +96,7 @@ object TrackerSourceColorHelper {
* 是否为融合数据,融合数据来源size >=2
*/
fun isFusion(data: TrackedObject): Boolean {
return data.trackedSourceList.size > 1
return FunctionBuildConfig.isFusionColor && data.trackedSourceList.size > 1
}
/**

View File

@@ -0,0 +1,7 @@
package com.mogo.eagle.core.function.overview
class OverViewConst {
companion object {
const val CLOUD_HOST = "https://eagle-qa.zhidaozhixing.com"
}
}

View File

@@ -0,0 +1,11 @@
package com.mogo.eagle.core.function.overview.remote
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Query
interface OverViewServiceApi {
@GET("/eagleEye-mis/config/queryV2NInformation")
fun queryAllV2XEventsByLineId(@Query("lineId") lineId: String, @Query("sn") sn: String): Observable<V2XEventResult>
}

View File

@@ -0,0 +1,70 @@
package com.mogo.eagle.core.function.overview.remote
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import com.mogo.eagle.core.data.BaseData
@Keep
data class V2XEventResult (
@SerializedName("result")
var result: Result?
): BaseData()
@Keep
data class Result(
@SerializedName("eventList")
var v2XEventList: List<V2XEvent>?
)
@Keep
data class V2XEvent(
@SerializedName("receiveTime")
var receiveTime: Long,
@SerializedName("detectTime")
var detectTime: Long,
@SerializedName("id")
var id: String?,
@SerializedName("center")
var center: Center?,
@SerializedName("centerRoad")
var centerRoad: CenterRoad?,
@SerializedName("radius")
var radius: Double,
@SerializedName("type")
var type: Int
)
@Keep
data class Center(
@SerializedName("lat")
var lat: Double,
@SerializedName("lon")
var lon: Double
)
@Keep
data class CenterRoad(
@SerializedName("bearing")
var bearing: Double,
@SerializedName("laneNo")
var laneNo: Long,
@SerializedName("roadId")
var roadId: String?,
@SerializedName("roadName")
var roadName: String?,
@SerializedName("tileId")
var tileId: Long
)

View File

@@ -1,16 +1,26 @@
package com.mogo.eagle.core.function.overview.vm
import androidx.lifecycle.*
import com.amap.api.maps.model.LatLng
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.function.overview.OverViewConst
import com.mogo.eagle.core.function.overview.OverviewDao
import io.reactivex.disposables.CompositeDisposable
import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi
import com.mogo.eagle.core.function.overview.remote.V2XEvent
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.launch
import java.util.concurrent.TimeUnit
class OverViewModel(
private val overviewDao: OverviewDao
) : ViewModel() {
private val _infStructures = MutableLiveData<List<Infrastructure>>()
private val _V2XEvents = MutableLiveData<List<V2XEvent>>()
private var disposable: Disposable? = null
val infStructures
get() = _infStructures
@@ -64,4 +74,34 @@ class OverViewModel(
}
}
}
fun getAllV2XEventsByLineId(lineId: String, sn: String) {
// 1分钟查询一次
disposable = Observable.interval(0, 60000, TimeUnit.SECONDS)
.flatMap {
MoGoRetrofitFactory.getInstance(OverViewConst.CLOUD_HOST)
.create(OverViewServiceApi::class.java)
.queryAllV2XEventsByLineId(lineId, sn)
.map {
if (it.code == 200 || it.code == 0) {
return@map it.result?.v2XEventList
} else {
return@map null
}
}
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
it?.apply {
_V2XEvents.value = this
}
}
}
fun getV2XEventLiveData() = _V2XEvents
fun stopQueryV2XEvents() {
disposable?.dispose()
}
}

View File

@@ -39,6 +39,8 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.overview.InfStructureManager;
import com.mogo.eagle.core.function.overview.remote.Center;
import com.mogo.eagle.core.function.overview.remote.V2XEvent;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -96,6 +98,8 @@ public class AMapCustomView
private boolean isFirstLocation = true;
CustomMapStyleOptions mCustomMapStyleOptions;
ArrayList<Marker> currMarkerList;
public AMapCustomView(Context context) {
this(context, null);
}
@@ -254,6 +258,51 @@ public class AMapCustomView
});
}
public void showV2XEventMarkers(List<V2XEvent> v2XEvents) {
if (v2XEvents == null || v2XEvents.size() <= 0) return;
ArrayList<MarkerOptions> markerOptionsList = new ArrayList<>();
for (V2XEvent event : v2XEvents) {
if (event.getType() != 10006) {
continue;
}
Center center = event.getCenter();
if (center != null) {
center.getLon();
MarkerOptions markerOption = new MarkerOptions();
LatLng latLng = new LatLng(center.getLat(),
center.getLon());
markerOption.position(latLng);
markerOption.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_warning_v2x_road_construction));
markerOptionsList.add(markerOption);
}
}
if (markerOptionsList.size() > 0) {
drawV2XMarkers(markerOptionsList);
}
}
public void drawV2XMarkers(ArrayList<MarkerOptions> markerOptionsList) {
currMarkerList = mAMap.addMarkers(markerOptionsList, false);
mAMap.setOnMarkerClickListener(marker -> {
List<Infrastructure> infList = posInfMap.get(marker.getPosition());
// 如果是摄像头
if (infList != null) {
CallerHmiManager.INSTANCE.showVideoDialog(infList);
return true;
}
return false;
});
}
public void clearV2XMarkers() {
if (currMarkerList != null) {
for (Marker marker : currMarkerList) {
marker.destroy();
}
currMarkerList = null;
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();

View File

@@ -2,19 +2,26 @@ package com.mogo.eagle.core.function.smp;
import android.content.Context;
import android.os.Bundle;
import android.os.Looper;
import android.view.View;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.overview.InfStructureManager;
import com.mogo.eagle.core.function.overview.ViewModelExtKt;
import com.mogo.eagle.core.function.overview.vm.OverViewModel;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import java.util.List;
@@ -28,6 +35,7 @@ public class OverviewMapFragment extends BaseFragment
implements IMogoSmallMapProvider {
private final String TAG = "SmallMapFragment";
protected AMapCustomView mAMapCustomView;
private OverViewModel mViewModel;
@Override
public void onAttach(Context context) {
@@ -70,6 +78,18 @@ public class OverviewMapFragment extends BaseFragment
}
}
@Override
public void clearV2XMarkers() {
if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
UiThreadHandler.post(() -> {
mAMapCustomView.clearV2XMarkers();
});
} else {
mAMapCustomView.clearV2XMarkers();
}
mViewModel.stopQueryV2XEvents();
}
@Override
public void drawablePolyline(List<MogoLatLng> coordinates) {
}
@@ -92,17 +112,36 @@ public class OverviewMapFragment extends BaseFragment
super.onActivityCreated(savedInstanceState);
// 主动查一次全局路径规划的数据
CallerAutoPilotManager.INSTANCE.getGlobalPath();
// queryInfStructure();
queryV2XEvents();
}
// private void queryInfStructure() {
// mViewModel = ViewModelExtKt.obtainViewModel(this, OverViewModel.class);
// mViewModel.getInfStructuresMap().observe(this.getViewLifecycleOwner(), map -> {
// mAMapCustomView.updateInfStructures(map);
// });
// // 本地数据库查询
// mViewModel.fetchInfStructures();
// }
private void queryV2XEvents() {
mViewModel = ViewModelExtKt.obtainViewModel(this, OverViewModel.class);
mViewModel.getV2XEventLiveData().observe(this.getViewLifecycleOwner(), v2XEvents -> {
mAMapCustomView.showV2XEventMarkers(v2XEvents);
});
long lineId = getLineId();
if (lineId > 0) {
mViewModel.getAllV2XEventsByLineId("" + lineId, MoGoAiCloudClientConfig.getInstance().getSn());
}
}
/**
*
* @return Taxi的下发的轨迹id
*/
private long getLineId() {
long lineId = -1;
AutopilotControlParameters parameter = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo()
.getAutopilotControlParameters();
if (parameter != null) {
if (parameter.autoPilotLine != null) {
lineId = parameter.autoPilotLine.getLineId();
}
}
return lineId;
}
@Override
public void onPause() {

View File

@@ -130,15 +130,7 @@ object DataManager {
}
fun removeRecordInfo(key: String, value: Any) {
if (Thread.currentThread() == Looper.getMainLooper().thread) {
scope.launch {
withContext(Dispatchers.Default) {
removedRecordMap[key] = value
}
}
} else {
removedRecordMap[key] = value
}
removedRecordMap[key] = value
}
/**

View File

@@ -42,11 +42,8 @@ class MsgBoxProvider : IMsgBoxProvider {
return DataManager.getRecordBagData()
}
override fun removeRecordInfo(key: String, value: Any) {
return DataManager.removeRecordInfo(key, value)
}
override fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) {
override fun removeRecordInfo(context: Context, msgBoxBean: MsgBoxBean, key: String) {
DataManager.removeRecordInfo(key, key)
DataManager.delMsgBoxBean(context, msgBoxBean)
}

View File

@@ -21,12 +21,9 @@ class MoGoObuProvider : IMoGoObuProvider {
private val TAG = "MoGoObuProvider"
private var mContext: Context? = null
private val busObuIp = "192.168.8.199"
private val taxiObuIp = "192.168.1.199"
// private val taxiObuIp = "192.168.1.186"
override val functionName: String
get() = TAG
@@ -35,7 +32,7 @@ class MoGoObuProvider : IMoGoObuProvider {
}
override fun init(context: Context) {
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress() + "--")
//bus乘客版本obu功能去掉
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
@@ -46,30 +43,33 @@ class MoGoObuProvider : IMoGoObuProvider {
mContext = context
mContext?.let {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //bus 司机端
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
busObuIp,
CommonUtils.getIpAddressString()
)
//old obu
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, busObuIp)
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
taxiObuIp,
ipAddress,
CommonUtils.getIpAddressString()
)
//old obu
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
CallerLogger.d("$M_OBU$TAG", "bus 司机 ipAddress = $ipAddress ---localIp = ${CommonUtils.getIpAddressString()}")
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
ipAddress,
CommonUtils.getIpAddressString()
)
//old obu
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
CallerLogger.d("$M_OBU$TAG", "taxi 司机端和乘客端 ipAddress = $ipAddress ---localIp = ${CommonUtils.getIpAddressString()}")
}
}
}

View File

@@ -94,14 +94,22 @@ object TrafficDataConvertUtilsNew {
trafficData.heading = info.participant.heading
trafficData.speed = info.participant.speed
/**
* 交通参与者类型
* 0未知
* 1机动车
* 2非机动车
* 3行人
* 4OBU自身
*/
when (info.participant.ptcType) {
// 未知
0 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI
}
//机动车 //TODO
//机动车
1 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO
}
// 非机动车
2 -> {
@@ -113,16 +121,6 @@ object TrafficDataConvertUtilsNew {
}
}
/**
* 交通参与者类型
* 0未知
* 1机动车
* 2非机动车
* 3行人
* 4OBU自身
*/
val ptcType = 0
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg != null && info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel