Merge branch 'dev_arch_opt_3.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_arch_opt_3.0

This commit is contained in:
xinfengkun
2023-02-01 18:34:39 +08:00
392 changed files with 11343 additions and 9874 deletions

View File

@@ -53,20 +53,10 @@ dependencies {
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(":OCH:mogo-och-common-module")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(':foudations:mogo-aicloud-services-sdk')
implementation project(":foudations:mogo-commons")
implementation project(':core:mogo-core-data')
implementation project(":core:mogo-core-utils")
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -44,8 +44,7 @@ public class BusPassengerRouteFragment extends
private final String TAG = "BusPassengerRouteFragment";
private BusPassengerTrafficLightView mTrafficLightView;
private List<BusPassengerStation> mStationsList = new ArrayList<>();
private final List<BusPassengerStation> mStationsList = new ArrayList<>();
private TextView mSpeedTv;
private ConstraintLayout mNoLineInfoView;
@@ -75,8 +74,6 @@ public class BusPassengerRouteFragment extends
@Override
protected void initViews() {
super.initViews();
mTrafficLightView = findViewById(R.id.bus_p_traffic_light_view);
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
mSpeedTv = findViewById(R.id.bus_p_speed_tv);

View File

@@ -1,194 +0,0 @@
package com.mogo.och.bus.passenger.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.passenger.R;
import org.jetbrains.annotations.Nullable;
/**
* bus乘客端红绿灯view
*
* Created on 2022/3/14
*/
public class BusPassengerTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private TextView mLightTimeTV;
private int mCurrentLightId;
private ImageView mLightIconBG;
public BusPassengerTrafficLightView(@Nullable Context context) {
this(context, null, 0);
}
public BusPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public BusPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.bus_p_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.bus_p_traffic_light_iv);
mLightTimeTV = findViewById(R.id.bus_p_traffic_light_time_tv);
mLightIconBG = findViewById(R.id.bus_p_traffic_light_bg);
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
@Override
public void showWarningTrafficLight(int checkLightId,int lightSource) {
super.showWarningTrafficLight(checkLightId,lightSource);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
BusPassengerTrafficLightView.this.setVisibility(GONE);
});
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
resetView();
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
resetView();
mLightTimeTV.setText(String.valueOf(redNum));
} else {
disableCountdown();
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
resetView();
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
disableCountdown();
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
resetView();
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
disableCountdown();
mLightTimeTV.setText("");
}
});
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_red_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_yellow_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_green_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
default:
BusPassengerTrafficLightView.this.setVisibility(GONE);
break;
}
});
}
@Override
public void disableCountdown() {
super.disableCountdown();
UiThreadHandler.post(() ->{
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof MarginLayoutParams){
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
lp.width = (int) getResources().getDimension(R.dimen.bus_p_traffic_light_icon_size);
setLayoutParams(lp);
mLightTimeTV.setVisibility(GONE);
mLightIconBG.getLayoutParams().width = (int)getResources().getDimension(R.dimen.dp_90);
}
});
}
private void resetView(){
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof MarginLayoutParams) {
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
lp.width = (int) getResources().getDimension(R.dimen.bus_p_route_traffic_light_view_width);
setLayoutParams(lp);
mLightTimeTV.setVisibility(VISIBLE);
mLightIconBG.getLayoutParams().width = (int) getResources().getDimension(R.dimen.bus_p_traffic_light_bg_width);
}
}
}

View File

@@ -0,0 +1,179 @@
package com.mogo.och.bus.passenger.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.passenger.R
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.*
/**
* bus乘客端红绿灯view
*
* Created on 2022/3/14
*/
class BusPassengerTrafficLightView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
companion object {
private const val TAG = "BusPassengerTrafficLightView"
}
private var mCurrentLightId = TrafficLightEnum.BLACK
init {
init(context)
}
private fun init(context: Context?) {
LayoutInflater.from(context).inflate(R.layout.bus_p_traffic_light_view, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerTrafficLightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerTrafficLightListenerManager.removeListener(TAG)
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
super.showTrafficLight(checkLightId, lightSource)
mCurrentLightId = checkLightId
updateTrafficLightIcon(checkLightId)
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
override fun disableTrafficLight() {
super.disableTrafficLight()
UiThreadHandler.post {
mCurrentLightId = TrafficLightEnum.BLACK
this@BusPassengerTrafficLightView.visibility = GONE
}
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
resetView()
when (mCurrentLightId) {
TrafficLightEnum.RED -> changeCountdownRed(redNum)
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
else -> UiThreadHandler.post { bus_p_traffic_light_time_tv.text = "" }
}
}
override fun changeCountdownRed(redNum: Int) {
super.changeCountdownRed(redNum)
UiThreadHandler.post {
if (redNum > 0) {
resetView()
bus_p_traffic_light_time_tv.text = redNum.toString()
} else {
disableTrafficLightCountDown()
bus_p_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownGreen(greenNum: Int) {
super.changeCountdownGreen(greenNum)
UiThreadHandler.post {
if (greenNum > 0) {
resetView()
bus_p_traffic_light_time_tv.text = greenNum.toString()
} else {
disableTrafficLightCountDown()
bus_p_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownYellow(yellowNum: Int) {
super.changeCountdownYellow(yellowNum)
UiThreadHandler.post {
if (yellowNum > 0) {
resetView()
bus_p_traffic_light_time_tv.text = yellowNum.toString()
} else {
disableTrafficLightCountDown()
bus_p_traffic_light_time_tv.text = ""
}
}
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
UiThreadHandler.post {
when (lightId) {
TrafficLightEnum.RED -> {
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_red_nor)
this@BusPassengerTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.YELLOW -> {
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_yellow_nor)
this@BusPassengerTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.GREEN -> {
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_green_nor)
this@BusPassengerTrafficLightView.visibility = VISIBLE
}
else -> this@BusPassengerTrafficLightView.visibility = GONE
}
}
}
override fun disableTrafficLightCountDown() {
super.disableTrafficLightCountDown()
UiThreadHandler.post {
val layoutParams = layoutParams
if (layoutParams is MarginLayoutParams) {
val lp = layoutParams
lp.width = resources.getDimension(R.dimen.bus_p_traffic_light_icon_size).toInt()
setLayoutParams(lp)
bus_p_traffic_light_time_tv.visibility = GONE
bus_p_traffic_light_bg.layoutParams.width =
resources.getDimension(R.dimen.dp_90).toInt()
}
}
}
private fun resetView() {
val layoutParams = layoutParams
if (layoutParams is MarginLayoutParams) {
val lp = layoutParams
lp.width = resources.getDimension(R.dimen.bus_p_route_traffic_light_view_width).toInt()
setLayoutParams(lp)
bus_p_traffic_light_time_tv.visibility = VISIBLE
bus_p_traffic_light_bg.layoutParams.width =
resources.getDimension(R.dimen.bus_p_traffic_light_bg_width).toInt()
}
}
}

View File

@@ -26,15 +26,14 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:visibility="gone"
app:marginStart="@dimen/dp_640"
app:marginTop="@dimen/dp_80"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/arrive_station_shadow"

View File

@@ -1,17 +1,17 @@
package com.mogo.och.bus.passenger;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
//package com.mogo.och.bus.passenger;
//
//import org.junit.Test;
//
//import static org.junit.Assert.*;
//
///**
// * Example local unit test, which will execute on the development machine (host).
// *
// * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
// */
//public class ExampleUnitTest {
// @Test
// public void addition_isCorrect() {
// assertEquals(4, 2 + 2);
// }
//}

View File

@@ -56,19 +56,6 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
implementation rootProject.ext.dependencies.androidxrecyclerview
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -22,7 +22,6 @@ import androidx.constraintlayout.widget.Group;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.config.HmiBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
@@ -30,7 +29,9 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.hmi.ui.setting.SOPSettingView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
@@ -79,6 +80,11 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private ImageView mSwitchMapModeImage;
private LinearLayout mSwitchMapModeLayout;
//消息盒子
private DriverMsgBoxButtonView viewDriverMsgBoxButton;
private DriverMsgBoxListView viewDriverMsgBoxList;
private DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
private ObjectAnimator autopilotLoadingAnimator;
public boolean isAnimateRunning = false;
@@ -189,15 +195,29 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
if (mAICollectBtn != null) {
CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn);
}
//消息盒子
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton);
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
viewDriverMsgBoxButton.setClickListener(show -> {
if(show){
viewDriverMsgBoxList.setVisibility(View.VISIBLE);
viewDriverMsgBoxList.notifyData();
viewDriverMsgBoxBubble.setVisibility(View.GONE);
viewDriverMsgBoxBubble.isShowData(false);
}else{
viewDriverMsgBoxList.setVisibility(View.GONE);
viewDriverMsgBoxBubble.setVisibility(View.VISIBLE);
viewDriverMsgBoxBubble.isShowData(true);
}
});
}
@Nullable
@@ -230,9 +250,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
@Override
public void onDestroyView() {
super.onDestroyView();
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
EventBus.getDefault().unregister(this);
}

View File

@@ -1,167 +0,0 @@
package com.mogo.och.bus.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.R;
import com.mogo.och.common.module.wigets.OCHGradientTextView;
import org.jetbrains.annotations.Nullable;
/**
* Bus司机端红绿灯view
*
* Created on 2022/3/29
*/
public class BusTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private OCHGradientTextView mLightTimeTV;
private int mCurrentLightId;
public BusTrafficLightView(@Nullable Context context) {
this(context, null, 0);
}
public BusTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public BusTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.bus_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.bus_traffic_light_iv);
mLightTimeTV = findViewById(R.id.bus_traffic_light_time_tv);
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
@Override
public void showWarningTrafficLight(int checkLightId,int lightSource) {
super.showWarningTrafficLight(checkLightId,lightSource);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
BusTrafficLightView.this.setVisibility(GONE);
});
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_traffic_light_red_color_up),
getResources().getColor(R.color.bus_traffic_light_red_color_down)});
mLightTimeTV.setText(String.valueOf(redNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_traffic_light_green_color_up),
getResources().getColor(R.color.bus_traffic_light_green_color_down)});
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_traffic_light_yellow_color_up),
getResources().getColor(R.color.bus_traffic_light_yellow_color_down)});
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
mLightTimeTV.setText("");
}
});
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.bus_light_red_nor);
BusTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.bus_lightyellow_nor);
BusTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.bus_light_green_nor);
BusTrafficLightView.this.setVisibility(VISIBLE);
break;
default:
BusTrafficLightView.this.setVisibility(GONE);
break;
}
});
}
}

View File

@@ -29,8 +29,115 @@
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:marginStart="@dimen/dp_640"
app:marginTop="@dimen/dp_80" />
android:layout_marginStart="@dimen/dp_640"
android:layout_marginTop="@dimen/dp_80"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--APP、MAP版本-->
<com.mogo.eagle.core.function.hmi.ui.widget.VersionNameView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="45dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--超视距-->
<com.mogo.eagle.core.function.hmi.ui.widget.CameraView
android:id="@+id/ivCameraIcon"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="40dp"
app:layout_constraintRight_toLeftOf="@id/viewTrafficLightVr"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="SpeakableTextPresentCheck"
tools:visibility="visible" />
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="60dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
tools:visibility="visible"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
/>
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/viewTrafficLightVr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/hmi_traffic_light_layout_margin_top"
android:layout_marginEnd="@dimen/hmi_traffic_light_layout_margin_right"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--接管提示-->
<com.mogo.eagle.core.function.hmi.ui.takeover.TakeOverView
android:layout_width="@dimen/hmi_take_over_request_width"
android:layout_height="@dimen/hmi_take_over_request_height"
android:layout_marginTop="@dimen/hmi_take_over_request_m_top"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--隐藏态下的 美化模式按钮-->
<com.mogo.eagle.core.function.hmi.ui.switch.DemoModeHiddenSwitch
android:layout_width="120dp"
android:layout_height="100dp"
android:layout_marginStart="40dp"
android:layout_marginBottom="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="SpeakableTextPresentCheck" />
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
@@ -250,6 +357,7 @@
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<Button
android:id="@+id/btnAutopilotRoute"
android:layout_width="wrap_content"
@@ -258,7 +366,8 @@
android:text="上传全路径"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotArrive" />
app:layout_constraintTop_toBottomOf="@id/btnAutopilotArrive"
tools:ignore="TextContrastCheck" />
<androidx.constraintlayout.widget.Group
android:id="@+id/groupTestPanel"

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/bus_traffic_light_layout_width"
android:layout_height="@dimen/bus_traffic_light_layout_height"
android:visibility="visible">
<ImageView
android:layout_width="@dimen/bus_traffic_light_bg_width"
android:layout_height="@dimen/bus_traffic_light_bg_height"
android:background="@drawable/bg_bus_traffic_light_background"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="@dimen/bus_traffic_light_bg_margin_left"
android:layout_marginTop="@dimen/bus_traffic_light_bg_margin_top"/>
<ImageView
android:id="@+id/bus_traffic_light_iv"
android:layout_width="@dimen/bus_traffic_light_icon_size"
android:layout_height="@dimen/bus_traffic_light_icon_size"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<com.mogo.och.common.module.wigets.OCHGradientTextView
android:id="@+id/bus_traffic_light_time_tv"
android:layout_width="@dimen/bus_traffic_light_time_view_width"
android:layout_height="match_parent"
android:textSize="@dimen/bus_traffic_light_time_size"
android:textStyle="bold"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -58,19 +58,19 @@ dependencies {
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_hmi
api rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
api project(":core:mogo-core-utils")
api project(":foudations:mogo-commons")
api project(':core:mogo-core-data')
api project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:function-impl:mogo-core-function-hmi')
api project(':core:function-impl:mogo-core-function-hmi')
}
implementation project(':libraries:mogo-adas')

View File

@@ -1,5 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'com.alibaba.arouter'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
@@ -13,10 +18,11 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
//ARouter apt 参数
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
@@ -43,6 +49,7 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.bus">
package="com.mogo.och.noop">
/
</manifest>

View File

@@ -4,6 +4,10 @@ import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
/**
* @author congtaowang
@@ -15,15 +19,70 @@ import com.alibaba.android.arouter.facade.annotation.Route
@Route(path = OCHConstants.PATH)
class MoGoOCHNoopProvider : IMogoOCH {
companion object {
private const val TAG = "MogoOCHNoopProvider"
}
override val functionName: String
get() = "MogoOCHNoopProvider"
get() = TAG
private var fragment: OchNoopFragment? = null
private var containerId = 0
private var activity: FragmentActivity? = null
override fun init(context: Context) {
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG, StatusDescriptor.VR_MODE, statusChangedListener
)
}
private val statusChangedListener =
IMogoStatusChangedListener { descriptor: StatusDescriptor, isTrue: Boolean ->
if (descriptor == StatusDescriptor.VR_MODE) {
// 进入vr模式默认显示网约车小巴fragment
if (isTrue) {
showFragment()
} else {
hideFragment()
}
}
}
private fun showFragment() {
activity?.let {
if (fragment == null) {
d(TAG, "准备add fragment======")
val fragmentByTag = it.supportFragmentManager.findFragmentByTag(TAG)
fragment = if (fragmentByTag is OchNoopFragment) {
fragmentByTag
} else {
OchNoopFragment()
}
if (!fragment!!.isAdded) {
it.supportFragmentManager.beginTransaction()
.add(containerId, fragment!!, TAG).commitAllowingStateLoss()
}
return
}
d(TAG, "准备show fragment")
fragment?.let { noopFragment ->
it.supportFragmentManager.beginTransaction().show(noopFragment)
.commitAllowingStateLoss()
}
}
}
private fun hideFragment() {
if (fragment != null) {
d(TAG, "准备hide fragment")
activity?.supportFragmentManager?.beginTransaction()?.hide(fragment!!)
?.commitAllowingStateLoss()
}
}
override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? {
this.containerId = containerId!!
this.activity = activity
return null
}

View File

@@ -12,5 +12,5 @@ class OCHConstants {
/**
* arouter 路由地址
*/
public static final String PATH = "/och/noop/api";
public static final String PATH = "/noop/api";
}

View File

@@ -2,17 +2,8 @@ package com.mogo.och.noop
import android.view.View
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.data.config.FunctionBuildConfig
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.biz.CallerFuncBizManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.och.bus.R
import kotlinx.android.synthetic.main.fragment_hmi.*
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
import kotlinx.android.synthetic.main.och_noop_fragment_hmi.*
class OchNoopFragment : MvpFragment<OchNoopContract.View?, OchNoopPresenter?>(),
OchNoopContract.View {
@@ -33,82 +24,26 @@ class OchNoopFragment : MvpFragment<OchNoopContract.View?, OchNoopPresenter?>(),
return OchNoopPresenter(this)
}
override fun initViews() {
ivCameraIcon?.setOnClickListener {
cameraLiveView.showCameraList(context, CallerFuncBizManager.bizProvider.getCameraList){ liveStatus ->
if(liveStatus){
ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_selected)
}else{
ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_nor)
}
}
viewShowDebugView.setOnLongClickListener {
ToggleDebugView.toggleDebugView.toggle(requireContext())
true
}
ivToolsIcon?.setOnClickListener {
toolsView.showToolsFloat(context)
}
// cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked ->
// if (isChecked) {
// viewDriverMsgBoxList.visibility = View.VISIBLE
// viewDriverMsgBoxList.notifyData()
// viewDriverMsgBoxBubble.visibility = View.GONE
// viewDriverMsgBoxBubble.isShowData(false)
// MsgBoxTipView.visibility = View.GONE
// } else {
// viewDriverMsgBoxList.visibility = View.GONE
// viewDriverMsgBoxBubble.visibility = View.VISIBLE
// viewDriverMsgBoxBubble.isShowData(true)
// }
// }
//美化模式隐藏开关
viewDemoModeSwitch.setOnClickListener {
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
//单次查询,是否有行程信息(订单进行中时点击不生效),autopilotControlParameters为null代表不处于自动驾驶状态下
if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) {
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
context?.let {
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(it)
)
}
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
}
}
}
cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewDriverMsgBoxList.visibility = View.VISIBLE
viewDriverMsgBoxList.notifyData()
viewDriverMsgBoxBubble.visibility = View.GONE
viewDriverMsgBoxBubble.isShowData(false)
CallerHmiManager.updateDriverMsgBoxTipView(false)
} else {
viewDriverMsgBoxList.visibility = View.GONE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
viewDriverMsgBoxBubble.isShowData(true)
}
}
cbMsgBoxPassenger.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewPassengerMsgBoxList.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.GONE
viewPassengerMsgBoxBubble.isShowData(false)
CallerHmiManager.updatePassengerMsgBoxTipView(false)
} else {
viewPassengerMsgBoxList.visibility = View.GONE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.isShowData(true)
}
}
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
cbMsgBoxDriver.visibility = View.VISIBLE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)
) {
cbMsgBoxPassenger.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
}
}

View File

@@ -39,16 +39,18 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:id="@+id/flVipIdentificationView"
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:layout_marginStart="@dimen/dp_640"
android:layout_marginTop="@dimen/dp_80"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--接管提示-->
<com.mogo.eagle.core.function.hmi.ui.takeover.TakeOverView
android:id="@+id/clTakeOverView"
android:layout_width="@dimen/hmi_take_over_request_width"
android:layout_height="@dimen/hmi_take_over_request_height"
android:layout_marginTop="@dimen/hmi_take_over_request_m_top"
@@ -65,26 +67,42 @@
android:layout_marginTop="@dimen/module_mogo_autopilot_status_margin_top"
android:elevation="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@+id/viewSpeedChart"
app:layout_constraintTop_toBottomOf="@+id/viewSpeedChart"
app:layout_goneMarginStart="@dimen/module_mogo_autopilot_status_margin_left" />
app:layout_constraintTop_toBottomOf="@+id/viewSpeedChart"/>
<!--超视距-->
<ImageView
<com.mogo.eagle.core.function.hmi.ui.widget.CameraView
android:id="@+id/ivCameraIcon"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="40dp"
android:background="@drawable/icon_camera_nor"
app:layout_constraintRight_toLeftOf="@id/viewTrafficLightVr"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="60dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
tools:visibility="visible"/>
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/viewTrafficLightVr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="@dimen/hmi_traffic_light_layout_margin_top"
android:layout_marginEnd="@dimen/hmi_traffic_light_layout_margin_right"
app:layout_constraintRight_toRightOf="parent"
@@ -101,7 +119,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<View
<!--隐藏态下的 美化模式按钮-->
<com.mogo.eagle.core.function.hmi.ui.switch.DemoModeHiddenSwitch
android:id="@+id/viewDemoModeSwitch"
android:layout_width="120dp"
android:layout_height="100dp"
@@ -111,19 +130,17 @@
app:layout_constraintStart_toStartOf="parent" />
<!--工具箱-->
<ImageView
android:id="@+id/ivToolsIcon"
<com.mogo.eagle.core.function.hmi.ui.tools.ToolsImageView
android:id="@+id/ivToolsView"
android:layout_width="@dimen/module_hmi_check_size"
android:layout_height="@dimen/module_hmi_check_size"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_marginBottom="40dp"
android:background="@drawable/module_ext_check"
android:elevation="@dimen/dp_10"
android:scaleType="center"
android:src="@drawable/icon_tools_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/viewPerspectiveSwitch"
app:layout_goneMarginStart="50dp" />
app:layout_goneMarginStart="50dp"
android:contentDescription="工具箱"/>
<!--问题反馈-->
<ImageView
@@ -134,7 +151,8 @@
android:layout_marginBottom="40dp"
android:src="@drawable/bad_case_selector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/ivToolsIcon" />
app:layout_constraintStart_toEndOf="@id/ivToolsView"
android:contentDescription="BadCase"/>
<ImageView
android:id="@+id/ivAiCollectTools"
@@ -144,7 +162,8 @@
android:layout_marginBottom="40dp"
android:src="@drawable/ai_collect_selector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/ivBadCaseTools" />
app:layout_constraintStart_toEndOf="@id/ivBadCaseTools"
android:contentDescription="数据采集" />
<View
android:id="@+id/viewUpgradeTips"
@@ -153,31 +172,11 @@
android:background="@drawable/version_upgrade_tips_background"
android:translationZ="30dp"
android:visibility="gone"
app:layout_constraintCircle="@id/ivToolsIcon"
app:layout_constraintCircle="@id/ivToolsView"
app:layout_constraintCircleAngle="45"
app:layout_constraintCircleRadius="60dp"
tools:ignore="MissingConstraints" />
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:background="@drawable/bg_waring_limiting_velocity"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="60dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
app:layout_goneMarginEnd="40dp"
app:layout_goneMarginTop="40dp"
tools:visibility="gone" />
<!--消息盒子司机端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxDriver"
@@ -187,7 +186,7 @@
android:layout_marginEnd="25dp"
android:background="@drawable/selector_msg_box"
android:button="@null"
android:visibility="gone"
android:visibility="visible"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
@@ -204,32 +203,6 @@
app:layout_constraintCircleRadius="32dp"
tools:ignore="MissingConstraints" />
<!--消息盒子乘客端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxPassenger"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="320dp"
android:layout_marginBottom="50dp"
android:background="@drawable/selector_msg_box_p"
android:button="@null"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<!--乘客端消息提示-->
<View
android:id="@+id/MsgBoxPTipView"
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/version_upgrade_tips_background"
android:translationZ="30dp"
android:visibility="gone"
app:layout_constraintCircle="@id/cbMsgBoxPassenger"
app:layout_constraintCircleAngle="40"
app:layout_constraintCircleRadius="50dp"
tools:ignore="MissingConstraints" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864px"
@@ -237,36 +210,17 @@
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbMsgBoxDriver" />
app:layout_constraintTop_toBottomOf="@id/cbMsgBoxDriver"
tools:visibility="gone"/>
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864px"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="gone"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbMsgBoxDriver" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView
android:id="@+id/viewPassengerMsgBoxBubble"
android:layout_width="650px"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/cbMsgBoxPassenger"
app:layout_constraintLeft_toLeftOf="@id/cbMsgBoxPassenger"
app:layout_constraintRight_toRightOf="@id/cbMsgBoxPassenger" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxListView
android:id="@+id/viewPassengerMsgBoxList"
android:layout_width="650px"
android:layout_height="750px"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/cbMsgBoxPassenger"
app:layout_constraintLeft_toLeftOf="@id/cbMsgBoxPassenger"
app:layout_constraintRight_toRightOf="@id/cbMsgBoxPassenger" />
app:layout_constraintTop_toBottomOf="@id/cbMsgBoxDriver"
tools:visibility="gone" />
<!--左右转向灯-->
<com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus
@@ -288,6 +242,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -304,16 +259,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<RelativeLayout
android:id="@+id/statusBarContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
app:layout_constraintEnd_toStartOf="@+id/viewLimitingVelocity"
app:layout_constraintTop_toTopOf="@+id/viewLimitingVelocity"
app:layout_goneMarginEnd="40dp"
app:layout_goneMarginTop="30dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -55,19 +55,6 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
implementation rootProject.ext.dependencies.androidxrecyclerview
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -23,7 +23,6 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.config.HmiBuildConfig;
import com.mogo.eagle.core.data.constants.DataTypes;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
@@ -32,7 +31,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -45,9 +43,9 @@ import com.mogo.och.sweeper.R;
import com.mogo.och.sweeper.bean.SweeperRoutesResult;
import com.mogo.och.sweeper.constant.SweeperConst;
import com.mogo.och.sweeper.model.SweeperOrderModel;
import com.mogo.och.sweeper.view.SweeperTrafficDataView;
import com.mogo.och.sweeper.util.BDRouteDataTestUtils;
import com.mogo.och.sweeper.view.SlidePanelView;
import com.mogo.och.sweeper.view.SweeperTrafficDataView;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
@@ -215,9 +213,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
@@ -246,9 +242,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
@Override
public void onDestroyView() {
super.onDestroyView();
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}

View File

@@ -1,33 +0,0 @@
package com.mogo.och.sweeper.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity;
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class SweeperLimitingVelocityView extends IViewLimitingVelocity {
private TextView limitingVelocity;
public SweeperLimitingVelocityView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SweeperLimitingVelocityView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context,attrs,0);
initView(context);
}
@Override
public void updateLimitingSpeed(int limitingSpeed) {
super.updateLimitingSpeed(limitingSpeed);
limitingVelocity.setText(String.valueOf(limitingSpeed));
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this);
limitingVelocity = findViewById(R.id.tvLimitingVelocity);
}
}

View File

@@ -0,0 +1,56 @@
package com.mogo.och.sweeper.view
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_limiting_speed.view.*
class SweeperLimitingVelocityView(
context: Context,
attrs: AttributeSet? = null,
) : LinearLayout(context, attrs), ILimitingVelocityListener, IViewControlListener {
companion object {
private const val TAG = "SweeperLimitingVelocityView"
}
init {
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerViewLimitingVelocityListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(LimitingVelocityView_TAG, this)
}
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
if (limitingVelocity > 0) {
this.visibility = View.VISIBLE
tvLimitingVelocity.text = "$limitingVelocity"
} else {
this.visibility = View.GONE
}
}
override fun visible(v: Int) {
super.visible(v)
this.visibility = v
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerViewLimitingVelocityListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(LimitingVelocityView_TAG)
}
}

View File

@@ -6,10 +6,19 @@ import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
@@ -17,13 +26,13 @@ import com.mogo.och.sweeper.R;
import org.jetbrains.annotations.NotNull;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import chassis.Chassis;
import chassis.VehicleStateOuterClass;
public class SweeperTrafficDataView extends ConstraintLayout {
public class SweeperTrafficDataView extends ConstraintLayout
implements IMoGoChassisLamplightListener,
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener {
private static final String TAG = "SweeperTrafficDataView";
private TapPositionView tapPositionView;//方向盘
private ImageView speedImage;//速度图标
@@ -32,23 +41,23 @@ public class SweeperTrafficDataView extends ConstraintLayout {
private SweeperLimitingVelocityView sweeperLimitingVelocity;//限速
public SweeperTrafficDataView(@NonNull Context context) {
super(context);
this(context,null);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
this(context, attrs,0);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this(context, attrs, defStyleAttr,0);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initView(context);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_data, this);
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_data, this,true);
tapPositionView = findViewById(R.id.sweeperTrafficPosition);
speedImage = findViewById(R.id.sweeperSpeedImage);
speedTextView = findViewById(R.id.sweeperSpeedText);
@@ -58,109 +67,76 @@ public class SweeperTrafficDataView extends ConstraintLayout {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
//增加限速监听
CallLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
//添加 底盘灯光数据 监听
CallerChassisLamplightListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
CallerAutopilotVehicleStateListenerManager.INSTANCE.removeListener(mIMoGoAutopilotVehicleStateListener);
CallLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener);
// 移除 底盘灯光数据 监听
CallerChassisLamplightListenerManager.INSTANCE.removeListener(TAG);
CallerChassisSteeringStateListenerManager.INSTANCE.removeListener(TAG);
CallerChassisGearStateListenerManager.INSTANCE.removeListener(TAG);
}
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
@Override
public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) {
}
/**
* 车辆转向灯
* @param lightSwitch
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
//转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
if (lightSwitch.getNumber()==1){
sweeperTurnSignal.showLeftSignal();
}else if(lightSwitch.getNumber()==2){
sweeperTurnSignal.showRightSignal();
}else{
sweeperTurnSignal.showDirection();
}
}
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight);
}
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
if (Math.abs(steering) < 1) {
steering = 0;
}
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
ThreadUtils.runOnUiThread(() -> {
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
});
}
@Override
public void onAutopilotDataException(long timestamp) {
}
@Override
public void onAutopilotAcc(float carAcc) {
}
@Override
public void onAutopilotBrake(float brake) {
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
}
@Override
public void onAutopilotThrottle(float throttle) {
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
}
};
/**
* 限速监听
* 车辆转向灯
* @param lightSwitch
*/
private final LimitingVelocityListener limitingVelocityListener = new LimitingVelocityListener(){
@Override
public void onLimitingVelocityChange(int limitingVelocity) {
//设置限速
sweeperLimitingVelocity.updateLimitingSpeed(limitingVelocity);
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
//转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
if (lightSwitch.getNumber()==1){
sweeperTurnSignal.showLeftSignal();
}else if(lightSwitch.getNumber()==2){
sweeperTurnSignal.showRightSignal();
}else{
sweeperTurnSignal.showDirection();
}
}
};
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight);
}
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
if (Math.abs(steering) < 1) {
steering = 0;
}
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
ThreadUtils.runOnUiThread(() -> {
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
});
}
/**
* 速度设置
*/
@@ -172,4 +148,5 @@ public class SweeperTrafficDataView extends ConstraintLayout {
speedImage.setBackgroundResource(newSpeed > 60 ? R.drawable.sweeper_traffic_data_speed_warning :R.drawable.sweeper_bg_traffic_data_speed);
}
}
}

View File

@@ -1,158 +0,0 @@
package com.mogo.och.sweeper.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.sweeper.R;
import org.jetbrains.annotations.Nullable;
/**
* 清扫车红绿灯view-
*
* Created on 2022/3/29
*/
public class SweeperTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private TextView mLightTimeTV;
private int mCurrentLightId;
public SweeperTrafficLightView(@Nullable Context context) {
this(context, null, 0);
}
public SweeperTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public SweeperTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.sweeper_traffic_light_iv);
mLightTimeTV = findViewById(R.id.sweeper_traffic_light_time_tv);
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
@Override
public void showWarningTrafficLight(int checkLightId,int lightSource) {
super.showWarningTrafficLight(checkLightId,lightSource);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
SweeperTrafficLightView.this.setVisibility(GONE);
});
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
mLightTimeTV.setText(String.valueOf(redNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
mLightTimeTV.setText("");
}
});
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_red_nor);
SweeperTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_lightyellow_nor);
SweeperTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_green_nor);
SweeperTrafficLightView.this.setVisibility(VISIBLE);
break;
default:
SweeperTrafficLightView.this.setVisibility(GONE);
break;
}
});
}
}

View File

@@ -0,0 +1,139 @@
package com.mogo.och.sweeper.view
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_traffic_light_view.view.*
/**
* 清扫车红绿灯view-
*
* Created on 2022/3/29
*/
class SweeperTrafficLightView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
companion object {
private const val TAG = "SweeperTrafficLightView"
}
private var mCurrentLightId = TrafficLightEnum.BLACK
init {
init(context)
}
private fun init(context: Context?) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerTrafficLightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerTrafficLightListenerManager.removeListener(TAG)
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
mCurrentLightId = checkLightId
updateTrafficLightIcon(checkLightId)
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
override fun disableTrafficLight() {
UiThreadHandler.post {
mCurrentLightId = TrafficLightEnum.BLACK
this@SweeperTrafficLightView.visibility = GONE
}
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
when (mCurrentLightId) {
TrafficLightEnum.RED -> changeCountdownRed(redNum)
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
else -> UiThreadHandler.post { sweeper_traffic_light_time_tv.text = "" }
}
}
override fun changeCountdownRed(redNum: Int) {
UiThreadHandler.post {
if (redNum > 0) {
sweeper_traffic_light_time_tv.text = redNum.toString()
} else {
sweeper_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownGreen(greenNum: Int) {
UiThreadHandler.post {
if (greenNum > 0) {
sweeper_traffic_light_time_tv.text = greenNum.toString()
} else {
sweeper_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownYellow(yellowNum: Int) {
UiThreadHandler.post {
if (yellowNum > 0) {
sweeper_traffic_light_time_tv.text = yellowNum.toString()
} else {
sweeper_traffic_light_time_tv.text = ""
}
}
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
UiThreadHandler.post {
when (lightId) {
TrafficLightEnum.RED -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_red_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.YELLOW -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_lightyellow_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.GREEN -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_green_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
else -> this@SweeperTrafficLightView.visibility = GONE
}
}
}
}

View File

@@ -21,6 +21,57 @@
android:layout_height="match_parent" />
</FrameLayout>
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="@dimen/dp_640"
android:layout_marginTop="@dimen/dp_80"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--APP、MAP版本-->
<com.mogo.eagle.core.function.hmi.ui.widget.VersionNameView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="45dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--超视距-->
<com.mogo.eagle.core.function.hmi.ui.widget.CameraView
android:id="@+id/ivCameraIcon"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="40dp"
app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<!--接管提示-->
<com.mogo.eagle.core.function.hmi.ui.takeover.TakeOverView
android:layout_width="@dimen/hmi_take_over_request_width"
android:layout_height="@dimen/hmi_take_over_request_height"
android:layout_marginTop="@dimen/hmi_take_over_request_m_top"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"

View File

@@ -56,19 +56,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_res
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:mogo-core-res')
}
}

View File

@@ -8,7 +8,7 @@ import com.mogo.och.taxi.passenger.mulprocess.ICallback;
interface ILeftMenuService {
/**
* 向主进程传选中的item
* Pass the selected item to the main process
*/
void transmissionIndex(int index);

View File

@@ -24,16 +24,20 @@ import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.msgbox.MsgBoxBean;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener;
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener;
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener;
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener;
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.CallerChassisLocationGCJ20ListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager;
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
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;
@@ -65,6 +69,7 @@ import com.mogo.och.taxi.passenger.callback.ITaxiPassengerVeloctityCallback;
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils;
import com.mogo.och.taxi.passenger.utils.TaxiPassengerAnalyticsManager;
import org.jetbrains.annotations.NotNull;
@@ -242,12 +247,14 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
//增加限速监听
CallLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
CallerLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
//开启自驾后 异常信息返回
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
CallerMsgBoxEventListenerManager.INSTANCE.addListener(TAG,iMsgBoxEventListener);
}
private void releaseListeners() {
@@ -261,11 +268,13 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
CallLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener);
CallerLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null);
CallerMsgBoxEventListenerManager.INSTANCE.removeListener(iMsgBoxEventListener);
}
/**
@@ -598,6 +607,37 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
}
};
private final IMsgBoxEventListener iMsgBoxEventListener = new IMsgBoxEventListener() {
@Override
public void onBubbleReportClickEvent(@NonNull MsgBoxBean msgBoxBean) {
}
@Override
public void onBubbleV2XClickEvent(@NonNull MsgBoxBean msgBoxBean) {
}
@Override
public void onBubbleOperationClickEvent(@NonNull MsgBoxBean msgBoxBean) {
}
@Override
public void onUpdateTipEvent(boolean isShow) {
}
@Override
public void onSummaryClickEvent() {
if (mCurrentOCHOrder == null){
ToastUtils.showLong("行程已结束");
}else {
OverlayLeftViewUtils.INSTANCE.transmissionIndexGet(OverlayLeftViewUtils.OVERVIEW);
}
}
};
public void startToRouteAndWipe(List<MessagePad.Location> models) {
List<MogoLocation> locationsModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjLocations(mContext,models);
@@ -671,10 +711,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
/**
* 限速监听
*/
private final LimitingVelocityListener limitingVelocityListener = new LimitingVelocityListener(){
private final ILimitingVelocityListener limitingVelocityListener = new ILimitingVelocityListener(){
@Override
public void onLimitingVelocityChange(int limitingVelocity) {
public void onLimitingVelocityChange(int limitingVelocity, DataSourceType dataSourceType) {
if (mVeloctityCallback != null){
mVeloctityCallback.onLimitingVelocityChange(limitingVelocity);
}

View File

@@ -15,12 +15,13 @@ import androidx.fragment.app.FragmentTransaction;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy;
import com.mogo.eagle.core.function.api.hmi.view.IViewNotification;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxListView;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
@@ -49,18 +50,21 @@ import java.lang.ref.WeakReference;
* @author tongchenfei
*/
public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFragment, BaseTaxiPassengerPresenter>
implements IMogoMapListener, TaxiPassengerTaxiView, ITPClickStartAutopilotCallback, IMoGoHmiViewProxy.IViewNotificationProvider {
implements IMogoMapListener, TaxiPassengerTaxiView, ITPClickStartAutopilotCallback{
static final String TAG = "TaxiPassengerBaseFragment";
private ImageView mAutopilotImage;
private ImageView mMapswitchBtn;
private TaxiPassengerTrafficLightView mTrafficLightView;
private WeakReference<TaxiPassengerArrivedView> mArrivedEndView;
private WeakReference<TaxiPassengerCheckView> mArrivedCheckView;
private WeakReference<TaxiPassengerStartAutopilotView> mStartAutopilotView;
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
//消息盒子
private PassengerMsgBoxButtonView viewPassengerMsgBoxButton;
private PassengerMsgBoxBubbleView viewPassengerMsgBoxBubble;
private PassengerMsgBoxListView viewPassengerMsgBoxList;
private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -87,12 +91,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
hideEagleConfig();
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
mTrafficLightView = findViewById(R.id.traffic_light_view);
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
CallerHmiManager.INSTANCE.setNotificationViewProvider(this);
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
updateSwitchMapIcon();
initListener();
@@ -102,12 +100,22 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
switchVRFlatMode(MogoStatusManager.getInstance().isVrMode());
//预加载视频进程
EmptyService.Companion.startService(getContext());
}
@NonNull
@Override
public IViewNotification getNotificationView() {
return new TaxiPassengerV2XNotificationView(getContext());
//消息盒子
viewPassengerMsgBoxButton = findViewById(R.id.viewPassengerMsgBoxButton);
viewPassengerMsgBoxBubble = findViewById(R.id.viewPassengerMsgBoxBubble);
viewPassengerMsgBoxList = findViewById(R.id.viewPassengerMsgBoxList);
viewPassengerMsgBoxButton.setClickListener(show -> {
if(show){
viewPassengerMsgBoxList.setVisibility(View.VISIBLE);
viewPassengerMsgBoxBubble.setVisibility(View.GONE);
viewPassengerMsgBoxBubble.isShowData(false);
}else{
viewPassengerMsgBoxList.setVisibility(View.GONE);
viewPassengerMsgBoxBubble.setVisibility(View.VISIBLE);
viewPassengerMsgBoxBubble.isShowData(true);
}
});
}
private void updateSwitchMapIcon() {

View File

@@ -1,202 +0,0 @@
package com.mogo.och.taxi.passenger.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.common.module.wigets.OCHGradientTextView;
import com.mogo.och.taxi.passenger.R;
import org.jetbrains.annotations.Nullable;
/**
* Taxi乘客端红绿灯view
*
* Created on 2022/3/14
*/
public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private OCHGradientTextView mLightTimeTV;
private int mCurrentLightId;
private ImageView mLightIconBG;
public TaxiPassengerTrafficLightView(@Nullable Context context) {
this(context, null, 0);
}
public TaxiPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public TaxiPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.taxi_p_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.taxi_p_traffic_light_iv);
mLightTimeTV = findViewById(R.id.taxi_p_traffic_light_time_tv);
mLightIconBG = findViewById(R.id.taxi_p_traffic_light_bg);
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
@Override
public void showWarningTrafficLight(int checkLightId,int lightSource) {
super.showWarningTrafficLight(checkLightId,lightSource);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
TaxiPassengerTrafficLightView.this.setVisibility(GONE);
});
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
resetView();
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
resetView();
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_red_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_red_color_down)});
mLightTimeTV.setText(String.valueOf(redNum));
} else {
disableCountdown();
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
resetView();
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_green_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_green_color_down)});
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
disableCountdown();
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
resetView();
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_down)});
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
disableCountdown();
mLightTimeTV.setText("");
}
});
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.taxi_p_light_red_nor);
TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.taxi_p_lightyellow_nor);
TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.taxi_p_light_green_nor);
TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
default:
TaxiPassengerTrafficLightView.this.setVisibility(GONE);
break;
}
});
}
@Override
public void disableCountdown() {
super.disableCountdown();
UiThreadHandler.post(() ->{
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof MarginLayoutParams){
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
lp.width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_icon_size);
setLayoutParams(lp);
mLightTimeTV.setVisibility(GONE);
mLightIconBG.getLayoutParams().width = (int)getResources().getDimension(R.dimen.dp_124);
}
});
}
private void resetView(){
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof MarginLayoutParams) {
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
lp.width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_layout_width);
setLayoutParams(lp);
mLightTimeTV.setVisibility(VISIBLE);
mLightIconBG.getLayoutParams().width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_bg_width);
}
}
}

View File

@@ -0,0 +1,200 @@
package com.mogo.och.taxi.passenger.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.taxi.passenger.R
import kotlinx.android.synthetic.main.taxi_p_traffic_light_view.view.*
/**
* Taxi乘客端红绿灯view
*
* Created on 2022/3/14
*/
class TaxiPassengerTrafficLightView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
companion object {
private const val TAG = "TaxiPassengerTrafficLightView"
}
private var mCurrentLightId = TrafficLightEnum.BLACK
init {
init(context)
}
private fun init(context: Context?) {
LayoutInflater.from(context).inflate(R.layout.taxi_p_traffic_light_view, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerTrafficLightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerTrafficLightListenerManager.removeListener(TAG)
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
super.showTrafficLight(checkLightId, lightSource)
mCurrentLightId = checkLightId
updateTrafficLightIcon(checkLightId)
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
override fun disableTrafficLight() {
super.disableTrafficLight()
UiThreadHandler.post {
mCurrentLightId = TrafficLightEnum.BLACK
this@TaxiPassengerTrafficLightView.visibility = GONE
}
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
resetView()
when (mCurrentLightId) {
TrafficLightEnum.RED -> changeCountdownRed(redNum)
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
else -> UiThreadHandler.post { taxi_p_traffic_light_time_tv.text = "" }
}
}
override fun changeCountdownRed(redNum: Int) {
super.changeCountdownRed(redNum)
UiThreadHandler.post {
if (redNum > 0) {
resetView()
taxi_p_traffic_light_time_tv.setVertrial(true)
taxi_p_traffic_light_time_tv.setmColorList(
intArrayOf(
resources.getColor(R.color.taxi_p_traffic_light_red_color_up),
resources.getColor(R.color.taxi_p_traffic_light_red_color_down)
)
)
taxi_p_traffic_light_time_tv.text = redNum.toString()
} else {
disableTrafficLightCountDown()
taxi_p_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownGreen(greenNum: Int) {
super.changeCountdownGreen(greenNum)
UiThreadHandler.post {
if (greenNum > 0) {
resetView()
taxi_p_traffic_light_time_tv.setVertrial(true)
taxi_p_traffic_light_time_tv.setmColorList(
intArrayOf(
resources.getColor(R.color.taxi_p_traffic_light_green_color_up),
resources.getColor(R.color.taxi_p_traffic_light_green_color_down)
)
)
taxi_p_traffic_light_time_tv.text = greenNum.toString()
} else {
disableTrafficLightCountDown()
taxi_p_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownYellow(yellowNum: Int) {
super.changeCountdownYellow(yellowNum)
UiThreadHandler.post {
if (yellowNum > 0) {
resetView()
taxi_p_traffic_light_time_tv.setVertrial(true)
taxi_p_traffic_light_time_tv.setmColorList(
intArrayOf(
resources.getColor(R.color.taxi_p_traffic_light_yellow_color_up),
resources.getColor(R.color.taxi_p_traffic_light_yellow_color_down)
)
)
taxi_p_traffic_light_time_tv.text = yellowNum.toString()
} else {
disableTrafficLightCountDown()
taxi_p_traffic_light_time_tv.text = ""
}
}
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
UiThreadHandler.post {
when (lightId) {
TrafficLightEnum.RED -> {
taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_light_red_nor)
this@TaxiPassengerTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.YELLOW -> {
taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_lightyellow_nor)
this@TaxiPassengerTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.GREEN -> {
taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_light_green_nor)
this@TaxiPassengerTrafficLightView.visibility = VISIBLE
}
else -> this@TaxiPassengerTrafficLightView.visibility = GONE
}
}
}
override fun disableTrafficLightCountDown() {
super.disableTrafficLightCountDown()
UiThreadHandler.post {
val layoutParams = layoutParams
if (layoutParams is MarginLayoutParams) {
layoutParams.width =
resources.getDimension(R.dimen.taxi_p_traffic_light_icon_size).toInt()
setLayoutParams(layoutParams)
taxi_p_traffic_light_time_tv.visibility = GONE
taxi_p_traffic_light_bg.layoutParams.width =
resources.getDimension(R.dimen.dp_124).toInt()
}
}
}
private fun resetView() {
val layoutParams = layoutParams
if (layoutParams is MarginLayoutParams) {
val lp = layoutParams
lp.width = resources.getDimension(R.dimen.taxi_p_traffic_light_layout_width).toInt()
setLayoutParams(lp)
taxi_p_traffic_light_time_tv.visibility = VISIBLE
taxi_p_traffic_light_bg.layoutParams.width =
resources.getDimension(R.dimen.taxi_p_traffic_light_bg_width).toInt()
}
}
}

View File

@@ -28,15 +28,14 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:visibility="gone"
app:marginStart="@dimen/dp_540"
app:marginTop="@dimen/dp_40"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/module_och_taxi_swich_map_iv"
@@ -51,6 +50,36 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<!--消息盒子-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxButtonView
android:id="@+id/viewPassengerMsgBoxButton"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="320dp"
android:layout_marginBottom="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView
android:id="@+id/viewPassengerMsgBoxBubble"
android:layout_width="650dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintLeft_toLeftOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintRight_toRightOf="@id/viewPassengerMsgBoxButton" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxListView
android:id="@+id/viewPassengerMsgBoxList"
android:layout_width="650dp"
android:layout_height="750dp"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintLeft_toLeftOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintRight_toRightOf="@id/viewPassengerMsgBoxButton" />
<ImageView
android:id="@+id/iv_temp"
android:layout_width="300dp"

View File

@@ -55,19 +55,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -1,71 +0,0 @@
package com.mogo.och.taxi;
import android.content.Context;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.commons.utils.LocationUtils;
import com.mogo.eagle.core.utilcode.util.ColorUtils;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import java.util.ArrayList;
import java.util.List;
public class TaxiOverlayManager {
private IMogoPolyline mMoGoPolyline;
// 连接线参数
private MogoPolylineOptions mPolylineOptions;
// 线路径集合
private List<MogoLatLng> mPolylinePointList;
// 渐变色
private List<Integer> mPolylineColors;
private Context mContext;
IMogoOverlayManager mogoOverlayManager;
public TaxiOverlayManager(Context context) {
mPolylineOptions = new MogoPolylineOptions();
// 绘制路径集合
mPolylinePointList = new ArrayList<>();
// 引导线颜色
mPolylineColors = new ArrayList<>();
mContext = context;
mogoOverlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager(context);
}
/**
* 绘制最优路线
*
* @param polylinePoint 要绘制的经纬度度集合
*/
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> polylinePoint) {
if (mMoGoPolyline != null) {
mMoGoPolyline.remove();
mPolylinePointList.clear();
mPolylineColors.clear();
}
if (polylinePoint != null) {
// 将当前车辆位置放进去
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
// 过滤后台推送的推荐路线集合
for (MogoLatLng polyline : polylinePoint) {
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
mPolylinePointList.add(polyline);
}
}
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
// 替换路径集合
mPolylineOptions.points(mPolylinePointList);
// 线条粗细,渐变,渐变色值
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
// 绘制线
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
}
return mMoGoPolyline;
}
}

View File

@@ -24,7 +24,6 @@ import androidx.fragment.app.FragmentTransaction;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.config.HmiBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
@@ -33,6 +32,9 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -75,6 +77,11 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
protected RelativeLayout mSettingBtn;
protected LinearLayout mBadcaseBtn;
protected LinearLayout mAICollectBtn;
//消息盒子
protected DriverMsgBoxButtonView driverMsgBoxButtonView;
protected DriverMsgBoxListView viewDriverMsgBoxList;
protected DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
protected TaxiAmapNaviFragment ochAmapNaviFragment = null;
protected TaxiRottingNaviFragment taxiRottingNaviFragment = null;
// protected TaxiTrafficLightView mTrafficLightView;
@@ -154,7 +161,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
mAnimFlowIv = findViewById(R.id.anim_flow_iv);
mAutopilotTv = findViewById(R.id.module_och_autopilot_tv);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
driverMsgBoxButtonView = findViewById(R.id.viewDriverMsgBoxButton);
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
// mTrafficLightView = findViewById(R.id.taxi_traffic_light_view);
// CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
@@ -202,9 +211,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
mBadcaseBtn = findViewById(R.id.module_och_taxi_badcase_ll);
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
mAICollectBtn = findViewById(R.id.module_och_taxi_ai_collect_ll);
@@ -270,6 +277,19 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
showAmapNaviToStationFragment(false);
showRottingToStationFragment(false);
});
driverMsgBoxButtonView.setClickListener(show -> {
if(show){
viewDriverMsgBoxList.setVisibility(View.VISIBLE);
viewDriverMsgBoxList.notifyData();
viewDriverMsgBoxBubble.setVisibility(View.GONE);
viewDriverMsgBoxBubble.isShowData(false);
}else{
viewDriverMsgBoxList.setVisibility(View.GONE);
viewDriverMsgBoxBubble.setVisibility(View.VISIBLE);
viewDriverMsgBoxBubble.isShowData(true);
}
});
}
protected void onChangeOperationStatus() {
@@ -292,9 +312,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
@Override
public void onDestroyView() {
super.onDestroyView();
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
@Override

View File

@@ -1,167 +0,0 @@
package com.mogo.och.taxi.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.common.module.wigets.OCHGradientTextView;
import com.mogo.och.taxi.R;
import org.jetbrains.annotations.Nullable;
/**
* Taxi司机端红绿灯view
*
* Created on 2022/3/29
*/
public class TaxiTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private OCHGradientTextView mLightTimeTV;
private int mCurrentLightId;
public TaxiTrafficLightView(@Nullable Context context) {
this(context, null, 0);
}
public TaxiTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public TaxiTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.taxi_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.taxi_traffic_light_iv);
mLightTimeTV = findViewById(R.id.taxi_traffic_light_time_tv);
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
@Override
public void showWarningTrafficLight(int checkLightId,int lightSource) {
super.showWarningTrafficLight(checkLightId,lightSource);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
TaxiTrafficLightView.this.setVisibility(GONE);
});
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_traffic_light_red_color_up),
getResources().getColor(R.color.taxi_traffic_light_red_color_down)});
mLightTimeTV.setText(String.valueOf(redNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_traffic_light_green_color_up),
getResources().getColor(R.color.taxi_traffic_light_green_color_down)});
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_traffic_light_yellow_color_up),
getResources().getColor(R.color.taxi_traffic_light_yellow_color_down)});
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
mLightTimeTV.setText("");
}
});
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.taxi_light_red_nor);
TaxiTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.taxi_lightyellow_nor);
TaxiTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.taxi_light_green_nor);
TaxiTrafficLightView.this.setVisibility(VISIBLE);
break;
default:
TaxiTrafficLightView.this.setVisibility(GONE);
break;
}
});
}
}

View File

@@ -85,11 +85,116 @@
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:visibility="gone"
app:marginStart="@dimen/dp_640"
app:marginTop="@dimen/dp_80"
android:layout_marginStart="@dimen/dp_640"
android:layout_marginTop="@dimen/dp_80"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--APP、MAP版本-->
<com.mogo.eagle.core.function.hmi.ui.widget.VersionNameView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="45dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--超视距-->
<com.mogo.eagle.core.function.hmi.ui.widget.CameraView
android:id="@+id/ivCameraIcon"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="40dp"
app:layout_constraintRight_toLeftOf="@id/viewTrafficLightVr"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="60dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
tools:visibility="visible"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
/>
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/viewTrafficLightVr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/hmi_traffic_light_layout_margin_top"
android:layout_marginEnd="@dimen/hmi_traffic_light_layout_margin_right"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--接管提示-->
<com.mogo.eagle.core.function.hmi.ui.takeover.TakeOverView
android:layout_width="@dimen/hmi_take_over_request_width"
android:layout_height="@dimen/hmi_take_over_request_height"
android:layout_marginTop="@dimen/hmi_take_over_request_m_top"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--隐藏态下的 美化模式按钮-->
<com.mogo.eagle.core.function.hmi.ui.switch.DemoModeHiddenSwitch
android:layout_width="120dp"
android:layout_height="100dp"
android:layout_marginStart="40dp"
android:layout_marginBottom="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<FrameLayout
android:id="@+id/module_mogo_och_station_panel_container"
android:layout_width="wrap_content"

View File

@@ -39,14 +39,14 @@ if (!isAndroidTestBuild()) {
apply plugin: 'apm-plugin'
}
//if (!isAndroidTestBuild()) {
// apply plugin: 'bytex.threadOpt'
// thread_opt {
// enable !isReleaseBuild
// enableInDebug !isReleaseBuild
// logLevel "DEBUG"
// }
//}
if (!isAndroidTestBuild()) {
apply plugin: 'bytex.threadOpt'
thread_opt {
enable true
enableInDebug true
logLevel "DEBUG"
}
}
if (!isAndroidTestBuild()) {
apply plugin: 'LancetX'
@@ -55,13 +55,12 @@ if (!isAndroidTestBuild()) {
enableInDebug true
weaveGroup {
leak_canary_crash_fix {
enable !isReleaseBuild
}
anr_fix {
enable true
}
crash_fix {
enable true
}
}
}
}
@@ -211,6 +210,9 @@ android {
buildConfigField 'String', 'MAP_SDK_VERSION', "\"${MAP_SDK_VERSION}\""
buildConfigField 'String', 'MAP_SDK_OPT_VERSION', "\"${MAP_SDK_OPERATION_VERSION}\""
}
noop {
dimension "business"
}
busbase {
dimension "business"
}
@@ -254,6 +256,12 @@ android {
variantFilter { variant ->
def names = variant.flavors*.name
//要检查特定的构建类型请使用variant.buildType.name ==“ <buildType>”
// region 过滤noop 的flavors 不带och业务的
if (names.contains("noop")&&!names.contains("fPadLenovo")) {
//Gradle会忽略满足上述条件的所有变体
setIgnore(true)
}
// endregion
// region 过滤sweper 的flavors
if (names.contains("sweeper")&&!names.contains("fPadLenovoOchSweeper")) {
//Gradle会忽略满足上述条件的所有变体
@@ -329,7 +337,7 @@ dependencies {
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.lancetx_runtime
implementation rootProject.ext.dependencies.mogocustommap
implementation project(':core:function-impl:mogo-core-function-startup')
// // 暂不使用Shizuku-API
// implementation rootProject.ext.dependencies.shizuku_provider
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
@@ -354,7 +362,6 @@ dependencies {
androidTestImplementation rootProject.ext.dependencies.androidx_runner
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
androidTestImplementation rootProject.ext.dependencies.localbroadcastmanager
androidTestImplementation rootProject.ext.dependencies.mogo_v2x
// if (isAndroidTestBuild()) {
// implementation "com.mogo.thread.opt:lib:${THREAD_OPT_VERSION}"

View File

@@ -24,7 +24,7 @@ project.android.productFlavors {
buildConfigField 'int', 'GPS_PROVIDER', "1"
// 构建的应用身份类型,具体查看 README.md APP_IDENTITY_MODE规则
buildConfigField 'String', 'APP_IDENTITY_MODE', "\"Taxi_Driver_Base\""
buildConfigField 'String', 'APP_IDENTITY_MODE', "\"FPad_Noop_Base\""
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.1.104\""
// 构建的是否是演示(美化)模式

File diff suppressed because one or more lines are too long

View File

@@ -1,27 +1,12 @@
package com.mogo.launcher;
import android.content.Context;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.call.startup.CallerStartUpManager;
import com.mogo.eagle.core.function.main.MainMoGoApplication;
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.launcher.crash.CrashSystem;
import com.mogo.launcher.stageone.APMStartup;
import com.mogo.launcher.stageone.ARouterStartUp;
import com.mogo.launcher.stageone.ConfigStartUp;
import com.mogo.launcher.stageone.HttpDnsStartUp;
import com.rousetime.android_startup.StartupListener;
import com.rousetime.android_startup.StartupManager;
import com.rousetime.android_startup.model.LoggerLevel;
import com.rousetime.android_startup.model.StartupConfig;
import com.zhidaoauto.map.sdk.open.HDTypes;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.MapParams;
import org.greenrobot.eventbus.EventBus;
import com.mogo.launcher.startup.ARouterStartUp;
import com.mogo.launcher.startup.ConfigStartUp;
/**
* @author congtaowang
@@ -33,82 +18,12 @@ public class MogoApplication extends MainMoGoApplication {
@Override
public void onCreate() {
startUpInStage1();
ARouterStartUp.init(this);
ConfigStartUp.init(this);
CallerStartUpManager.initStageOne();
super.onCreate();
}
private final StartupListener startupListener = (l, costTimesModels) -> EventBus.getDefault().postSticky(costTimesModels);
/**
* 第一阶段初始化
*/
public void startUpInStage1() {
StartupConfig config = null;
if (DebugConfig.isDebug()) {
config = new StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.DEBUG)
.setOpenStatistics(true)
.setListener(startupListener)
.build();
} else {
config = new StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.NONE)
.setOpenStatistics(false)
.setAwaitTimeout(10000L)
.setListener(startupListener)
.build();
}
new StartupManager.Builder()
.addStartup(new HttpDnsStartUp())
.addStartup(new APMStartup())
.addStartup(new ConfigStartUp())
.addStartup(new ARouterStartUp())
.setConfig(config)
.build(this)
.start()
.await();
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// ThreadConfig.Builder builder = new ThreadConfig.Builder().listener(new ThreadConfig.TaskExecuteListener() {
// @Override
// public boolean isEnabled() {
// return true; // 如果返回true会有后续的回调如果返回false, 不会有后续的回调
// }
//
// @Override
// public void onExecutorBefore(@NonNull Runnable runnable, @NonNull ThreadConfig.TaskType type) {
// //每个任务执行前回调
//// if (type == ThreadConfig.TaskType.HandlerThread) {
////
////
//// }
// }
//
// @Override
// public void onExecutorAfter(@NonNull Runnable runnable, @NonNull ThreadConfig.TaskType type) {
// //每个任务执行后回调
// }
//
// /**
// * @param core 线程池的核心数
// * @param max 线程池的最大线程数
// * @param active 线程池正在活跃的任务数
// * @param completed 线程池已完成的任务数
// */
// @Override
// public void onExecutorStateChanged(@NonNull ThreadPoolExecutor pool, int core, int max, int active, long completed) {
// //线程池在执行过程,状态变化回调
// //Log.d("POOL", "core:" + core + ";max:" + max + ";active:" + active + ";completed:" + completed);
// }
// });
// builder.loggable(false);
// ThreadManager.INSTANCE.init(builder);
}
@Override
protected void initCrashConfig() {
CrashSystem crashSystem = CrashSystem.getInstance(this);
@@ -122,4 +37,4 @@ public class MogoApplication extends MainMoGoApplication {
super.initLogConfig();
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
}
}
}

View File

@@ -0,0 +1,32 @@
package com.mogo.launcher.lancet
import android.content.ComponentName
import android.content.Intent
import androidx.annotation.*
import com.knightboost.lancet.api.Origin
import com.knightboost.lancet.api.Scope.ALL
import com.knightboost.lancet.api.Scope.LEAF
import com.knightboost.lancet.api.annotations.*
@Keep
@Weaver
@Group("crash_fix")
class CrashFix {
/**
* 修正Android8.0及之后后台启动Service引起的崩溃
* java.lang.IllegalStateException: Not allowed to start service Intent {
* act=com.zhidao.cosupload.service.UPLOAD_ACTION cmp=com.mogo.launcher.f/com.zhidao.cosupload.service.UploadService }: app is in background uid UidRecord{6443b7b u0a404 LAST bg:+1m15s362ms idle change:idle procs:1 seq(0,0,0)}
*/
@Insert(mayCreateSuper = true)
@TargetClass("android.content.Context", scope = LEAF)
@TargetMethod(methodName = "startService")
fun fixStartServiceCrash(intent: Intent): ComponentName? {
return try {
Origin.call() as ComponentName?
} catch (t: Throwable) {
t.printStackTrace()
null
}
}
}

View File

@@ -1,25 +1,22 @@
package com.mogo.launcher.stageone
package com.mogo.launcher.startup
import android.app.Application
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.CleanUtils
import com.rousetime.android_startup.AndroidStartup
import java.lang.Exception
class ARouterStartUp : AndroidStartup<String>() {
override fun callCreateOnMainThread() = true
override fun create(context: Context): String {
object ARouterStartUp {
@JvmStatic
fun init(app: Application) {
try {
if (DebugConfig.isDebug()) {
ARouter.openDebug()
ARouter.openLog()
}
// 初始化 arouter
ARouter.init(context as Application?)
ARouter.init(app)
} catch (e: Exception) {
e.printStackTrace()
// 由于ARouter会在SP_AROUTER_CACHE.xml缓存路由表如果出现了被删除的情况会报错这里清除下就好了
@@ -27,8 +24,5 @@ class ARouterStartUp : AndroidStartup<String>() {
// 重启应用
AppUtils.relaunchApp()
}
return this.javaClass.simpleName
}
override fun waitOnMainThread() = false
}

View File

@@ -1,11 +1,9 @@
package com.mogo.launcher.stageone
package com.mogo.launcher.startup
import android.content.Context
import android.util.Log
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.app.AppConfigInfo.appBuildTime
import com.mogo.eagle.core.data.app.AppConfigInfo.workingBranchHash
import com.mogo.eagle.core.data.app.AppConfigInfo.workingBranchName
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
@@ -16,30 +14,25 @@ import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.launcher.BuildConfig
import com.mogo.launcher.R
import com.mogo.test.crashreport.CrashReportConstants
import com.rousetime.android_startup.AndroidStartup
import com.zhidaoauto.map.sdk.open.HDTypes
import com.zhidaoauto.map.sdk.open.MapAutoApi
import com.zhidaoauto.map.sdk.open.MapParams
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
class ConfigStartUp : AndroidStartup<Boolean>() {
object ConfigStartUp {
override fun callCreateOnMainThread() = true
override fun waitOnMainThread() = false
override fun create(context: Context): Boolean {
initDebugConfig(context)
@JvmStatic
fun init(context: Context) {
initDebugConfig()
initBuildConfig()
initOtherConfig(context)
return true
}
private fun initBuildConfig() {
// 初始化构建APP的时候的分支及提交HASH用于辅助定位问题
workingBranchName = BuildConfig.WORKING_BRANCH_NAME
workingBranchHash = BuildConfig.WORKING_BRANCH_HASH
appBuildTime = BuildConfig.APP_BUILD_TIME
AppConfigInfo.workingBranchName = BuildConfig.WORKING_BRANCH_NAME
AppConfigInfo.workingBranchHash = BuildConfig.WORKING_BRANCH_HASH
AppConfigInfo.appBuildTime = BuildConfig.APP_BUILD_TIME
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
FunctionBuildConfig.gpsProvider = BuildConfig.GPS_PROVIDER
// FunctionBuildConfig.gpsProvider = 2
@@ -70,7 +63,7 @@ class ConfigStartUp : AndroidStartup<Boolean>() {
FunctionBuildConfig.adasConnectIP = BuildConfig.ADAS_CONNECT_IP
}
private fun initDebugConfig(context: Context) {
private fun initDebugConfig() {
var mode = BuildConfig.NET_ENV
val envConfig = EnvChangeManager.getEnvConfig()
if (envConfig != null) {
@@ -86,73 +79,52 @@ class ConfigStartUp : AndroidStartup<Boolean>() {
DebugConfig.setMapOptVersion(BuildConfig.MAP_SDK_OPT_VERSION)
DebugConfig.setNeedUploadCoordinatesInTime(BuildConfig.IS_NEED_UPLOAD_COORDINATES_IN_TIME)
DebugConfig.setMultiDisplay(BuildConfig.IS_MULTI_DISPLAY)
}
private fun initOtherConfig(context: Context) {
// 配置BuglyAppIDMoGoEagleEye
CrashReportConstants.buglyAppID = "ac71228f85"
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) ||
AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
//控制HMI展示元素 将不用手动调用setXXXXXViewVisibility
HmiBuildConfig.isShowSpeedView = false
HmiBuildConfig.isShowAutopilotStatusView = false
HmiBuildConfig.isShowPerspectiveSwitchView = false
HmiBuildConfig.isShowToolsView = false
HmiBuildConfig.isShowBadCaseView = false
HmiBuildConfig.isShowUpgradeTipsView = false
}
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
// HmiBuildConfig.isShowBrakeLightView = false
// HmiBuildConfig.isShowTurnLightView = false
} else if (AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode)) {
HdMapBuildConfig.currentCarVrIconRes = R.raw.huanwei
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
//是否显示 红绿等
HmiBuildConfig.isShowTrafficLightView = false
//是否显示 限速UI
HmiBuildConfig.isShowLimitingVelocityView = false
//是否显示 路侧监控
HmiBuildConfig.isShowCameraView = false
//白天模式
FunctionBuildConfig.skinMode = 1
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
//是否显示 红绿等
HmiBuildConfig.isShowTrafficLightView = false
//是否显示 限速UI
HmiBuildConfig.isShowLimitingVelocityView = false
//是否显示 路侧监控
HmiBuildConfig.isShowCameraView = false
}
}
val mapParams = MapParams.init()
mapParams.setDebugMode(false) //todo 1-使用本地地图数据0-使用在线地图数据
//.setDataFileSource(1)
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_UP_CAR)
.setHDVisibileArray(intArrayOf(HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
HDTypes.ARROW.type,
HDTypes.STATION_BRIDGE.type,
HDTypes.ZEBRA_LINE.type,
HDTypes.GREEN_BELT.type,
HDTypes.DIVERSION.type,
HDTypes.SAFE_ISLAND.type,
HDTypes.ALPHANUMERIC.type,
HDTypes.GUARDBAR.type,
HDTypes.TRAFFIC_DEVICE.type,
HDTypes.CABLE.type,
HDTypes.SIGNAL_LINE.type))
//.setDataFileSource(1)
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_UP_CAR)
.setHDVisibileArray(intArrayOf(
HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
HDTypes.ARROW.type,
HDTypes.STATION_BRIDGE.type,
HDTypes.ZEBRA_LINE.type,
HDTypes.GREEN_BELT.type,
HDTypes.DIVERSION.type,
HDTypes.SAFE_ISLAND.type,
HDTypes.ALPHANUMERIC.type,
HDTypes.GUARDBAR.type,
HDTypes.TRAFFIC_DEVICE.type,
HDTypes.CABLE.type,
HDTypes.SIGNAL_LINE.type))
// .setZoom( 20 )
// .setPointToCenter( 0.734375f, 0.5f )
//todo 2D模式下需要注意ADAS部分遮挡

View File

@@ -31,7 +31,7 @@ buildscript {
classpath "com.mogo.cloud:hook:${HOOK_LOG_VERSION}"
classpath "com.mogo.cloud:bizconfig:${BIZCONFIG_VERSION}"
classpath 'com.volcengine:apm_insight_plugin:1.4.1'
// classpath "com.mogo.thread.opt:plg:${THREAD_OPT_VERSION}"
classpath "com.mogo.thread.opt:plg:${THREAD_OPT_VERSION}"
classpath 'com.mogo.cloud:systrace:1.0.1'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
classpath 'com.mogo.sticky:service:1.0.8'

View File

@@ -91,9 +91,7 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mogoobuold : 'com.zhidao.support.obu:mogoobu:1.0.0.33',
mogoobu : 'com.mogo.support.obu:mogo-obu:1.0.6',
mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.24',
mogoobu : 'com.mogo.support.obu:mogo-obu:1.1.0_beta0',
// google
googlezxing : "com.google.zxing:core:3.3.3",
@@ -183,8 +181,6 @@ ext {
mogo_core_utils : "com.mogo.eagle.core:utils:${MOGO_CORE_UTILS_VERSION}",
mogo_core_network : "com.mogo.eagle.core:network:${MOGO_CORE_NETWORK_VERSION}",
//========================= V2X SDK =========================
mogo_v2x : "com.mogo.v2x:v2x:${MOGO_V2X_SDK_VERSION}",
life_cycle_scope : "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0",
view_model_scope : "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0",
@@ -228,6 +224,8 @@ ext {
//========================= autosize ======================
androidautoSize : 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1',
thread_opt : "com.mogo.thread.opt:lib:${THREAD_OPT_VERSION}"
]
android = [
launcherApplicationId : "com.mogo.launcher",

View File

@@ -10,7 +10,7 @@ import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.d
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDataManager
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDispatcher
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightDispatcher
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
@@ -27,9 +27,9 @@ class FuncBizProvider : IMoGoFuncBizProvider {
cronTaskManager.startCronTask()
MogoTrafficLightManager.INSTANCE.initServer(context)
TrafficLightDispatcher.INSTANCE.initServer(context) //todo 红绿灯中心模块放入dataCenter
VipCarManager.INSTANCE.initServer(context)
SpeedLimitDataManager.getInstance().start()
TrafficLightDispatcher.INSTANCE.initServer(context) //todo 宏宇 放入dataCenter
SpeedLimitDispatcher.INSTANCE.initLimit(context) //todo 宏宇放入dataCenter
// RedLightWarningManager.INSTANCE.listenTrafficLight()
}

View File

@@ -4,7 +4,7 @@ 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.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
@@ -209,17 +209,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVP.content,
EventTypeEnum.TYPE_USECASE_ID_IVP.tts
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVP.content,
EventTypeEnum.TYPE_USECASE_ID_IVP.tts,
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
null,
true,
5000L
@@ -235,11 +235,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
CallerLogger.d("$M_V2X$TAG", "=====绿灯通行预警=====")
ThreadUtils.runOnUiThread {
val content = String.format(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
speed
)
val tts = String.format(
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
speed
)
if (content.isNullOrEmpty() || tts.isNullOrEmpty()) {
@@ -249,17 +249,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
content,
tts
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
content,
tts,
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
null,
true,
5000L

View File

@@ -0,0 +1,64 @@
package com.mogo.eagle.function.biz.v2x.speedlimit
import android.content.Context
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.zhjt.service_biz.BizConfig
/**
* @author lixiaopeng
* @description 对多个限速进行调度maprsu ...
* @since: 2023/1/12
*/
class SpeedLimitDispatcher : ILimitingVelocityListener {
companion object {
const val TAG = "SpeedLimitDispatcher"
val INSTANCE: SpeedLimitDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
SpeedLimitDispatcher()
}
}
private var mContext: Context? = null
//obu限速状态
private var hasObuStatus: Boolean = false
fun initLimit(context: Context) {
mContext = context
CallerLimitingVelocityListenerManager.addListener(TAG, this)
}
/**
* 地图限速数据
*/
// @BizConfig(FuncBizConfig.V2I, "", FuncBizConfig.BIZ_SLW) //todo arrow 重新考虑放的位置
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
when (sourceType) { // obu 优先级高于 map体现链路能力
DataSourceType.OBU -> {
hasObuStatus = limitingVelocity > 0
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
limitingVelocity,
sourceType
)
return
}
DataSourceType.MAP -> {
if (!hasObuStatus) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
limitingVelocity,
sourceType
)
}
}
else -> {}
}
}
fun destroy() {
CallerLimitingVelocityListenerManager.removeListener(TAG)
}
}

View File

@@ -1,65 +0,0 @@
package com.mogo.eagle.function.biz.v2x.trafficlight
import com.mogo.eagle.core.data.trafficlight.*
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
class TrafficLightHMIManager {
companion object {
const val TAG = "TrafficLightHMIManager"
val INSTANCE: TrafficLightHMIManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
TrafficLightHMIManager()
}
}
private var initView: Boolean = false
fun isWarningTrafficLightShow(): Boolean {
return CallerHmiManager.isWarningTrafficLightShow()
}
fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
currentTrafficLight?.let {
if (!initView) {
initView = true
CallerHmiManager.showWarningTrafficLight(0,1)
}
callerHMIToChangeLight(it)
}
}
private fun callerHMIToChangeLight(trafficLightStatus: TrafficLightStatus) {
val remain = if (trafficLightStatus.remain > 99) {
99
} else {
trafficLightStatus.remain
}
when {
trafficLightStatus.isGreen() || trafficLightStatus.isFlashGreen() -> {
CallerHmiManager.showWarningTrafficLight(3,1)
CallerHmiManager.changeCountdownGreen(remain)
// CallerHmiManager.changeCountdownRed(-1)
// CallerHmiManager.changeCountdownYellow(-1)
}
trafficLightStatus.isYellow() -> {
CallerHmiManager.showWarningTrafficLight(2,1)
CallerHmiManager.changeCountdownYellow(remain)
// CallerHmiManager.changeCountdownGreen(-1)
// CallerHmiManager.changeCountdownRed(-1)
}
trafficLightStatus.isRed() -> {
CallerHmiManager.showWarningTrafficLight(1,1)
CallerHmiManager.changeCountdownRed(remain)
// CallerHmiManager.changeCountdownGreen(-1)
// CallerHmiManager.changeCountdownYellow(-1)
}
}
}
fun hideTrafficLight() {
initView = false
CallerHmiManager.disableWarningTrafficLight()
}
}

View File

@@ -8,14 +8,13 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Liste
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.function.biz.v2x.trafficlight.TrafficLightHMIManager
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.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.function.biz.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 : IMoGoChassisLocationGCJ02Listener {
@@ -46,9 +45,8 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
mThreadHandler =
TrafficLightThreadHandler(Looper.getMainLooper(), {
//第一次查询路口时,如果红绿灯显示,则隐藏掉
if (firstLoopCrossRoad && TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallerTrafficLightListenerManager.resetTrafficLightData()
if (firstLoopCrossRoad) {
CallerTrafficLightListenerManager.resetTrafficLightStatus()
}
firstLoopCrossRoad = false
mLocation?.let { it ->
@@ -98,10 +96,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
2_000L
)
}
if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallerTrafficLightListenerManager.resetTrafficLightData()
}
CallerTrafficLightListenerManager.resetTrafficLightStatus()
CallerTrafficLightListenerManager.invokeTrafficRequestError()
})
@@ -137,8 +132,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
trafficLightResult = null
firstLoopCrossRoad = true
mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT)
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallerTrafficLightListenerManager.resetTrafficLightData()
CallerTrafficLightListenerManager.resetTrafficLightStatus()
}
}
}

View File

@@ -2,38 +2,43 @@ package com.mogo.eagle.function.biz.v2x.trafficlight.core
import android.content.Context
import android.os.Handler
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.trafficlight.*
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.function.biz.v2x.trafficlight.TrafficLightHMIManager
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
/**
* @author XuXinChao
* @description 对多个红绿灯信号来源进行统一调度AI云、工控机
* @description 对多个红绿灯信号来源进行统一调度AI云、工控机、OBU
* @优先级OBU,云,工控
* @since: 2022/4/28
*/
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLightListener {
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener {
companion object{
companion object {
const val TAG = "TrafficLightDispatcher"
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
TrafficLightDispatcher()
}
}
private var mContext: Context? = null
//是否有AI获取红绿灯灯态
private var hasAiLightStatus: Boolean = false
fun initServer(context: Context){
//obu数据
private var hasObuLightStatus: Boolean = false
fun initServer(context: Context) {
mContext = context
//注册监听AI云获取红绿灯状态,注册监听AI云进入路口,注册监听红绿灯请求失败
//注册监听AI云获取红绿灯状态
CallerTrafficLightListenerManager.addListener(TAG, this)
//注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
@@ -44,46 +49,57 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh
* @param trafficLights 感知红绿灯
*/
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
if(!hasAiLightStatus){
trafficLights?.let { it ->
var light :TrafficLight?= null
if(it.hasStraight()){
light = it.straight
}else if(it.hasLeft()){
light = it.left
}else if(it.hasRight()){
light = it.right
}else if(it.hasUTurn()){
light = it.uTurn
}
if(light == null){
//隐藏红绿灯显示
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
}else{
when (light.state) {
TrafficLightOuterClass.LightState.STATE_RED -> {
//红灯
CallerHmiManager.showWarningTrafficLight(1,2)
CallerHmiManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
//黄灯
CallerHmiManager.showWarningTrafficLight(2,2)
CallerHmiManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_GREEN -> {
//绿灯
CallerHmiManager.showWarningTrafficLight(3,2)
CallerHmiManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_OFF -> {
//黑灯,隐藏红绿灯显示
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
}
else -> {}
if (!hasObuLightStatus) {
if (!hasAiLightStatus) {
trafficLights?.let { it ->
var light: TrafficLight? = null
if (it.hasStraight()) {
light = it.straight
} else if (it.hasLeft()) {
light = it.left
} else if (it.hasRight()) {
light = it.right
} else if (it.hasUTurn()) {
light = it.uTurn
}
if (light == null) {
//隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
} else {
when (light.state) {
TrafficLightOuterClass.LightState.STATE_RED -> {
//红灯
CallerTrafficLightListenerManager.showTrafficLight(
TrafficLightEnum.RED,
DataSourceType.TELEMATIC
)
CallerTrafficLightListenerManager.changeCountdownRed(0)
}
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
//黄灯
CallerTrafficLightListenerManager.showTrafficLight(
TrafficLightEnum.YELLOW,
DataSourceType.TELEMATIC
)
CallerTrafficLightListenerManager.changeCountdownYellow(0)
}
TrafficLightOuterClass.LightState.STATE_GREEN -> {
//绿灯
CallerTrafficLightListenerManager.showTrafficLight(
TrafficLightEnum.GREEN,
DataSourceType.TELEMATIC
)
CallerTrafficLightListenerManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_OFF -> {
//黑灯,隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
}
else -> {}
}
}
}
}
}
}
}
@@ -92,21 +108,25 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh
* AI云获取红绿灯状态
*/
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult)
hasAiLightStatus = true
if (!hasObuLightStatus) {
updateTrafficLight(trafficLightResult)
hasAiLightStatus = true
}
}
/**
* 车辆进入路口
* 车辆进入路口回调
* @param enter true:进入路口false:离开路口
*/
override fun onEnterCrossRoad(enter: Boolean) {
if(!enter){
if (!enter) {
Handler().postDelayed({
hasAiLightStatus = false
hasObuLightStatus = false
}, 5000)
//如果没有OBU灯态则进行隐藏如果有OBU灯态则交由OBU管理
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
}
}
/**
@@ -114,11 +134,45 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh
*/
override fun onTrafficRequestError() {
hasAiLightStatus = false
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
}
/**
* obu 红绿灯数据
*/
override fun onObuTrafficLightStatus(light: TrafficLightEnum) {
super.onObuTrafficLightStatus(light)
hasObuLightStatus = true
CallerTrafficLightListenerManager.showTrafficLight(light, DataSourceType.OBU)
}
fun destroy(){
//取消注册监听AI云获取红绿灯状态,取消注册监听红绿灯请求失败,取消注册监听AI云进入路口
private fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
currentTrafficLight?.let {
val remain = if (it.remain > 99) {
99
} else {
it.remain
}
when {
it.isGreen() || it.isFlashGreen() -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.AICLOUD)
CallerTrafficLightListenerManager.changeCountdownGreen(remain)
}
it.isYellow() -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.AICLOUD)
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
}
it.isRed() -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.AICLOUD)
CallerTrafficLightListenerManager.changeCountdownRed(remain)
}
}
}
}
fun destroy() {
//取消注册监听AI云获取红绿灯状态
CallerTrafficLightListenerManager.removeListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)

View File

@@ -10,7 +10,7 @@ import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VIP
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2N
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
@@ -209,17 +209,17 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
val light = this.result?.currentRoadTrafficLight()
if (light != null && light.isGreen()) {
showWarning(
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.poiType,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.tts,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.poiType
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.content,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.tts,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType
)
} else {
showWarning(
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.poiType,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.tts,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.poiType
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.content,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.tts,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType
)
}
return@turnLightToGreen
@@ -228,10 +228,10 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
// 请求变灯失败,根据灯态来提示。 此处灯态未获取到
if (this.result == null || this.result?.currentRoadTrafficLight() == null) {
showWarning(
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试",
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试",
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType
)
return@turnLightToGreen
}
@@ -249,10 +249,10 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
"${temp}秒后重试"
}
showWarning(
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + time,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + time,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType
)
} else {
CallerLogger.d(

View File

@@ -54,16 +54,17 @@ dependencies {
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoami
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.mogoobu
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
@@ -71,8 +72,6 @@ dependencies {
implementation project(':libraries:mogo-adas')
implementation project(':foudations:mogo-commons')
}
}

View File

@@ -1,6 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.datacenter">
<application>
<receiver android:name=".obu.receiver.ObuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestTriggerRecognizedReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuRsuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_light_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuRsiReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu_rsi" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.datacenter.IDataCenterProvider
@Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE)
class DataCenterProvider: IDataCenterProvider {
override val functionName: String
get() = "DataCenterProvider"
override fun init(context: Context?) {
}
override fun onDestroy() {
}
}

View File

@@ -62,9 +62,9 @@ import java.util.concurrent.TimeUnit
/**
* 域控制器
* @author xiaoyuzhou
* @date 2021/9/22 8:43 下午
* 域控制器
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutopilotProvider :

View File

@@ -51,7 +51,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListener
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager.invokeAutopilotRotting
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory
import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.support.obu.ObuScene
@@ -534,8 +534,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
* @param obuWarningData 数据
*/
override fun onObuWarningData(header: MessagePad.Header?, obuWarningData: ObuWarningEvent.ObuWarningData?) {
CallerObuDcCombineListenerManager.invokeObuDcData(obuWarningData)
}
/**
* OBU 红绿灯预警信息
*

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.obu.mogo
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CommonUtils
import com.mogo.support.obu.MogoObuManager
/**
* @author xiaoyuzhou
@@ -33,12 +34,11 @@ class MoGoObuProvider : IMoGoObuProvider {
override fun init(context: Context) {
//obu融合数据
// MogoObuDcCombineManager.INSTANCE.init(context)
MogoObuDcCombineManager.INSTANCE.init(context)
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
//bus乘客版本obu功能去掉
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
) {
//不处理
} else {
@@ -54,9 +54,6 @@ class MoGoObuProvider : IMoGoObuProvider {
ipAddress,
CommonUtils.getIpAddressString()
)
//old obu
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
@@ -66,9 +63,6 @@ class MoGoObuProvider : IMoGoObuProvider {
ipAddress,
CommonUtils.getIpAddressString()
)
//old obu
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
}
}
}
@@ -78,9 +72,8 @@ class MoGoObuProvider : IMoGoObuProvider {
* 通过控制面板设置ip进行传递
*/
override fun connect(ipAddress: String) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
) {
//不处理
} else {
@@ -95,18 +88,16 @@ class MoGoObuProvider : IMoGoObuProvider {
CommonUtils.getIpAddressString()
)
//连接old obu
MogoPrivateObuManager.INSTANCE.connectObu(it, ipAddress)
}
}
}
override fun disConnect() {
MogoPrivateObuManager.INSTANCE.disConnectObu()
MogoPrivateObuNewManager.INSTANCE.disconnect()
}
override fun isConnected(): Boolean {
return MogoPrivateObuManager.INSTANCE.isConnected()
return MogoObuManager.getInstance().connectStatus == 1
}
}

View File

@@ -0,0 +1,668 @@
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
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.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.obucombine.IMoGoObuDcCombineListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
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.obucombine.CallerObuDcCombineListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.support.obu.constants.MogoObuConstants
import mogo.v2x.ObuWarningEvent
import mogo.v2x.ObuWarningEvent.*
import kotlin.math.roundToInt
/**
*
* @author lixiaopeng
* @since 2021/11/30
* @description 工控机融合数据
*/
class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener {
companion object {
val INSTANCE: MogoObuDcCombineManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
MogoObuDcCombineManager()
}
}
private var mContext: Context? = null
private val TAG = "MogoObuDcCombineManager"
fun init(context: Context) {
mContext = context
CallerObuDcCombineListenerManager.addListener(TAG, this)
}
fun destoryListener() {
CallerObuDcCombineListenerManager.removeListener(TAG)
}
/**
* 通过工控机中转的obu数据,包括rsirsmspat
*
*/
override fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMoGoObuDcCombineData obuWarningData = ${obuWarningData.toString()} ---obuWarningData.msgDataType = ${obuWarningData?.msgDataType}"
)
obuWarningData?.let {
when (obuWarningData.msgDataType) {
1 -> { //rsiEvent
onMogoObuDcRsiWarning(obuWarningData.rsiEvent)
}
2 -> { //RsmEvent
onMogoObuDcRsmWarning(obuWarningData.rsmEvent)
}
3 -> { //SpatEvent
onMogoObuDcSpatWarning(obuWarningData.spatEvent)
}
4 -> { //map
onMogoObuMapMath(obuWarningData.mapMatchData)
}
}
}
}
/**
* RSI预警信息 CvxRtiThreatIndInfo交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/
fun onMogoObuDcRsiWarning(rsiWarningData: RsiWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsiWarning ------> ${rsiWarningData.toString()}"
)
if (rsiWarningData != null && rsiWarningData.warningMsgList != null && rsiWarningData.warningMsgList.size > 0) {
var alertContent = ""
var ttsContent = "" //列表只有一项
var appId = rsiWarningData.warningMsgList[0].sceneType.toString()
val status = rsiWarningData.status
val level = rsiWarningData.warningMsgList[0].warningLevel
val direction = getMessageDirection(rsiWarningData.warningMsgList[0].targetPosition)
CallerLogger.d("${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuDcRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${rsiWarningData.warningMsgList[0].eventSerialNum} ---signSerialNum = ${rsiWarningData.warningMsgList[0].signSerialNum} --- direction = $direction -- targetPosition = ${rsiWarningData.warningMsgList[0].targetPosition}"
)
when (appId) {
// 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (rsiWarningData.warningMsgList[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
}
// MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType
// }
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
}
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
}
}
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
}
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (rsiWarningData.warningMsgList[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = V2iEventTypeEnum.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
}
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
}
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType
}
}
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //标牌是没有影响范围的
alertContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString()
)
}
// 拥堵
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
}
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
}
}
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${rsiWarningData.warningMsgList[0].distance} ---eventRadius = ${rsiWarningData.warningMsgList[0].eventRadius} --speedMaxLimit = ${rsiWarningData.warningMsgList[0].speedMaxLimit}"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
CallerHmiManager.disableWarningV2X((appId + direction.direction))
// 更新数据,删除标牌?
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
// ?.let {
// // 事件结束,还原车辆颜色
// it.threatLevel = 0x01
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficInfo(it)
// }
}
}
}
}
/**
* RSM预警信息 CvxPtcThreatIndInfo CvxPtcInfoIndInfo主车与弱势交通参与者之间的预警弱势交通参与者碰撞预警
*/
fun onMogoObuDcRsmWarning(rsmWarningData: RsmWarningData?) {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsmWarning ------> ${rsmWarningData.toString()}"
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participantOfOne != null) {
var v2xType = ""
if (rsmWarningData.participantOfOne.ptcType == 1) { //机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participantOfOne.ptcType == 2) { //非机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participantOfOne.ptcType == 3) { //行人
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction =
getMessageDirection(rsmWarningData.participantOfOne.targetPosition) //TODO 只有一个
if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) {
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsmWarning ---status---> ${rsmWarningData.status} --list status----> ${rsmWarningData.warningMsg.warningDataList.get(0).status} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList.get(0).status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(
WarningDirectionEnum.ALERT_WARNING_NON
)
}
},
true,
5000L
)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据 TODO 由于obu通过域控需要转换单位这里临时转换后面3.0不需要转换
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
// // 事件结束,还原交通参与者颜色
// it.threatLevel = 0x01
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
}
}
}
}
}
}
/**
* 红绿灯预警信息
*/
fun onMogoObuDcSpatWarning(spatWarningData: SpatWarningData?) {
CallerLogger.d("${M_OBU}${TAG}", "onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}")
handlerTrafficLight(
spatWarningData!!.warningType,
spatWarningData?.status,
spatWarningData?.lightsList
)
}
/**
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
fun onMogoObuMapMath(data: MapMatchData?) {
CallerLogger.d("${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView)
if(HmiBuildConfig.isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d("${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*0.02*3.6))} --- data.speedMaxLimit = ${data.speedMaxLimit}")
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),DataSourceType.OBU)
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1 ,DataSourceType.OBU)
}
}
}
}
}
/**
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
return when (targetClassification) {
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
}
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<ObuWarningEvent.SpatLight>) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
-> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerTrafficLightListenerManager.disableTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
}
}
}
private var isRedLight = false
private var isGreenLight = false
private var isShowGreenWave = false
private var isShowRunRedLight = false
/**
* 修改红绿灯
*/
@Synchronized
private fun changeTrafficLightStatus(
appId: Int,
lights: List<ObuWarningEvent.SpatLight>
) {
var ttsContent = ""
var alertContent = ""
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.e(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager currentLight = $currentLight ---currentLight.phaseID = ${currentLight.phaseID} ---appId = $appId ---isShowRunRedLight = $isShowRunRedLight ---isShowGreenWave = $isShowGreenWave"
)
// 闯红灯预警和绿波通行底层是互斥的
when (appId) {
0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
}
1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerHmiManager.disableWarningV2X(1667.toString())
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
CallerLogger.d("${M_OBU}${TAG}","MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent ")
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, null, true, 5000L)
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次
if (!isShowGreenWave) {
isShowGreenWave = true
CallerHmiManager.disableWarningV2X(1666.toString())
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}")
val adviceSpeed =
"${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}"
val adviceSpeedTts =
"${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}"
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.suggestMaxSpeed*3.6
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
)
}
}
}
}
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.BLACK, DataSourceType.TELEMATIC)
}
// 红灯
2, 3 -> {
if (!isRedLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isRedLight = true
}
isGreenLight = false
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.TELEMATIC)
val red = currentLight.countDown / 10
CallerTrafficLightListenerManager.changeCountdownRed(red)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isGreenLight = true
}
isRedLight = false
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.TELEMATIC)
val green = currentLight.countDown / 10
CallerTrafficLightListenerManager.changeCountdownGreen(green)
}
// 黄灯
7, 8 -> {
CallerHmiManager.disableWarningV2X(appId.toString())
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.TELEMATIC)
val yellow = currentLight.countDown / 10
CallerTrafficLightListenerManager.changeCountdownYellow(yellow)
}
}
}
}

View File

@@ -0,0 +1,92 @@
package com.mogo.eagle.core.function.datacenter.obu.adapter
import com.mogo.eagle.core.function.call.obu.*
import com.mogo.support.obu.OnMogoObuListener
import com.mogo.support.obu.constants.Define.ConnectStatus
import com.mogo.support.obu.model.*
/**
* 适配 OBU 回调监听分发,这里不做业务,只做数据包装及分发处理
* @author dong hong yu
*/
object MoGoObuListenerImpl : OnMogoObuListener() {
/**
* 连接状态
*
* @param connectStatus 连接状态
* @since 1.0.0
*/
override fun onConnectStatus(@ConnectStatus connectStatus: Int) {
//断开连接
if (connectStatus == 0) {
CallerObuConnectListenerManager.getObuStatusInfo().obuStatus = false
}
//连接成功
else if (connectStatus == 1) {
CallerObuConnectListenerManager.getObuStatusInfo().obuStatus = true
}
CallerObuConnectListenerManager.invokeObuConnectListener()
}
/**
* HV车辆基础信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuHvBasics(data: MogoObuHvBasicsData) {
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(data)
}
/**
* V2V预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRvWarning(data: MogoObuRvWarningData) {
CallerObuWarningRvListenerManager.invokeObuRvWarning(data)
}
/**
* 红绿灯预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) {
CallerObuWarningSpatListenerManager.invokeObuSpatWarning(data)
}
/**
* RSI预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
CallerObuWarningRsiListenerManager.invokeObuRsiWarning(data)
}
/**
* RSM预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData) {
CallerObuWarningRsmListenerManager.invokeObuRsmWarning(data)
}
/**
* 地图匹配结果
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData) {
CallerObuMapMathListenerManager.invokeObuMapMath(data)
}
}

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants

View File

@@ -1,10 +1,9 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuNewManager
import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuNewManager
import com.mogo.support.obu.model.MogoObuRvWarningData
import com.mogo.support.obu.model.advance.V2xWarning
import com.mogo.support.obu.model.advance.VehBasics

View File

@@ -1,16 +1,11 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuNewManager
import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuNewManager
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
import com.mogo.support.obu.model.advance.RsiWarning
import com.mogo.support.obu.model.advance.V2xWarning
import com.mogo.support.obu.model.advance.VehBasics
import com.mogo.support.obu.model.advance.WarningData
/**
* @author lixiaopeng

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.model.CvxHvInfoIndInfo

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.obu.mogo.utils
package com.mogo.eagle.core.function.datacenter.obu.utils
import android.util.Log
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.msgbox
import android.content.Context
import android.os.Looper
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb

View File

@@ -5,6 +5,7 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
@@ -13,6 +14,7 @@ import com.mogo.eagle.core.data.deva.scene.SceneTAG
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager.Companion.bindingCarManager
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigImpl
@@ -142,6 +144,10 @@ class DevaToolsProvider : IDevaToolsProvider {
traceManager.syncConfig()
}
override fun getEnvConfig(): EnvConfig? {
return EnvChangeManager.getEnvConfig()
}
override fun modifyCarInfo(callBack: (ModifyBindingcarInfo) -> Unit) {
bindingCarManager.modifyCarInfo(callBack)
}

View File

@@ -11,10 +11,19 @@ import androidx.lifecycle.LifecycleCoroutineScope
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.*
import com.zhjt.mogo_core_function_devatools.badcase.biz.*
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
@@ -27,7 +36,7 @@ import record_cache.RecordPanelOuterClass
import java.lang.ref.WeakReference
import java.util.concurrent.TimeUnit
internal object BadCaseManager : LifecycleEventObserver {
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener {
const val TAG = "BadCase"
@@ -96,6 +105,8 @@ internal object BadCaseManager : LifecycleEventObserver {
* 主动采集BadCase
*/
fun initBadCase(view: View) {
CallerAutopilotRecordListenerManager.addListener(TAG, this)
val activity = view.context as? FragmentActivity
?: throw IllegalStateException("please ensure context is FragmentActivity.")
view.setOnClickListener {
@@ -193,24 +204,62 @@ internal object BadCaseManager : LifecycleEventObserver {
}
}
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
super.onAutopilotRecordResult(recordPanel)
CallerLogger.d("$M_DEVA$TAG", "recordKey=${recordPanel.key},stat=${recordPanel.stat}")
if (BadCaseConfig.recordKeyList.contains(recordPanel.key)) {
if (recordPanel.stat == 100 || recordPanel.stat == 101) {
//成功结束录制
TipToast.shortTip(
"${
TimeUtils.millis2String(
System.currentTimeMillis(),
TimeUtils.getHourMinSecondFormat()
)
} bag录制成功"
)
}
if (recordPanel.stat == 200) {
//录制失败
TipToast.shortTip(
"${
TimeUtils.millis2String(
System.currentTimeMillis(),
TimeUtils.getHourMinSecondFormat()
)
} bag录制失败"
)
}
return
}
//在工控机taxi2.3.0版本和Bus2.4.0版本上不支持被动录包,不进行被动录包的弹窗
BadCaseConfig.dockerVersion?.let {
if (it.contains("taxi") && it.contains("2.3.0")) {
return
}
if (it.contains("bus") && it.contains("2.4.0")) {
return
}
}
//处于非美化模式下弹窗是地图数据采集任务时即type=2时不弹窗
if (!FunctionBuildConfig.isDemoMode && (recordPanel.stat == 100 || recordPanel.stat == 101) && recordPanel.type != 2) {
//只在司机屏生效,乘客屏不生效
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.RECORD, RecordBagMsg(
recordPanel.key, recordPanel.stat, recordPanel.id,
recordPanel.type, recordPanel.filename, recordPanel.note
)
)
)
}
}
}
override fun onStateChanged(source: LifecycleOwner, event: Event) {
}
}
internal fun RecordPanelOuterClass.RecordPanel.toRecord(): AutoPilotRecord =
AutoPilotRecord().also {
it.id = this.id
it.stat = this.stat
it.key = this.key.toString()
it.note = this.note
it.type = this.type
it.total = this.totalSize
it.fileName = this.filename
it.duration = this.duration.toDouble()
it.diskFree = this.diskFree
it.consumed = false
}

View File

@@ -373,6 +373,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
CallerLogger.d("${M_DEVA}${TAG}", "-- 收到工控机录制任务回调 -- $recordPanel")
ThreadUtils.runOnUiThread {
if (recordKey == null) {
recordKey = recordPanel.key.toString()

View File

@@ -4,6 +4,7 @@ import android.content.Context.MODE_PRIVATE
import android.os.Process
import com.mogo.commons.constants.*
import com.mogo.commons.debug.*
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.utilcode.mogo.storage.*
import com.mogo.eagle.core.utilcode.util.*
@@ -47,6 +48,11 @@ object EnvChangeManager {
}
}
fun getConfigNetMode(): Int {
val cache = getConfig()
return cache?.second ?: -1
}
fun getNetMode(): String {
val cache = getConfig()
return if (cache == null) {
@@ -88,6 +94,4 @@ object EnvChangeManager {
if (it.first == "010") 116.397446 else 112.582654,
if (it.first == "010") 39.909004 else 26.816478)
}
data class EnvConfig(val cityCode: String, val netMode: Int, val lat: Double, val lon: Double)
}

View File

@@ -69,11 +69,10 @@ dependencies {
// debugImplementation rootProject.ext.dependencies.debugleakcanary
// releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.mogoobu
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.mogoami
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.cicle_indicator
implementation rootProject.ext.dependencies.koomnative
@@ -88,7 +87,6 @@ dependencies {
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_utils
api rootProject.ext.dependencies.mogo_core_network
api rootProject.ext.dependencies.mogo_core_function_obu_mogo
api rootProject.ext.dependencies.mogo_core_function_map
api rootProject.ext.dependencies.mogo_core_function_v2x
api rootProject.ext.dependencies.mogo_core_function_devatools
@@ -104,14 +102,12 @@ dependencies {
api project(':core:mogo-core-res')
api project(':core:mogo-core-data')
api project(':core:mogo-core-utils')
api project(':core:function-impl:mogo-core-function-obu-mogo')
api project(':core:function-impl:mogo-core-function-map')
api project(':core:function-impl:mogo-core-function-v2x')
api project(':core:function-impl:mogo-core-function-devatools')
api project(':core:function-impl:mogo-core-function-chat')
api project(':core:function-impl:mogo-core-function-datacenter')
api project(':core:function-impl:mogo-core-function-biz')
api project(':core:mogo-core-function-call')
api project(':libraries:mogo-adas')
api project(':libraries:map-usbcamera')

View File

@@ -3,7 +3,11 @@ package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import android.view.View
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
@@ -57,13 +61,13 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
* @param limitingVelocitySpeed 限速速度
*/
private fun dispatchShowWaring(limitingVelocitySpeed: Int) {
CallerHmiManager.showLimitingVelocity(limitingVelocitySpeed)
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(limitingVelocitySpeed,DataSourceType.MAP)
}
/**
* 关闭限速标志
*/
private fun dispatchCloseWaring() {
CallerHmiManager.disableLimitingVelocity()
CallerHmiViewControlListenerManager.invokeVisible(LimitingVelocityView_TAG, View.GONE)
}
}

View File

@@ -3,7 +3,9 @@ package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.WaringConst
/**
@@ -57,11 +59,17 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
* @param trafficLightCountDown 对应交通灯倒计时如果倒计时为0则disable
*/
private fun dispatchShowWaring(trafficLightCheckType: Int, trafficLightCountDown: Int) {
CallerHmiManager.showWarningTrafficLight(trafficLightCheckType,1)
val trafficLightType = when(trafficLightCheckType){
1 -> TrafficLightEnum.RED
2 -> TrafficLightEnum.YELLOW
3 -> TrafficLightEnum.GREEN
else -> TrafficLightEnum.BLACK
}
CallerTrafficLightListenerManager.showTrafficLight(trafficLightType,DataSourceType.DEFAULT)
when(trafficLightCheckType){
1 -> CallerHmiManager.changeCountdownRed(trafficLightCountDown)
2 -> CallerHmiManager.changeCountdownYellow(trafficLightCountDown)
3 -> CallerHmiManager.changeCountdownGreen(trafficLightCountDown)
1 -> CallerTrafficLightListenerManager.changeCountdownRed(trafficLightCountDown)
2 -> CallerTrafficLightListenerManager.changeCountdownYellow(trafficLightCountDown)
3 -> CallerTrafficLightListenerManager.changeCountdownGreen(trafficLightCountDown)
}
}
@@ -69,6 +77,6 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
* 关闭交通灯
*/
private fun dispatchCloseWaring() {
CallerHmiManager.disableWarningTrafficLight()
CallerTrafficLightListenerManager.disableTrafficLight()
}
}

View File

@@ -4,15 +4,17 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
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.function.call.v2x.CallerViewLimitingVelocityListenerManager
/**
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框
@@ -75,8 +77,8 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
ttsContent: String?,
tag: String?
) {
if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) {
CallerHmiManager.showLimitingVelocity(1)
if (EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType == v2xType.toString()) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(1,DataSourceType.MAP)
}
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-V2XWarningBR", "alertContent或ttsContent为空!")

View File

@@ -1,14 +1,13 @@
package com.mogo.eagle.core.function.hmi.ui
import android.content.Context
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.widget.FrameLayout
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
@@ -24,34 +23,21 @@ import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy.IViewNotificationProvider
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity
import com.mogo.eagle.core.function.api.hmi.view.IViewNotification
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
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.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog
@@ -63,12 +49,10 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView.Companion.toggleDebugView
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
import com.mogo.eagle.core.function.main.DisplayEffectsHelper
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -76,21 +60,13 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.reminder.api.IReminder
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.service_biz.BizConfig
import kotlinx.android.synthetic.main.fragment_hmi.*
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import record_cache.RecordPanelOuterClass
import kotlinx.coroutines.*
import java.util.concurrent.atomic.AtomicReference
/**
* @author xiaoyuzhou
@@ -100,217 +76,24 @@ import record_cache.RecordPanelOuterClass
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
IMoGoHmiProvider,
IMoGoHmiViewProxy,
MoGoHmiContract.View,
IMoGoAutopilotRecordListener,
IViewNotificationProvider {
MoGoHmiContract.View {
companion object {
private const val TAG = "MoGoHmiFragment"
}
//StatusView
private var statusBarView: StatusBarView? = null
// HMI 视图控件代理
// 红绿灯 View代理
private var mViewTrafficLight: IViewTrafficLight? = null
// 限速 View代理
private var mViewLimitingVelocity: IViewLimitingVelocity? = null
// V2X预警弹窗 View 代理
private var mViewNotificationProvider: IViewNotificationProvider? = null
private var lastSpeakJob: Job? = null
private val lastSpeakJob by lazy { AtomicReference<Job>() }
private var lastShowV2XJob: Job? = null
private var showingV2XTip: IReminder? = null
override fun initViews() {
initViewShowWithConfig()
// 同步AppInfo Config信息
CallerDevaToolsManager.syncConfig() //todo arrow 页面初始化 放到合适位置
//todo 抽象fragment能力 放入baseHmi
val decorView = requireActivity().window.decorView as FrameLayout
statusBarView = decorView.findViewWithTag<View>("status_bar") as StatusBarView?
//设置StatusBar初始状态
if (FunctionBuildConfig.isDemoMode) {
statusBarView?.updateRightView(true, "demoMode", DemoModeView(requireContext()))
} else {
statusBarView?.updateRightView(false, "demoMode", DemoModeView(requireContext()))
}
ivCameraIcon?.setOnClickListener {
cameraLiveView.showCameraList(
context,
CallerFuncBizManager.bizProvider.getCameraList
) { liveStatus ->
if (liveStatus) {
ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_selected)
} else {
ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_nor)
}
}
}
ivToolsIcon?.setOnClickListener {
toolsView.showToolsFloat(requireContext())
}
viewShowDebugView.setOnLongClickListener {
toggleDebugView.toggle(requireContext())
true
}
//美化模式隐藏开关
viewDemoModeSwitch.setOnClickListener {
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
//单次查询,是否有行程信息(订单进行中时点击不生效),autopilotControlParameters为null代表不处于自动驾驶状态下
if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) {
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
context?.let {
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(it)
)
}
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
}
}
}
cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewDriverMsgBoxList.visibility = View.VISIBLE
viewDriverMsgBoxList.notifyData()
viewDriverMsgBoxBubble.visibility = View.GONE
viewDriverMsgBoxBubble.isShowData(false)
CallerHmiManager.updateDriverMsgBoxTipView(false)
} else {
viewDriverMsgBoxList.visibility = View.GONE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
viewDriverMsgBoxBubble.isShowData(true)
}
}
cbMsgBoxPassenger.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewPassengerMsgBoxList.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.GONE
viewPassengerMsgBoxBubble.isShowData(false)
CallerHmiManager.updatePassengerMsgBoxTipView(false)
} else {
viewPassengerMsgBoxList.visibility = View.GONE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.isShowData(true)
}
}
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
cbMsgBoxDriver.visibility = View.VISIBLE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)
) {
cbMsgBoxPassenger.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
CallerAutopilotRecordListenerManager.addListener(TAG, this)
// 首次初始化使用默认视图
setProxyTrafficLightView(viewTrafficLightVr)
setProxyLimitingSpeedView(viewLimitingVelocity)
setViewNotificationProvider(this)
}
override fun getNotificationView(): IViewNotification? =
context?.let { V2XNotificationView(it) }
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) { //todo 数据中心
CallerLogger.d("$M_HMI$TAG", "recordKey=${recordPanel.key},stat=${recordPanel.stat}")
if (BadCaseConfig.recordKeyList.contains(recordPanel.key)) {
if (recordPanel.stat == 100 || recordPanel.stat == 101) {
//成功结束录制
TipToast.shortTip(
"${
millis2String(
System.currentTimeMillis(),
TimeUtils.getHourMinSecondFormat()
)
} bag录制成功"
)
}
if (recordPanel.stat == 200) {
//录制失败
TipToast.shortTip(
"${
millis2String(
System.currentTimeMillis(),
TimeUtils.getHourMinSecondFormat()
)
} bag录制失败"
)
}
return
}
//在工控机taxi2.3.0版本和Bus2.4.0版本上不支持被动录包,不进行被动录包的弹窗
BadCaseConfig.dockerVersion?.let {
if (it.contains("taxi") && it.contains("2.3.0")) {
return
}
if (it.contains("bus") && it.contains("2.4.0")) {
return
}
}
//处于非美化模式下弹窗是地图数据采集任务时即type=2时不弹窗
if (!FunctionBuildConfig.isDemoMode && (recordPanel.stat == 100 || recordPanel.stat == 101) && recordPanel.type != 2) {
//只在司机屏生效,乘客屏不生效
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.RECORD, RecordBagMsg(
recordPanel.key, recordPanel.stat, recordPanel.id,
recordPanel.type, recordPanel.filename, recordPanel.note
)
)
)
}
}
if (!FunctionBuildConfig.isDemoMode && recordPanel.type == 2 && (
recordPanel.stat == 101 || //工控机采集完成-被动完成
recordPanel.stat == 100 || //工控机采集完成-主动完成
recordPanel.stat == 102 || //工控机达到最大采集时长
recordPanel.stat == 103) //工控机磁盘满了
) {
CallerMapDataCollectorManager.finish(
recordPanel.id, recordPanel.stat, "", recordPanel.filename
?: "", recordPanel.note ?: ""
)
}
}
override fun onDestroyView() {
super.onDestroyView()
CallerAutopilotRecordListenerManager.removeListener(TAG)
}
/**
* ok
* 工控机重启返回结果 todo 确认数据源
* 工控机重启返回结果
* @param code
* @param msg
*/
@@ -352,121 +135,41 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
/** todo----------------------------------------------- **/
override fun setViewNotificationProvider(provider: IViewNotificationProvider) {
mViewNotificationProvider = provider
}
override fun setStatusBarDarkOrLight(light: Boolean) {
statusBarView?.setStatusBarDarkOrLight(light)
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(StatusBarView.TAG, light)
}
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
statusBarView?.updateRightView(insert, tag, viewGroup)
CallerHmiViewControlListenerManager.updateStatusBarRightView(
StatusBarView.TAG,
insert,
tag,
viewGroup
)
}
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
statusBarView?.updateLeftView(insert, tag, viewGroup)
CallerHmiViewControlListenerManager.updateStatusBarLeftView(
StatusBarView.TAG,
insert,
tag,
viewGroup
)
}
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
statusBarView?.updateProgressView(insert, tag, progress)
CallerHmiViewControlListenerManager.updateStatusBarDownloadView(
StatusBarView.TAG,
insert,
tag,
progress
)
}
override fun updateMfStatus(tag: String, status: Boolean) {
statusBarView?.updateMfStatus(tag, status)
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG, tag, status)
}
override fun updateDriverMsgBoxTipView(show: Boolean) {
if (show) {
MsgBoxTipView.visibility = View.VISIBLE
} else {
MsgBoxTipView.visibility = View.GONE
}
}
override fun updatePassengerMsgBoxTipView(show: Boolean) {
if (show) {
MsgBoxPTipView.visibility = View.VISIBLE
} else {
MsgBoxPTipView.visibility = View.GONE
}
}
/**
* 设置 红绿灯 代理View
*/
override fun setProxyTrafficLightView(view: IViewTrafficLight) {
mViewTrafficLight = view
}
/**
* 设置 限速 代理View
*/
override fun setProxyLimitingSpeedView(view: IViewLimitingVelocity) {
mViewLimitingVelocity = view
}
/**
* 根据配置文件初始化视图显示
*/
private fun initViewShowWithConfig() {
// 控制 速度 展示
if (HmiBuildConfig.isShowSpeedView) {
setSpeedChartViewVisibility(View.VISIBLE)
} else {
setSpeedChartViewVisibility(View.GONE)
}
// 控制 自动驾驶状态 展示
if (HmiBuildConfig.isShowAutopilotStatusView) {
setAutopilotStatusViewVisibility(View.VISIBLE)
} else {
setAutopilotStatusViewVisibility(View.GONE)
}
// 控制 切换视角 展示
if (HmiBuildConfig.isShowPerspectiveSwitchView) {
setPerspectiveSwitchViewVisibility(View.VISIBLE)
} else {
setPerspectiveSwitchViewVisibility(View.GONE)
}
// 控制 切换视角 展示
if (HmiBuildConfig.isShowToolsView) {
setToolsViewVisibility(View.VISIBLE)
} else {
setToolsViewVisibility(View.GONE)
}
// 控制 BadCase 按钮展示
if (HmiBuildConfig.isShowBadCaseView) {
ivBadCaseTools.visibility = View.VISIBLE
ivAiCollectTools.visibility = View.VISIBLE
CallerDevaToolsManager.initBadCase(ivBadCaseTools) //todo 新超 封装在hmi view
CallerDevaToolsManager.initAiCollect(ivAiCollectTools) //todo 新超 封装在hmi view
} else {
ivBadCaseTools.visibility = View.GONE
ivAiCollectTools.visibility = View.GONE
}
// 控制 红绿灯 展示
if (HmiBuildConfig.isShowTrafficLightView) {
setTrafficLightVrVisibility(View.VISIBLE)
} else {
setTrafficLightVrVisibility(View.GONE)
}
// 控制 远程摄像头图标 展示
if (HmiBuildConfig.isShowCameraView) {
setCameraViewVisibility(View.VISIBLE)
} else {
setCameraViewVisibility(View.GONE)
}
}
/** todo----------------------------------------------- **/
override fun getLayoutId(): Int {
return R.layout.fragment_hmi
}
@@ -483,31 +186,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
DisplayEffectsHelper.getInstance().display()
}
/** todo----------------------------------------------- **/
override fun setSpeedChartViewVisibility(visibility: Int) {
viewSpeedChart?.visibility = visibility
}
override fun setTrafficLightVrVisibility(visibility: Int) {
mViewTrafficLight?.visibility = visibility
}
override fun setAutopilotStatusViewVisibility(visibility: Int) {
viewAutopilotStatus?.visibility = visibility
}
override fun setPerspectiveSwitchViewVisibility(visibility: Int) {
viewPerspectiveSwitch?.visibility = visibility
}
override fun setToolsViewVisibility(visibility: Int) {
ivToolsIcon?.visibility = visibility
}
override fun setCameraViewVisibility(visibility: Int) {
ivCameraIcon?.visibility = visibility
}
/** todo----------------------------------------------- **/
/**
* 不展示顶部弹窗,其它保留
@@ -526,7 +204,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
activity?.let {
val warningContent = alertContent
?: EventTypeEnum.getWarningContent(v2xType)
?: EventTypeEnumNew.getWarningContent(v2xType)
//占道施工预警
if (v2xType == "10006" || v2xType == "100061") {
@@ -551,10 +229,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
"$M_HMI$TAG",
"--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime"
)
lastShowV2XJob?.safeCancel()
lastSpeakJob?.safeCancel()
lifecycleScope.launch {
delay(expireTime)
}.also { itx ->
@@ -565,10 +240,18 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
lifecycleScope.launch {
val last = lastSpeakJob.get()
Log.d("CODE", "---- 0 ------: last: $last")
if (last != null && !last.isCompleted) {
Log.d("CODE", "---- 1 ------")
return
}
lifecycleScope.launch(Dispatchers.Default) {
Log.d("CODE", "---- 2 ------")
speak(it, ttsContent)
Log.d("CODE", "---- 3 ------")
}.also { itx ->
lastSpeakJob = itx
lastSpeakJob.set(itx)
}
}
}
@@ -611,81 +294,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认不亮起1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) {
mViewTrafficLight?.showWarningTrafficLight(checkLightId, lightSource)
}
override fun isWarningTrafficLightShow(): Boolean {
return mViewTrafficLight?.visibility == View.VISIBLE
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
override fun disableWarningTrafficLight() {
mViewTrafficLight?.disableWarningTrafficLight()
}
/**
* 关闭红绿灯倒计时
*/
override fun disableWarningTrafficLightCountDown() {
mViewTrafficLight?.disableCountdown()
}
override fun changeCountdownRed(redNum: Int) {
mViewTrafficLight?.changeCountdownRed(redNum)
}
override fun changeCountdownYellow(yellowNum: Int) {
mViewTrafficLight?.changeCountdownYellow(yellowNum)
}
override fun changeCountdownGreen(greenNum: Int) {
mViewTrafficLight?.changeCountdownGreen(greenNum)
}
/**
* @param readNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
mViewTrafficLight?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
}
/**
* 控制展示限速标志及内容
*/
override fun showLimitingVelocity(limitingSpeed: Int) {
// 控制 限速UI 展示
if (HmiBuildConfig.isShowLimitingVelocityView) {
if (limitingSpeed > 0) {
mViewLimitingVelocity?.visibility = View.VISIBLE
mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed)
} else {
mViewLimitingVelocity?.visibility = View.INVISIBLE
mViewLimitingVelocity?.updateLimitingSpeed(0)
}
} else {
disableLimitingVelocity()
}
}
/**
* 控制关闭限速标志及内容
*/
override fun disableLimitingVelocity() {
mViewLimitingVelocity?.visibility = View.GONE
mViewLimitingVelocity?.updateLimitingSpeed(0)
}
/**
* 展示指定方位上的红框预警
* @param direction
@@ -837,7 +445,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight = $light ---isLeftLight = $isLeftLight ---isRightLight = $isRightLight"
)
if (HmiBuildConfig.isShowTurnLightView) {
ThreadUtils.runOnUiThread {
if (light == 1 || light == 2) {
if (!isVisualAngleChanged) {
@@ -885,7 +492,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
}
}
}
private var isBrake: Boolean = false
@@ -894,7 +500,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
* 显示刹车效果
*/
override fun showBrakeLight(light: Int) {
if (HmiBuildConfig.isShowBrakeLightView) {
ThreadUtils.runOnUiThread {
if (light == 1) { //刹车灯亮
if (!isBrake) {
@@ -915,8 +520,8 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
brakeView.setBrakeLight(light)
}
}
}
/** todo----------------------------------------------- **/
@@ -986,14 +591,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
override fun setTurnLightFunction(isOpen: Boolean) {
HmiBuildConfig.isShowTurnLightView = isOpen
}
override fun setBrakeLightFunction(isOpen: Boolean) {
HmiBuildConfig.isShowBrakeLightView = isOpen
}
override fun setSnBinding(isOpen: Boolean) {
HmiBuildConfig.isShowSnBindingView = isOpen
}
@@ -1035,7 +632,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
?.commitAllowingStateLoss()
// context?.let { CallerDevaToolsManager.showStatusBar(it, statusBarContainer) }
}
override fun onDestroy() {

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxBubbleAdapter
@@ -83,7 +84,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
}
}
if(isShowData){
CallerHmiManager.updateDriverMsgBoxTipView(true)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(category == MsgCategory.RECORD_BAG){
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
@@ -98,16 +99,12 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.addListener(TAG,this)
}
CallerMsgBoxListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.removeListener(TAG)
}
CallerMsgBoxListenerManager.removeListener(TAG)
}
}

View File

@@ -0,0 +1,90 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_driver_msg_box_button.view.*
/**
* @author XuXinChao
* @description 消息盒子司机端视图切换按钮
* @since: 2023/1/31
*/
class DriverMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
):ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener {
companion object {
const val TAG = "DriverMsgBoxButtonView"
}
private var clickListener: ClickListener? = null
init{
LayoutInflater.from(context).inflate(R.layout.view_driver_msg_box_button, this, true)
initView()
}
private fun initView(){
cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked ->
clickListener?.showMsgBoxList(isChecked)
msgBoxTipView.visibility = View.GONE
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxEventListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxEventListenerManager.removeListener(TAG)
}
override fun onSummaryClickEvent() {
}
/**
* 更新新消息提醒红点
* @param isShow true:展示false:不展示
*/
override fun onUpdateTipEvent(isShow: Boolean) {
if(isShow){
msgBoxTipView.visibility = View.VISIBLE
}else{
msgBoxTipView.visibility = View.GONE
}
}
override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) {
cbMsgBoxDriver.performClick()
}
override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) {
cbMsgBoxDriver.performClick()
}
override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) {
cbMsgBoxDriver.performClick()
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener{
fun showMsgBoxList(show: Boolean)
}
}

View File

@@ -7,16 +7,16 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxListAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.*
import org.greenrobot.eventbus.EventBus
@@ -32,7 +32,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener {
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true)
@@ -43,11 +43,13 @@ class DriverMsgBoxListView @JvmOverloads constructor(
private var ipcReportList: ArrayList<MsgBoxBean> ?= null
private var badCaseList: ArrayList<MsgBoxBean> ?= null
private var driverMsgBoxListAdapter: DriverMsgBoxListAdapter ?=null
private var linearLayoutManager: LinearLayoutManager ?= null
private fun initView() {
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context as Activity)
rvMsgBoxList.adapter = driverMsgBoxListAdapter
rvMsgBoxList.layoutManager = LinearLayoutManager(context)
linearLayoutManager = LinearLayoutManager(context)
rvMsgBoxList.layoutManager = linearLayoutManager
//获取通知消息列表
noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList<MsgBoxBean>?
@@ -171,13 +173,21 @@ class DriverMsgBoxListView @JvmOverloads constructor(
when (category) {
MsgCategory.NOTICE -> {
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
MsgCategory.SYS_INFO -> {
ipcReportList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 1){
ipcReportList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
MsgCategory.RECORD_BAG -> {
badCaseList?.add(0,msgBoxList)
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
if(MsgBoxConfig.getUserRecord() == 2){
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
}
}
@@ -185,18 +195,16 @@ class DriverMsgBoxListView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.addListener(TAG,this)
EventBus.getDefault().register(this)
}
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
EventBus.getDefault().register(this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -206,4 +214,36 @@ class DriverMsgBoxListView @JvmOverloads constructor(
it.remove(msgBoxList)
}
}
override fun onSummaryClickEvent() {
}
override fun onUpdateTipEvent(isShow: Boolean) {
}
override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) {
MsgBoxConfig.setUserRecord(0)
notifyData()
noticeList?.let {
rvMsgBoxList?.scrollToPosition(it.indexOf(msgBoxBean))
}
}
override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) {
MsgBoxConfig.setUserRecord(0)
notifyData()
noticeList?.let {
rvMsgBoxList?.scrollToPosition(it.indexOf(msgBoxBean))
}
}
override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) {
MsgBoxConfig.setUserRecord(1)
notifyData()
ipcReportList?.let {
linearLayoutManager?.scrollToPositionWithOffset(it.indexOf(msgBoxBean),0)
}
}
}

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxBubbleAdapter
@@ -64,7 +65,7 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
|| msgBoxList.type == MsgBoxType.OBU){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerHmiManager.updatePassengerMsgBoxTipView(true)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
dataList.add(msgBoxList)
passengerMsgBoxBubbleAdapter?.setData(dataList)
}
@@ -75,18 +76,12 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.addListener(TAG,this)
}
CallerMsgBoxListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.removeListener(TAG)
}
CallerMsgBoxListenerManager.removeListener(TAG)
}
}

View File

@@ -0,0 +1,89 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_passenger_msg_box_button.view.*
/**
* @author XuXinChao
* @description 消息盒子乘客端视图切换按钮
* @since: 2023/1/31
*/
class PassengerMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener {
companion object {
const val TAG = "PassengerMsgBoxButtonView"
}
private var clickListener: ClickListener? = null
init{
LayoutInflater.from(context).inflate(R.layout.view_passenger_msg_box_button, this, true)
initView()
}
private fun initView(){
cbMsgBoxPassenger.setOnCheckedChangeListener { _, isChecked ->
clickListener?.showMsgBoxList(isChecked)
msgBoxPTipView.visibility = View.GONE
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxEventListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxEventListenerManager.removeListener(TAG)
}
override fun onSummaryClickEvent() {
}
/**
* 更新新消息提醒红点
* @param isShow true:展示false:不展示
*/
override fun onUpdateTipEvent(isShow: Boolean) {
if(isShow){
msgBoxPTipView.visibility = View.VISIBLE
}else{
msgBoxPTipView.visibility = View.GONE
}
}
override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) {
cbMsgBoxPassenger.performClick()
}
override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) {
cbMsgBoxPassenger.performClick()
}
override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) {
cbMsgBoxPassenger.performClick()
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener{
fun showMsgBoxList(show: Boolean)
}
}

View File

@@ -11,7 +11,9 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
@@ -30,7 +32,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener {
private val TAG = "PassengerMsgBoxListView"
var passengerMsgBoxListAdapter: PassengerMsgBoxListAdapter ?= null
@@ -75,18 +77,36 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.addListener(TAG,this)
}
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
}
override fun onSummaryClickEvent() {
}
override fun onUpdateTipEvent(isShow: Boolean) {
}
override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) {
}
override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) {
noticeList?.let {
rvPassengerList.scrollToPosition(it.indexOf(msgBoxBean))
}
}
override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) {
}
}

View File

@@ -8,18 +8,20 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
/**
* @author XuXinChao
@@ -34,6 +36,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val notice: Int = 2
private val v2x: Int = 3
private val report: Int = 4
private val summary: Int = 5
var countDownTimer: CountDownTimer?=null
private var changeViewListener: ChangeViewListener?=null
@@ -47,89 +50,116 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == operation){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}else if(viewType == report){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}else if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
when (viewType) {
operation -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_summary,parent,false)
return BubbleSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BubbleOperationHolder){
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
}
}else if(holder is BubbleReportHolder){
data?.let {
val reportEntity = it[position].bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvBubbleReportType.text = resultStr
}
}else if(holder is BubbleNoticeHolder){
data?.let {
val msgBoxBean = it[position].bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
when (holder) {
is BubbleOperationHolder -> {
data?.let {
val msgBoxBean = it[position]
val operationMsg = msgBoxBean.bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
holder.clBubbleOperationLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleOperationListener(msgBoxBean)
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
}
}
is BubbleReportHolder -> {
data?.let {
val msgBoxBean = it[position]
val reportEntity = msgBoxBean.bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvBubbleReportType.text = resultStr
holder.clReportLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleReportListener(msgBoxBean)
}
}
}
is BubbleNoticeHolder -> {
data?.let {
val msgBoxBean = it[position].bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
}
}
}
}
}
}else if(holder is BubbleV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
holder.clV2XLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean)
}
}
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
@@ -156,14 +186,16 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.OPERATION){
return operation
return if(data!![position].type == MsgBoxType.OPERATION){
operation
}else if(data!![position].type == MsgBoxType.REPORT){
return report
report
}else if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -172,12 +204,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvBubbleReportTime: TextView = itemView.findViewById(R.id.tvBubbleReportTime)
var tvBubbleReportType: TextView = itemView.findViewById(R.id.tvBubbleReportType)
var tvBubbleReceiveTime: TextView = itemView.findViewById(R.id.tvBubbleReceiveTime)
var clReportLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clReportLayout)
}
//运营平台
class BubbleOperationHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvBubbleOperationTime: TextView = itemView.findViewById(R.id.tvBubbleOperationTime)
var tvBubbleOperationContent: TextView = itemView.findViewById(R.id.tvBubbleOperationContent)
var clBubbleOperationLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clBubbleOperationLayout)
}
//Notice
@@ -194,6 +228,13 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var ivV2XImage: ImageView = itemView.findViewById(R.id.ivV2XImage)
var tvV2XTime: TextView = itemView.findViewById(R.id.tvV2XTime)
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
var clV2XLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clV2XLayout)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
fun setChangeListener(listener: ChangeViewListener){

View File

@@ -9,7 +9,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
@@ -28,198 +28,263 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
* @description 司机端消息盒子列表视图RecyclerView适配器
* @since: 2022/11/25
*/
class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Adapter<RecyclerView.ViewHolder>(){
class DriverMsgBoxListAdapter(private val activity: Activity) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: List<MsgBoxBean> ?= null
private var data: List<MsgBoxBean>? = null
private val operation: Int = 1
private val notice: Int = 2
private val v2x: Int = 3
private val obu: Int = 4
private val report: Int = 5
private val record: Int = 6
private val traffic: Int = 7
private val summary: Int = 8
//Error
val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
fun setData(data: List<MsgBoxBean>){
fun setData(data: List<MsgBoxBean>) {
this.data = data
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == record){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_bad_case,parent,false)
return BadCaseHolder(view)
}else if(viewType == report){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_ipc_report,parent,false)
return MsgBoxIpcReportHolder(view)
}else if(viewType == operation){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_operation,parent,false)
return MsgBoxOperation(view)
}else if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_notice,parent,false)
return MsgBoxNotice(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_v2x,parent,false)
return MsgBoxV2X(view)
when (viewType) {
record -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_bad_case, parent, false)
return BadCaseHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_ipc_report, parent, false)
return MsgBoxIpcReportHolder(view)
}
operation -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_operation, parent, false)
return MsgBoxOperation(view)
}
notice -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_notice, parent, false)
return MsgBoxNotice(view)
}
summary -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_summary, parent, false)
return MsgBoxSummary(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
return MsgBoxV2X(view)
}
}
}
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BadCaseHolder){
data?.let {
holder.tvBagReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBagRecordTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,activity,false)
}
}
}else if(holder is MsgBoxIpcReportHolder){
data?.let { it ->
holder.tvReportTimeNormal.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val reportEntity = (it[position].bean as ReportEntity)
if(reportEntity.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| reportEntity.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| reportEntity.resultList.contains(RESULT_REMOTEPILOT_DISABLE)){
//Error
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_error_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_error_open))
holder.tvReportLevelNormal.text = "Error"
holder.tvReportLevelOpen.text = "Error"
}else{
//Warning
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_warning_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_warning_open))
holder.tvReportLevelNormal.text = "Warning"
holder.tvReportLevelOpen.text = "Warning"
}
holder.tvReportTimeNormal.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTime.text =TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
holder.tvReportReasonOpen.text = "原因:${reportEntity.msg}"
var actionStr = ""
for (action in reportEntity.actionsList){
actionStr = "${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {
if(holder.tvReportLevelNormal.isVisible){
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_close),null,null,null)
holder.ivReportImageNormal.visibility = View.GONE
holder.tvReportLevelNormal.visibility = View.GONE
holder.tvReportTimeNormal.visibility = View.GONE
holder.tvReportTypeNormal.visibility = View.GONE
holder.ivReportImageOpen.visibility = View.VISIBLE
holder.tvReportLevelOpen.visibility = View.VISIBLE
holder.tvReportTimeOpen.visibility = View.VISIBLE
holder.tvReportTypeOpen.visibility = View.VISIBLE
holder.tvReportReasonOpen.visibility = View.VISIBLE
holder.tvReportActionOpen.visibility = View.VISIBLE
}else{
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_open),null,null,null)
holder.ivReportImageNormal.visibility = View.VISIBLE
holder.tvReportLevelNormal.visibility = View.VISIBLE
holder.tvReportTimeNormal.visibility = View.VISIBLE
holder.tvReportTypeNormal.visibility = View.VISIBLE
holder.ivReportImageOpen.visibility = View.GONE
holder.tvReportLevelOpen.visibility = View.GONE
holder.tvReportTimeOpen.visibility = View.GONE
holder.tvReportTypeOpen.visibility = View.GONE
holder.tvReportReasonOpen.visibility = View.GONE
holder.tvReportActionOpen.visibility = View.GONE
when (holder) {
is BadCaseHolder -> {
data?.let {
holder.tvBagReceiveTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvBagRecordTime.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean, activity, false)
}
}
}
}else if(holder is MsgBoxOperation){
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvOperationContentNormal.text = operationMsg.content
holder.tvOperationContentOpen.text = operationMsg.content
holder.tvOperationTime.text = TimeUtils.millis2String(operationMsg.timestamp,getHourMinFormat())
holder.tvOperationStatusSelect.setOnClickListener {
if(holder.ivOperationImageNormal.isVisible){
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_close),null,null,null)
holder.ivOperationImageNormal.visibility = View.GONE
holder.tvOperationTitleNormal.visibility = View.GONE
holder.tvOperationContentNormal.visibility = View.GONE
is MsgBoxIpcReportHolder -> {
data?.let { it ->
holder.tvReportTimeNormal.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
val reportEntity = (it[position].bean as ReportEntity)
if (reportEntity.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| reportEntity.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| reportEntity.resultList.contains(RESULT_REMOTEPILOT_DISABLE)
) {
//Error
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_error_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_error_open))
holder.tvReportLevelNormal.text = "Error"
holder.tvReportLevelOpen.text = "Error"
} else {
//Warning
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_warning_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_warning_open))
holder.tvReportLevelNormal.text = "Warning"
holder.tvReportLevelOpen.text = "Warning"
}
holder.tvReportTimeNormal.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList) {
resultStr =
"${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
holder.tvReportReasonOpen.text = "原因:${reportEntity.msg}"
var actionStr = ""
for (action in reportEntity.actionsList) {
actionStr =
"${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {
if (holder.tvReportLevelNormal.isVisible) {
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_close),
null,
null,
null
)
holder.ivReportImageNormal.visibility = View.GONE
holder.tvReportLevelNormal.visibility = View.GONE
holder.tvReportTimeNormal.visibility = View.GONE
holder.tvReportTypeNormal.visibility = View.GONE
holder.ivOperationImageOpen.visibility = View.VISIBLE
holder.tvOperationTitleOpen.visibility = View.VISIBLE
holder.tvOperationContentOpen.visibility = View.VISIBLE
}else{
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_open),null,null,null)
holder.ivOperationImageNormal.visibility = View.VISIBLE
holder.tvOperationTitleNormal.visibility = View.VISIBLE
holder.tvOperationContentNormal.visibility = View.VISIBLE
holder.ivReportImageOpen.visibility = View.VISIBLE
holder.tvReportLevelOpen.visibility = View.VISIBLE
holder.tvReportTimeOpen.visibility = View.VISIBLE
holder.tvReportTypeOpen.visibility = View.VISIBLE
holder.tvReportReasonOpen.visibility = View.VISIBLE
holder.tvReportActionOpen.visibility = View.VISIBLE
} else {
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_open),
null,
null,
null
)
holder.ivReportImageNormal.visibility = View.VISIBLE
holder.tvReportLevelNormal.visibility = View.VISIBLE
holder.tvReportTimeNormal.visibility = View.VISIBLE
holder.tvReportTypeNormal.visibility = View.VISIBLE
holder.ivOperationImageOpen.visibility = View.GONE
holder.tvOperationTitleOpen.visibility = View.GONE
holder.tvOperationContentOpen.visibility = View.GONE
holder.ivReportImageOpen.visibility = View.GONE
holder.tvReportLevelOpen.visibility = View.GONE
holder.tvReportTimeOpen.visibility = View.GONE
holder.tvReportTypeOpen.visibility = View.GONE
holder.tvReportReasonOpen.visibility = View.GONE
holder.tvReportActionOpen.visibility = View.GONE
}
}
}
}
}else if(holder is MsgBoxNotice){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
is MsgBoxOperation -> {
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvOperationContentNormal.text = operationMsg.content
holder.tvOperationContentOpen.text = operationMsg.content
holder.tvOperationTime.text =
TimeUtils.millis2String(operationMsg.timestamp, getHourMinFormat())
holder.tvOperationStatusSelect.setOnClickListener {
if (holder.ivOperationImageNormal.isVisible) {
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_close),
null,
null,
null
)
holder.ivOperationImageNormal.visibility = View.GONE
holder.tvOperationTitleNormal.visibility = View.GONE
holder.tvOperationContentNormal.visibility = View.GONE
holder.ivOperationImageOpen.visibility = View.VISIBLE
holder.tvOperationTitleOpen.visibility = View.VISIBLE
holder.tvOperationContentOpen.visibility = View.VISIBLE
} else {
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_open),
null,
null,
null
)
holder.ivOperationImageNormal.visibility = View.VISIBLE
holder.tvOperationTitleNormal.visibility = View.VISIBLE
holder.tvOperationContentNormal.visibility = View.VISIBLE
holder.ivOperationImageOpen.visibility = View.GONE
holder.tvOperationTitleOpen.visibility = View.GONE
holder.tvOperationContentOpen.visibility = View.GONE
}
}
}
}
}else if(holder is MsgBoxV2X){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is MsgBoxNotice -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if (noticeFrCloudMsg.type == 0) {
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
} else if (noticeFrCloudMsg.type == 1) {
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl)
.optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 ->
CallerHmiManager.showTrafficBanner(
it1
)
}
}
}
}
}
is MsgBoxV2X -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))
)
}
}
is MsgBoxSummary -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
@@ -229,26 +294,30 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
override fun getItemViewType(position: Int): Int {
return when(data!![position].type){
MsgBoxType.OPERATION -> operation
MsgBoxType.NOTICE -> notice
MsgBoxType.V2X -> v2x
MsgBoxType.OBU -> obu
MsgBoxType.REPORT -> report
MsgBoxType.RECORD -> record
MsgBoxType.TRAFFIC -> traffic
}
return if (data!![position].type == MsgBoxType.OPERATION) {
operation
} else if (data!![position].type == MsgBoxType.NOTICE) {
notice
} else if (data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY) {
summary
} else if (data!![position].type == MsgBoxType.REPORT) {
report
} else if (data!![position].type == MsgBoxType.RECORD) {
record
} else {
v2x
}
}
//录包实体
class BadCaseHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvBagRecordTime: TextView= itemView.findViewById(R.id.tvBagRecordTime)
class BadCaseHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tvBagRecordTime: TextView = itemView.findViewById(R.id.tvBagRecordTime)
var tvBagReceiveTime: TextView = itemView.findViewById(R.id.tvBagReceiveTime)
var tvRecordCheck: TextView = itemView.findViewById(R.id.tvRecordCheck)
}
//车辆系统信息
class MsgBoxIpcReportHolder(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxIpcReportHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivReportImageNormal: ImageView = itemView.findViewById(R.id.ivReportImageNormal)
var tvReportLevelNormal: TextView = itemView.findViewById(R.id.tvReportLevelNormal)
var tvReportTimeNormal: TextView = itemView.findViewById(R.id.tvReportTimeNormal)
@@ -264,10 +333,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
//运营平台
class MsgBoxOperation(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxOperation(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivOperationImageNormal: ImageView = itemView.findViewById(R.id.ivOperationImageNormal)
var tvOperationTitleNormal: TextView = itemView.findViewById(R.id.tvOperationTitleNormal)
var tvOperationContentNormal: TextView = itemView.findViewById(R.id.tvOperationContentNormal)
var tvOperationContentNormal: TextView =
itemView.findViewById(R.id.tvOperationContentNormal)
var tvOperationStatusSelect: TextView = itemView.findViewById(R.id.tvOperationStatusSelect)
var tvOperationTime: TextView = itemView.findViewById(R.id.tvOperationTime)
var ivOperationImageOpen: ImageView = itemView.findViewById(R.id.ivOperationImageOpen)
@@ -276,7 +346,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
//Notice
class MsgBoxNotice(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxNotice(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivNoticeImage: ImageView = itemView.findViewById(R.id.ivNoticeImage)
var tvNoticeTitle: TextView = itemView.findViewById(R.id.tvNoticeTitle)
var tvNoticeTime: TextView = itemView.findViewById(R.id.tvNoticeTime)
@@ -285,11 +355,17 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
//V2X,OBU
class MsgBoxV2X(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxV2X(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivV2XImage: ImageView = itemView.findViewById(R.id.ivV2XImage)
var tvV2XTime: TextView = itemView.findViewById(R.id.tvV2XTime)
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
}
//汇总消息
class MsgBoxSummary(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
}

View File

@@ -8,20 +8,18 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
/**
* @author XuXinChao
@@ -34,6 +32,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
var countDownTimer: CountDownTimer?=null
@@ -46,65 +45,86 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_notice,parent,false)
return BubbleNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false)
return BubbleV2XHolder(view)
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_notice,parent,false)
BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_summary,parent,false)
BubbleSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false)
BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BubbleNoticeHolder){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}
}
}else if(holder is BubbleV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
holder.clPassengerVeXLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean)
}
}
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
// CallerHmiManager.showSmallFragment()
CallerMsgBoxEventListenerManager.invokeSummaryListener()
}
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
@@ -125,10 +145,12 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -146,6 +168,14 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
var ivPassengerV2XImage: ImageView = itemView.findViewById(R.id.ivPassengerV2XImage)
var tvPassengerV2XTime: TextView = itemView.findViewById(R.id.tvPassengerV2XTime)
var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent)
var clPassengerVeXLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clPassengerVeXLayout)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvPassengerSummaryContent: TextView = itemView.findViewById(R.id.tvPassengerSummaryContent)
var tvPassengerSummaryCheck: TextView = itemView.findViewById(R.id.tvPassengerSummaryCheck)
var tvPassengerSummaryTime: TextView = itemView.findViewById(R.id.tvPassengerSummaryTime)
}
}

View File

@@ -7,14 +7,11 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
@@ -32,6 +29,7 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
fun setData(data: List<MsgBoxBean>){
this.data = data
@@ -39,61 +37,78 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_notice,parent,false)
ListNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_v2x,parent,false)
ListV2XHolder(view)
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_notice,parent,false)
ListNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_summary,parent,false)
ListSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_v2x,parent,false)
ListV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is ListNoticeHolder){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
when (holder) {
is ListNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}
}
}else if(holder is ListV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is ListV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
}
}
is ListSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
// CallerHmiManager.showSmallFragment()
CallerMsgBoxEventListenerManager.invokeSummaryListener()
}
}
}
}
@@ -102,10 +117,12 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -125,4 +142,11 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent)
}
//汇总消息
class ListSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvPassengerSummaryContent: TextView = itemView.findViewById(R.id.tvPassengerSummaryContent)
var tvPassengerSummaryCheck: TextView = itemView.findViewById(R.id.tvPassengerSummaryCheck)
var tvPassengerSummaryTime: TextView = itemView.findViewById(R.id.tvPassengerSummaryTime)
}
}

View File

@@ -82,8 +82,8 @@ class PncActionsView @JvmOverloads constructor(
//如果是存在云端红绿灯数据条件下,设置云端数据
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
&& mTrafficLightResult != null
&& getWaitTrafficlightTime().isNotBlank()) {
actions += ",预计${getWaitTrafficlightTime()}秒后通过"
&& getWaitTrafficLightTime().isNotBlank()) {
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
} else {
mTrafficLightResult = null
}
@@ -106,7 +106,7 @@ class PncActionsView @JvmOverloads constructor(
mTrafficLightResult = trafficLightResult
}
private fun getWaitTrafficlightTime(): String {
private fun getWaitTrafficLightTime(): String {
return if (mTrafficLightResult != null
&& mTrafficLightResult!!.currentRoadTrafficLight() != null
&& mTrafficLightResult!!.currentRoadTrafficLight()!!.isRed()

View File

@@ -16,6 +16,7 @@ import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.view.*
import androidx.lifecycle.lifecycleScope
import chassis.Chassis
import chassis.ChassisStatesOuterClass
import com.mogo.cloud.passport.MoGoAiCloudClient
@@ -37,14 +38,12 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.scene.SceneModule
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.gnss.AccelerationEntity
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuConnectListener
import com.mogo.eagle.core.function.business.routeoverlay.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
@@ -54,8 +53,8 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerSmpManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.hmi.R
@@ -63,6 +62,7 @@ import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
@@ -74,9 +74,12 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import com.zhidao.easysocket.utils.L
import com.mogo.support.obu.MogoObuManager
import com.mogo.support.obu.constants.MogoObuLogLevel
import com.mogo.support.obu.option.MogoObuLog
import com.zhjt.mogo_core_function_devatools.env.*
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import java.text.SimpleDateFormat
@@ -95,22 +98,21 @@ internal class DebugSettingView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr),
IMoGoObuStatusListener,
IMoGoAutopilotStatusListener,
IMoGoChassisLocationWGS84Listener,
IMoGoMapLocationListener,
IMoGoAutopilotIdentifyListener,
IMoGoPlanningRottingListener,
IMoGoPlanningTrajectoryListener,
IMoGoDevaToolsFuncConfigListener,
IMoGoChassisLamplightListener,
IMoGoDevaToolsListener,
IMoGoChassisAccStateListener,
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener,
IMoGoChassisBrakeStateListener,
IMoGoChassisThrottleStateListener,
IMoGoSweeperFutianCleanSystemListener{
IMoGoObuConnectListener,
IMoGoAutopilotStatusListener,
IMoGoChassisLocationWGS84Listener,
IMoGoAutopilotIdentifyListener,
IMoGoPlanningRottingListener,
IMoGoPlanningTrajectoryListener,
IMoGoDevaToolsFuncConfigListener,
IMoGoChassisLamplightListener,
IMoGoDevaToolsListener,
IMoGoChassisAccStateListener,
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener,
IMoGoChassisBrakeStateListener,
IMoGoChassisThrottleStateListener,
IMoGoSweeperFutianCleanSystemListener {
private val TAG = "DebugSettingView"
@@ -184,7 +186,7 @@ internal class DebugSettingView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 添加 OBU状态 监听
CallerObuListenerManager.addListener(TAG, this)
CallerObuConnectListenerManager.addListener(TAG, this)
// 添加 ADAS状态 监听
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
// 添加 ADAS车辆状态&定位 监听
@@ -215,7 +217,7 @@ internal class DebugSettingView @JvmOverloads constructor(
logInfoView!!.onEnterForeground()
}
// 开启定时查询速度
Timer().schedule(timerTaskRefresh, Date(), 100)
Timer().schedule(timerTaskRefresh, Date(), 300)
if (AppConfigInfo.isConnectAutopilot && (AppConfigInfo.plateNumber.isNullOrEmpty() || AppConfigInfo.iPCMacAddress.isNullOrEmpty())) {
//查询工控机基础配置信息
CallerAutoPilotManager.getCarConfig()
@@ -225,7 +227,7 @@ internal class DebugSettingView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 移除 OBU状态 监听
CallerObuListenerManager.removeListener(TAG)
CallerObuConnectListenerManager.removeListener(TAG)
// 移除 ADAS状态 监听
CallerAutoPilotStatusListenerManager.removeListener(TAG)
// 移除 ADAS车辆状态&定位 监听
@@ -249,7 +251,10 @@ internal class DebugSettingView @JvmOverloads constructor(
CallerChassisLamplightListenerManager.removeListener(TAG)
// 移除 业务配置监听
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG)
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener(
FuncBizConfig.FOUNDATION,
TAG
)
if (logInfoView != null) {
logInfoView!!.onEnterBackground()
@@ -547,7 +552,7 @@ internal class DebugSettingView @JvmOverloads constructor(
setLogCheckedChangeListener()
//OBU配置信息
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString()
tvObuInfo.text = CallerObuConnectListenerManager.getObuStatusInfoJsonString()
//工控机配置信息
tvAutopilotInfo.text =
@@ -567,14 +572,14 @@ internal class DebugSettingView @JvmOverloads constructor(
btnSetObuIP.setOnClickListener {
val obuIP = etObuIP.text.toString()
if (StringUtils.isValidIPAddress(obuIP)) {
CallerOBUManager.resetObuIpAddress(obuIP)
CallerObuApiManager.resetObuIpAddress(obuIP)
} else {
ToastUtils.showShort("请输入正确的IP地址")
}
}
btnDrawFusion.isChecked = FunctionBuildConfig.isFusionColor
btnDrawFusion.setOnCheckedChangeListener{_, isChecked ->
btnDrawFusion.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isFusionColor = isChecked
}
@@ -584,7 +589,11 @@ internal class DebugSettingView @JvmOverloads constructor(
// 演示模式
tbIsDemoMode.setOnCheckedChangeListener { _, _ ->
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
CallerHmiManager.updateStatusBarLeftView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(context))
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(context)
)
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
@@ -1027,49 +1036,6 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置Hmi点击监听
*/
private fun setHmiCheckedChangeListener() {
/**
* 显示、隐藏迈速表
*/
tbSpeedView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setSpeedChartViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setSpeedChartViewVisibility(View.GONE)
}
}
/**
* 显示、隐藏“自动驾驶控制按钮”
*/
tbAutopilotStatusView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setAutopilotStatusViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setAutopilotStatusViewVisibility(View.GONE)
}
}
/**
* 显示、隐藏视角切换按钮
*/
tbPerspectiveSwitchView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setPerspectiveSwitchViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setPerspectiveSwitchViewVisibility(View.GONE)
}
}
/**
* 显示、隐藏工具箱
*/
tbCheckStatusView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setToolsViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setToolsViewVisibility(View.GONE)
}
}
/**
* 隐藏、显示小地图
@@ -1082,29 +1048,6 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
/**
* 打开、关闭转向灯控制
*/
tbOpenLight.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setTurnLightFunction(true)
} else {
CallerHmiManager.setTurnLightFunction(false)
}
}
/**
* 打开、关闭刹车控制
*/
tbOpenBrakeLight.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setBrakeLightFunction(true)
} else {
CallerHmiManager.setBrakeLightFunction(false)
}
}
/**
* sn绑定控制
*/
@@ -1267,7 +1210,14 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置是否输出OBU日志 true-打印日志false-不打印日志
*/
tbObuLog.setOnCheckedChangeListener { _, isChecked ->
L.setEnableLog(isChecked)
MogoObuManager.getInstance().setEnableLog(isChecked)
val builder: com.mogo.support.obu.option.MogoObuLog.Builder =
MogoObuLog.newBuilder().setEnableStdio(isChecked)
if (isChecked) {
builder.setStdioLevel(MogoObuLogLevel.DBG)
}
MogoObuManager.getInstance().logConfig(builder.build())
}
/**
@@ -1686,10 +1636,10 @@ internal class DebugSettingView @JvmOverloads constructor(
}"
)
tvAutopilotInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
tvIpcInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
tvIpcInfoKey.text = GsonUtils.toJson(mAutoPilotStatusInfo)
val autopilotJson = GsonUtils.toJson(mAutoPilotStatusInfo)
tvAutopilotInfo.text = autopilotJson
tvIpcInfo.text = autopilotJson
tvIpcInfoKey.text = autopilotJson
tvCarInfo.text =
"GPS时间${(mGnssInfo?.satelliteTime?.times(1000))?.toLong()}\n" +
@@ -1722,9 +1672,9 @@ internal class DebugSettingView @JvmOverloads constructor(
mTrajectoryInfoSize = 0
mRouteInfoSize = 0
if(FunctionBuildConfig.isDemoMode){
if (FunctionBuildConfig.isDemoMode) {
tbIsDemoMode.text = "关闭美化模式"
}else{
} else {
tbIsDemoMode.text = "开启美化模式"
}
@@ -1733,19 +1683,21 @@ internal class DebugSettingView @JvmOverloads constructor(
/**
* OBU状态回调
*/
override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) {
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
override fun onConnectStatus(obuStatusInfo: ObuStatusInfo) {
lifecycleOwner.lifecycleScope.launch {
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
if (obuStatusInfo.obuStatus) {
obuConnectStatus = true
}
//OBU断开连接提示异常
if (obuConnectStatus && !obuStatusInfo.obuStatus) {
obuConnectStatus = false
toastMsg("OBU连接状态异常")
if (obuStatusInfo.obuStatus) {
obuConnectStatus = true
}
//OBU断开连接提示异常
if (obuConnectStatus && !obuStatusInfo.obuStatus) {
obuConnectStatus = false
toastMsg("OBU连接状态异常")
}
}
}
@@ -1811,7 +1763,7 @@ internal class DebugSettingView @JvmOverloads constructor(
when (type) {
BIZ_BEAUTY_MODE -> {
tbIsDemoMode.isClickable = !lock
val (left,top,right,bottom) = tbIsDemoMode.currentPadding()
val (left, top, right, bottom) = tbIsDemoMode.currentPadding()
if (lock) {
tbIsDemoMode.background =
resources.getDrawable(R.drawable.radio_button_lock_background)
@@ -1819,11 +1771,11 @@ internal class DebugSettingView @JvmOverloads constructor(
tbIsDemoMode.background =
resources.getDrawable(R.drawable.radio_button_normal_background_right)
}
tbIsDemoMode.setPadding(left,top,right,bottom)
tbIsDemoMode.setPadding(left, top, right, bottom)
}
BIZ_RAIN_MODE -> {
tbIsRainMode.isClickable = !lock
val (left,top,right,bottom) = tbIsRainMode.currentPadding()
val (left, top, right, bottom) = tbIsRainMode.currentPadding()
if (lock) {
tbIsRainMode.background =
resources.getDrawable(R.drawable.radio_button_lock_background)
@@ -1831,21 +1783,21 @@ internal class DebugSettingView @JvmOverloads constructor(
tbIsRainMode.background =
resources.getDrawable(R.drawable.radio_button_normal_background_right)
}
tbIsRainMode.setPadding(left,top,right,bottom)
tbIsRainMode.setPadding(left, top, right, bottom)
}
BIZ_WARNING_UPLOAD -> {
tbReportWarning.isClickable = !lock
val (left,top,right,bottom) = tbReportWarning.currentPadding()
val (left, top, right, bottom) = tbReportWarning.currentPadding()
if (lock) {
tbReportWarning.background =
resources.getDrawable(R.drawable.radio_button_lock_background)
} else {
tbReportWarning.background = null
}
tbReportWarning.setPadding(left,top,right,bottom)
tbReportWarning.setPadding(left, top, right, bottom)
}
BIZ_BAG_RECORD -> {
val (left,top,right,bottom) = btnRecordBag.currentPadding()
val (left, top, right, bottom) = btnRecordBag.currentPadding()
if (lock) {
btnRecordBag.isClickable = false
btnRecordBag.background =
@@ -1855,10 +1807,10 @@ internal class DebugSettingView @JvmOverloads constructor(
btnRecordBag.requestFocus()
btnRecordBag.background = null
}
btnRecordBag.setPadding(left,top,right,bottom)
btnRecordBag.setPadding(left, top, right, bottom)
}
BIZ_FULL_LOG -> {
val (left,top,right,bottom) = tbLogCatch.currentPadding()
val (left, top, right, bottom) = tbLogCatch.currentPadding()
if (lock) {
tbLogCatch.isClickable = false
tbLogCatch.background =
@@ -1868,7 +1820,7 @@ internal class DebugSettingView @JvmOverloads constructor(
tbLogCatch.requestFocus()
tbLogCatch.background = null
}
tbLogCatch.setPadding(left,top,right,bottom)
tbLogCatch.setPadding(left, top, right, bottom)
}
}
}
@@ -1983,31 +1935,6 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
}
/**
* 时延显示
*/
override fun onObuV2iDelayTime(delayTime: Long) {
}
/**
* 车辆转向灯 数据
* @param lightSwitch
*/
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
}
/**
* 车辆刹车灯 数据
* @param brakeLight
*/
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
}
/**
* 车辆方向盘转向角回调

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.setting
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
@@ -10,18 +9,20 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect
import java.util.*
@@ -78,6 +79,7 @@ internal class SOPSettingView @JvmOverloads constructor(
/**
* obu弱势交通控制
*/
tbObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
tbObuWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) { //默认开启
CallerHmiManager.setObuWeaknessTraffic(true)
@@ -89,6 +91,7 @@ internal class SOPSettingView @JvmOverloads constructor(
/**
* 云端弱势交通控制
*/
tbCloudWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowCloudWeaknessTrafficView
tbCloudWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) { //默认关闭
CallerHmiManager.setCloudWeaknessTraffic(true)
@@ -137,7 +140,7 @@ internal class SOPSettingView @JvmOverloads constructor(
HmiBuildConfig.isShowTrafficLightView = false
} else {
HmiBuildConfig.isShowTrafficLightView = true
CallerHmiManager.disableWarningTrafficLight()
CallerTrafficLightListenerManager.disableTrafficLight()
}
}
@@ -148,7 +151,7 @@ internal class SOPSettingView @JvmOverloads constructor(
HmiBuildConfig.isShowLimitingVelocityView = true
} else {
HmiBuildConfig.isShowLimitingVelocityView = false
CallerHmiManager.disableLimitingVelocity()
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.GONE)
}
}
@@ -183,17 +186,17 @@ internal class SOPSettingView @JvmOverloads constructor(
}
//OBU控制总开关
tbObu.isChecked = CallerOBUManager.isConnected()
tbObu.isChecked = CallerObuApiManager.isConnected()
tbObu.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
CallerOBUManager.resetObuIpAddress("192.168.1.199")
CallerObuApiManager.resetObuIpAddress("192.168.1.199")
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
CallerOBUManager.resetObuIpAddress("192.168.8.199")
CallerObuApiManager.resetObuIpAddress("192.168.8.199")
}
} else {
//断开链接
CallerOBUManager.disConnectObu()
CallerObuApiManager.disConnectObu()
}
}

View File

@@ -0,0 +1,37 @@
package com.mogo.eagle.core.function.hmi.ui.switch
import android.content.Context
import android.util.AttributeSet
import android.view.View
import com.mogo.eagle.core.data.config.FunctionBuildConfig
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.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
class DemoModeHiddenSwitch(context: Context, attrs: AttributeSet?) : View(context, attrs) {
init {
isClickable = true
setOnClickListener {
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
//单次查询,是否有行程信息(订单进行中时点击不生效),autopilotControlParameters为null代表不处于自动驾驶状态下
if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) {
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(context)
)
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More