diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java index 10ba73cf1a..29103f4c3a 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java @@ -44,8 +44,7 @@ public class BusPassengerRouteFragment extends private final String TAG = "BusPassengerRouteFragment"; - private BusPassengerTrafficLightView mTrafficLightView; - private List mStationsList = new ArrayList<>(); + private final List 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); diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerTrafficLightView.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerTrafficLightView.java deleted file mode 100644 index e021a8675b..0000000000 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerTrafficLightView.java +++ /dev/null @@ -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); - } - } -} diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerTrafficLightView.kt b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerTrafficLightView.kt new file mode 100644 index 0000000000..9ac253d812 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerTrafficLightView.kt @@ -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() + } + } +} \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java index 06b227fd4f..fa5adf8e1a 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java @@ -29,6 +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.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; @@ -77,6 +80,11 @@ public abstract class BaseBusTabFragment private ImageView mSwitchMapModeImage; private LinearLayout mSwitchMapModeLayout; + //消息盒子 + private DriverMsgBoxButtonView viewDriverMsgBoxButton; + private DriverMsgBoxListView viewDriverMsgBoxList; + private DriverMsgBoxBubbleView viewDriverMsgBoxBubble; + private ObjectAnimator autopilotLoadingAnimator; public boolean isAnimateRunning = false; @@ -194,6 +202,22 @@ public abstract class BaseBusTabFragment 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 diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java deleted file mode 100644 index 4b25021821..0000000000 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java +++ /dev/null @@ -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; - } - }); - } -} diff --git a/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml b/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml index fae3e46139..4a79c2c3a4 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml @@ -56,6 +56,7 @@ 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" @@ -63,6 +64,7 @@ + + + + + + + - - - - - - - - - \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficLightView.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficLightView.kt index affb7d5100..2e199a83b4 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficLightView.kt +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficLightView.kt @@ -2,21 +2,32 @@ package com.mogo.och.sweeper.view import android.content.Context import android.util.AttributeSet -import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight -import android.widget.TextView import android.view.LayoutInflater -import android.widget.ImageView +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 + * 清扫车:红绿灯view- + * + * Created on 2022/3/29 */ -class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : - IViewTrafficLight(context, attrs, defStyleAttr) { - private var mLightIconIV: ImageView? = null - private var mLightTimeTV: TextView? = null - private var mCurrentLightId = 0 +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) @@ -24,8 +35,16 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs private fun 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) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerTrafficLightListenerManager.addListener(TAG, this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerTrafficLightListenerManager.removeListener(TAG) } /** @@ -34,8 +53,7 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 * @param lightSource 1:云端下发;2:自车感知 */ - override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) { - super.showWarningTrafficLight(checkLightId, lightSource) + override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) { mCurrentLightId = checkLightId updateTrafficLightIcon(checkLightId) } @@ -43,11 +61,10 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs /** * 关闭红绿灯预警展示,并重制灯态 */ - override fun disableWarningTrafficLight() { - super.disableWarningTrafficLight() + override fun disableTrafficLight() { UiThreadHandler.post { - mCurrentLightId = 0 - mLightIconIV!!.setImageResource(R.drawable.sweeper_light_gay_nor) + mCurrentLightId = TrafficLightEnum.BLACK + this@SweeperTrafficLightView.visibility = GONE } } @@ -57,44 +74,40 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs * @param greenNum 绿灯倒计时 */ override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) { - super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum) when (mCurrentLightId) { - 1 -> changeCountdownRed(redNum) - 2 -> changeCountdownYellow(yellowNum) - 3 -> changeCountdownGreen(greenNum) - else -> UiThreadHandler.post { mLightTimeTV!!.text = "" } + 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) { - super.changeCountdownRed(redNum) UiThreadHandler.post { if (redNum > 0) { - mLightTimeTV!!.text = redNum.toString() + sweeper_traffic_light_time_tv.text = redNum.toString() } else { - mLightTimeTV!!.text = "" + sweeper_traffic_light_time_tv.text = "" } } } override fun changeCountdownGreen(greenNum: Int) { - super.changeCountdownGreen(greenNum) UiThreadHandler.post { if (greenNum > 0) { - mLightTimeTV!!.text = greenNum.toString() + sweeper_traffic_light_time_tv.text = greenNum.toString() } else { - mLightTimeTV!!.text = "" + sweeper_traffic_light_time_tv.text = "" } } } override fun changeCountdownYellow(yellowNum: Int) { - super.changeCountdownYellow(yellowNum) UiThreadHandler.post { if (yellowNum > 0) { - mLightTimeTV!!.text = yellowNum.toString() + sweeper_traffic_light_time_tv.text = yellowNum.toString() } else { - mLightTimeTV!!.text = "" + sweeper_traffic_light_time_tv.text = "" } } } @@ -104,13 +117,22 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs * * @param lightId 0-都是默认,1-红,2-黄,3-绿 */ - private fun updateTrafficLightIcon(lightId: Int) { + private fun updateTrafficLightIcon(lightId: TrafficLightEnum) { UiThreadHandler.post { when (lightId) { - 1 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_red_nor) - 2 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_lightyellow_nor) - 3 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_green_nor) - else -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_gay_nor) + 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 } } } diff --git a/OCH/mogo-och-taxi-passenger/src/main/aidl/com/mogo/och/taxi/passenger/mulprocess/ILeftMenuService.aidl b/OCH/mogo-och-taxi-passenger/src/main/aidl/com/mogo/och/taxi/passenger/mulprocess/ILeftMenuService.aidl index 0e0aa676e9..ab9159d363 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/aidl/com/mogo/och/taxi/passenger/mulprocess/ILeftMenuService.aidl +++ b/OCH/mogo-och-taxi-passenger/src/main/aidl/com/mogo/och/taxi/passenger/mulprocess/ILeftMenuService.aidl @@ -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); diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java index c8c5c06ab6..54f757e95a 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java @@ -26,6 +26,7 @@ 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; @@ -607,6 +608,26 @@ 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){ diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java index 1400bb2866..f30fa8d8c3 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java @@ -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; @@ -55,12 +56,15 @@ public class TaxiPassengerBaseFragment extends MvpFragment mArrivedEndView; private WeakReference mArrivedCheckView; private WeakReference mStartAutopilotView; protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null; + //消息盒子 + private PassengerMsgBoxButtonView viewPassengerMsgBoxButton; + private PassengerMsgBoxBubbleView viewPassengerMsgBoxBubble; + private PassengerMsgBoxListView viewPassengerMsgBoxList; private final Handler mHandler = new Handler(Looper.getMainLooper()); @@ -87,10 +91,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment { + 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() { diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java deleted file mode 100644 index b963ae8829..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java +++ /dev/null @@ -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); - } - } -} diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.kt new file mode 100644 index 0000000000..e445d5a65e --- /dev/null +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.kt @@ -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() + } + } +} \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml index 110316f5c8..da536a4b66 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml @@ -50,6 +50,36 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" /> + + + + + + { + 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() { diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java deleted file mode 100644 index 41db23e822..0000000000 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java +++ /dev/null @@ -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; - } - }); - } -} diff --git a/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml b/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml index eadaf14b51..7490477aa1 100644 --- a/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml +++ b/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml @@ -121,6 +121,7 @@ + + + + + + + 650) { str = str.substring(0, 650) + "\n(已缩短。如需查看完整数据,请勾选日志存储复选框)"; diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java index 55a6f6bb17..2a452588ba 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java @@ -12,6 +12,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Message; import android.os.PowerManager; +import android.os.SystemClock; import android.provider.Settings; import android.text.Editable; import android.text.Html; @@ -43,6 +44,8 @@ import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; import com.google.protobuf.TextFormat; +import com.mogo.support.obu.ObuPenetrate; +import com.mogo.support.obu.ObuScene; import com.mogo.telematic.MogoProtocolMsg; import com.mogo.telematic.NSDNettyManager; import com.mogo.telematic.client.listener.NettyClientListener; @@ -136,6 +139,9 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas private static final int WHAT_IPC_IP = 0x00; private static final int WHAT_DRIVER_IP = 0x01; private static final int WHAT_IPC_CONNECT_STATE = 0x02; + private static final int WHAT_RECEIVE_ERROR_DATA_SHOW = 0x03; + private static final int WHAT_RECEIVE_ERROR_DATA_HINT = 0x04; + private static final int WHAT_RECEIVE_ERROR_DATA_STOP = 0x05; private EditText etIp; private ImageView role; private ImageView tvIp; @@ -179,6 +185,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas private boolean isAutopilotAbility = true; private String autopilotAbilityReason; private List specialVehicleBeanList;//特种车辆 + private long errorDataUpdateTime = 0; // @Override // protected void onStart() { // super.onStart(); @@ -546,7 +553,14 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - showLocalIP(); + if (TextUtils.equals(title.getText(), getString(R.string.have_error_data))) { + int position=titleFragmentData.size() - 1; + infoFragment.smoothScrollToPosition(position); + fragmentAdapter.setSelectedPosition(position); + showFragment(Constants.TITLE.RECEIVE_ERROR); + } else { + showLocalIP(); + } } }); title.setOnLongClickListener(new View.OnLongClickListener() { @@ -826,6 +840,18 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas @Override public void onError(ProtocolStatus status, byte[] bytes) { + long errorDataReceiveTime = SystemClock.elapsedRealtime(); + if (errorDataUpdateTime == 0) { + errorDataUpdateTime = errorDataReceiveTime + 800; + } + if (errorDataReceiveTime > errorDataUpdateTime) { + errorDataUpdateTime = 0; + getHandler().sendEmptyMessage(WHAT_RECEIVE_ERROR_DATA_SHOW); + if (getHandler().hasMessages(WHAT_RECEIVE_ERROR_DATA_STOP)) { + getHandler().removeMessages(WHAT_RECEIVE_ERROR_DATA_STOP); + } + getHandler().sendEmptyMessageDelayed(WHAT_RECEIVE_ERROR_DATA_STOP, 1500); + } ErrorData base = new ErrorData(status, bytes); DataDistribution.getInstance().addData(base); } @@ -1037,6 +1063,26 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas DataDistribution.getInstance().addData(base); } + @Override + public void onoObuSpatWarning(MessagePad.Header header, ObuScene.SpatWarningData spatWarningData) { + + } + + @Override + public void onoObuRsiWarning(MessagePad.Header header, ObuScene.RsiWarningData rsiWarningData) { + + } + + @Override + public void onoObuRsmWarning(MessagePad.Header header, ObuScene.RsmWarningData rsmWarningData) { + + } + + @Override + public void onoObuObuMapMath(MessagePad.Header header, ObuScene.MapMatchData mapMatchData) { + + } + @Override public void onFunctionStates(MessagePad.Header header, FunctionStates.FSMFunctionStates functionStates) { FSMFunctionStates base = new FSMFunctionStates(header, functionStates, sdf); @@ -1169,6 +1215,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas connectStatus = ipcConnectionStatus; String status = onUpdateConnectStateView(); if (connectStatus == IPC_CONNECTION_STATUS.CONNECTED) { + DataDistribution.getInstance().clearCount(); getHandler().sendEmptyMessage(WHAT_IPC_IP); String tem = getIPCIP(); if (!TextUtils.isEmpty(tem)) { @@ -1573,6 +1620,21 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas tvConnectState.setText(status.status); tvConnectState.setTextColor(getResources().getColor(status.color)); break; + case WHAT_RECEIVE_ERROR_DATA_SHOW: + title.setText(R.string.have_error_data); + title.setTextColor(getColor(android.R.color.holo_red_light)); + title.setVisibility(View.VISIBLE); + getHandler().sendEmptyMessageDelayed(WHAT_RECEIVE_ERROR_DATA_HINT, 500); + break; + case WHAT_RECEIVE_ERROR_DATA_HINT: + title.setVisibility(View.INVISIBLE); + break; + case WHAT_RECEIVE_ERROR_DATA_STOP: + title.setText(R.string.app_name); + title.setTextColor(getColor(R.color.colorWhile)); + title.setVisibility(View.VISIBLE); + errorDataUpdateTime = 0; + break; } } } diff --git a/app_ipc_monitoring/src/main/res/layout/item_main.xml b/app_ipc_monitoring/src/main/res/layout/item_main.xml index 4f3acb94c9..52fbb751ab 100644 --- a/app_ipc_monitoring/src/main/res/layout/item_main.xml +++ b/app_ipc_monitoring/src/main/res/layout/item_main.xml @@ -17,6 +17,7 @@ 工控机监控 + 存在错误数据 添加 保存 删除 diff --git a/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java b/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java index b371610372..cc6fd11625 100644 --- a/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java +++ b/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java @@ -33,6 +33,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; +import com.mogo.support.obu.ObuScene; import com.zhidao.adas.magic.R; import com.zhidao.adas.magic.adapter.InfoTitleAdapter; import com.zhidao.adas.magic.base.BaseActivity; @@ -553,6 +554,26 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas } + @Override + public void onoObuSpatWarning(MessagePad.Header header, ObuScene.SpatWarningData spatWarningData) { + + } + + @Override + public void onoObuRsiWarning(MessagePad.Header header, ObuScene.RsiWarningData rsiWarningData) { + + } + + @Override + public void onoObuRsmWarning(MessagePad.Header header, ObuScene.RsmWarningData rsmWarningData) { + + } + + @Override + public void onoObuObuMapMath(MessagePad.Header header, ObuScene.MapMatchData mapMatchData) { + + } + @Override public void onFunctionStates(MessagePad.Header header, FunctionStates.FSMFunctionStates functionStates) { diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/TrafficLightHMIManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/TrafficLightHMIManager.kt deleted file mode 100644 index d4e777fc8a..0000000000 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/TrafficLightHMIManager.kt +++ /dev/null @@ -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() - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt index d80621a186..199cfc828b 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt @@ -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() } } } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt index 2e65445525..8d80d0d709 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt @@ -2,25 +2,23 @@ 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.obu.IMoGoObuTrafficLightListener 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.obu.CallerObuTrafficLightListenerManager 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, - IMoGoObuTrafficLightListener { +class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener { companion object { const val TAG = "TrafficLightDispatcher" @@ -34,6 +32,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight //是否有AI获取红绿灯灯态 private var hasAiLightStatus: Boolean = false + //obu数据 private var hasObuLightStatus: Boolean = false @@ -41,14 +40,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight mContext = context //注册监听AI云获取红绿灯状态 CallerTrafficLightListenerManager.addListener(TAG, this) - //注册监听AI云进入路口 - CallerTrafficLightListenerManager.addListener(TAG, this) - //注册监听红绿灯请求失败 - CallerTrafficLightListenerManager.addListener(TAG, this) //注册监听工控机感知红绿灯 CallerAutopilotIdentifyListenerManager.addListener(TAG, this) - //obu红绿灯数据 - CallerObuTrafficLightListenerManager.addListener(TAG, this) } /** @@ -71,27 +64,36 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight } if (light == null) { //隐藏红绿灯显示 - TrafficLightHMIManager.INSTANCE.hideTrafficLight() + CallerTrafficLightListenerManager.disableTrafficLight() } else { when (light.state) { TrafficLightOuterClass.LightState.STATE_RED -> { //红灯 - CallerHmiManager.showWarningTrafficLight(1, 2) - CallerHmiManager.changeCountdownGreen(0) + CallerTrafficLightListenerManager.showTrafficLight( + TrafficLightEnum.RED, + DataSourceType.TELEMATIC + ) + CallerTrafficLightListenerManager.changeCountdownRed(0) } TrafficLightOuterClass.LightState.STATE_YELLOW -> { //黄灯 - CallerHmiManager.showWarningTrafficLight(2, 2) - CallerHmiManager.changeCountdownGreen(0) + CallerTrafficLightListenerManager.showTrafficLight( + TrafficLightEnum.YELLOW, + DataSourceType.TELEMATIC + ) + CallerTrafficLightListenerManager.changeCountdownYellow(0) } TrafficLightOuterClass.LightState.STATE_GREEN -> { //绿灯 - CallerHmiManager.showWarningTrafficLight(3, 2) - CallerHmiManager.changeCountdownGreen(0) + CallerTrafficLightListenerManager.showTrafficLight( + TrafficLightEnum.GREEN, + DataSourceType.TELEMATIC + ) + CallerTrafficLightListenerManager.changeCountdownGreen(0) } TrafficLightOuterClass.LightState.STATE_OFF -> { //黑灯,隐藏红绿灯显示 - TrafficLightHMIManager.INSTANCE.hideTrafficLight() + CallerTrafficLightListenerManager.disableTrafficLight() } else -> {} } @@ -107,7 +109,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight */ override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { if (!hasObuLightStatus) { - TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult) + updateTrafficLight(trafficLightResult) hasAiLightStatus = true } } @@ -122,11 +124,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight hasAiLightStatus = false hasObuLightStatus = false }, 5000) - CallerTrafficLightListenerManager.resetTrafficLightData() //如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理 - if(!hasObuLightStatus){ - TrafficLightHMIManager.INSTANCE.hideTrafficLight() - } + CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus) } } @@ -135,21 +134,41 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight */ override fun onTrafficRequestError() { hasAiLightStatus = false - CallerTrafficLightListenerManager.resetTrafficLightData() - if(!hasObuLightStatus){ - if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) { - TrafficLightHMIManager.INSTANCE.hideTrafficLight() - } - } + CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus) } /** * obu 红绿灯数据 */ - override fun onObuTrafficLight(light: Int) { - super.onObuTrafficLight(light) + override fun onObuTrafficLightStatus(light: TrafficLightEnum) { + super.onObuTrafficLightStatus(light) hasObuLightStatus = true - CallerHmiManager.showWarningTrafficLight(light, 3) + CallerTrafficLightListenerManager.showTrafficLight(light, DataSourceType.OBU) + } + + 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() { @@ -157,10 +176,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight CallerTrafficLightListenerManager.removeListener(TAG) //取消注册监听工控机感知红绿灯 CallerAutopilotIdentifyListenerManager.removeListener(TAG) - //取消注册监听红绿灯请求失败 - CallerTrafficLightListenerManager.removeListener(TAG) - //取消注册监听AI云进入路口 - CallerTrafficLightListenerManager.removeListener(TAG) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index 8cf34708df..a5d1e761b1 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -51,10 +51,14 @@ 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.obu.CallerObuMapMathListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager 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 import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasListener import com.zhidao.support.adas.high.bean.AutopilotAbility @@ -130,7 +134,7 @@ class MoGoAdasListenerImpl : OnAdasListener { paramIndexes = [0, 1], clientPkFileName = "sn" ) - override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) { + override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo) { // WGS84坐标系高精度位置信息 invokeChassisLocationWGS84(gnssInfo) // GCJ02高德坐标系位置信息 @@ -537,6 +541,44 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerObuDcCombineListenerManager.invokeObuDcData(obuWarningData) } + /** + * OBU 红绿灯预警信息 + * + * @param header 头 + * @param spatWarningData 数据 + */ + override fun onoObuSpatWarning(header: MessagePad.Header?, spatWarningData: ObuScene.SpatWarningData?) { + CallerObuWarningSpatListenerManager.invokeObuSpatWarning(spatWarningData!!) + } + /** + * OBU RSI预警信息 + * + * @param header 头 + * @param rsiWarningData 数据 + */ + override fun onoObuRsiWarning(header: MessagePad.Header?, rsiWarningData: ObuScene.RsiWarningData?) { + CallerObuWarningRsiListenerManager.invokeObuRsiWarning(rsiWarningData!!) + } + + /** + * OBU RSM预警信息 + * + * @param header 头 + * @param rsmWarningData 数据 + */ + override fun onoObuRsmWarning(header: MessagePad.Header?, rsmWarningData: ObuScene.RsmWarningData?) { + CallerObuWarningRsmListenerManager.invokeObuRsmWarning(rsmWarningData!!) + } + /** + * OBU 地图匹配结果 + * + * @param header 头 + * @param mapMatchData 数据 + */ + override fun onoObuObuMapMath(header: MessagePad.Header?, mapMatchData: ObuScene.MapMatchData?) { + CallerObuMapMathListenerManager.invokeObuMapMath(mapMatchData!!) + } + /** * 重构后的功能状态 * diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/IMoGoLocationListener.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/IMoGoLocationListener.kt new file mode 100644 index 0000000000..4398708010 --- /dev/null +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/IMoGoLocationListener.kt @@ -0,0 +1,16 @@ +package com.mogo.eagle.core.function.datacenter.location + +import com.mogo.eagle.core.data.enums.DataSourceType +import mogo.telematics.pad.MessagePad + +/** + * 位置回调监听 + */ +interface IMoGoLocationListener { + /** + * 位置改变回调用 + * @param gnssInfo 位置信息 + * @param sourceType 数据来源 + */ + fun onLocationChanged(gnssInfo: MessagePad.GnssInfo, sourceType: DataSourceType) +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationManager.kt new file mode 100644 index 0000000000..c58fe3b680 --- /dev/null +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationManager.kt @@ -0,0 +1,71 @@ +package com.mogo.eagle.core.function.datacenter.location + +import com.mogo.eagle.core.data.enums.DataSourceType +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener +import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.support.obu.model.MogoObuHvBasicsData +import mogo.telematics.pad.MessagePad + +/** + * 融合定位服务,这里同时监听多来源的位置信息,并支持修改频率 + * + * @author donghongyu + */ +object MoGoLocationManager : + CallerBase(), + IMoGoChassisLocationWGS84Listener, + IMoGoObuLocationWGS84Listener { + + private val TAG = "MoGoLocationManager" + + init { + CallerChassisLocationWGS84ListenerManager.addListener(TAG, this) + } + + override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) { + M_LISTENERS.forEach { + val tag = it.key + // 获取数据监听需要的HZ + val hz = M_LISTENERS_HZ[tag] + if (hz != null && hz > 0) { + val hzTime = (1.0 / hz.toDouble()) * 1000 + // 获取最后一次回调的时间 + val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag] + if (hzLastSendTime != null && hzLastSendTime > 0) { + // 计算是否进入下一次回调周期 + val nowTime = TimeUtils.getNowMills() + if (nowTime - hzLastSendTime > hzTime) { + syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC) + } + } else { + syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC) + } + } else { + syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC) + } + } + } + + /** + * 向订阅位置信息的发出定位信息 + */ + private fun syncLocationCallback( + tag: String, + it: Map.Entry, + gnssInfo: MessagePad.GnssInfo, + sourceType: DataSourceType + ) { + // 记录最后一次回调时间 + M_LISTENERS_HZ_LAST_SEND_TIME[tag] = TimeUtils.getNowMills() + val listener = it.value + listener.onLocationChanged(gnssInfo, sourceType) + } + + override fun onObuLocationWGS84(data: MogoObuHvBasicsData) { + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/README.md b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/README.md new file mode 100644 index 0000000000..5a2b95898c --- /dev/null +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/README.md @@ -0,0 +1,17 @@ +#### 说明 + +##### 位置回调:融合工控机、OBU、高德地图 + +```kotlin +// 注册监听位置变换 +MoGoLocationManager.addListener(Companion.functionName, object : IMoGoLocationListener { + override fun onLocationChanged( + gnssInfo: MessagePad.GnssInfo, + sourceType: DataSourceType + ) { + TODO("Not yet implemented") + } +}) +// 设置数据回调频率,单位HZ,1HZ的周期是1秒;50HZ的周期是1/50=0.02秒;10HZ的周期是1/10=0.1秒。 +MoGoLocationManager.setListenerHz(Companion.functionName, 20) +``` \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt index b8c85a0b37..6d0d5ba1d6 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt @@ -37,9 +37,8 @@ class MoGoObuProvider : IMoGoObuProvider { 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 { @@ -73,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 { diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt index 27b38679d6..50623760c5 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt @@ -5,6 +5,7 @@ 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 @@ -14,6 +15,7 @@ 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 @@ -511,7 +513,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener // 删除 MogoObuConstants.STATUS.DELETE -> { // 移除顶部弹窗,当收不到信号的时候触发一次 - CallerHmiManager.disableWarningTrafficLight() + CallerTrafficLightListenerManager.disableTrafficLight() CallerHmiManager.disableWarningV2X(appId.toString()) isShowGreenWave = false isShowRunRedLight = false @@ -626,7 +628,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener when (currentLight.light) { // 灯光不可用 0 -> { - CallerHmiManager.showWarningTrafficLight(0, 2) + CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.BLACK, DataSourceType.TELEMATIC) } // 红灯 @@ -636,9 +638,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener isRedLight = true } isGreenLight = false - CallerHmiManager.showWarningTrafficLight(1, 2) + CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.TELEMATIC) val red = currentLight.countDown / 10 - CallerHmiManager.changeCountdownRed(red) + CallerTrafficLightListenerManager.changeCountdownRed(red) } // 绿灯 @@ -648,17 +650,17 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener isGreenLight = true } isRedLight = false - CallerHmiManager.showWarningTrafficLight(3, 2) + CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.TELEMATIC) val green = currentLight.countDown / 10 - CallerHmiManager.changeCountdownGreen(green) + CallerTrafficLightListenerManager.changeCountdownGreen(green) } // 黄灯 7, 8 -> { CallerHmiManager.disableWarningV2X(appId.toString()) - CallerHmiManager.showWarningTrafficLight(2, 2) + CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.TELEMATIC) val yellow = currentLight.countDown / 10 - CallerHmiManager.changeCountdownYellow(yellow) + CallerTrafficLightListenerManager.changeCountdownYellow(yellow) } } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt index 503a372c83..2a2b323404 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt @@ -15,13 +15,12 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager -import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager -import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager +import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew 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.UiThreadHandler import com.mogo.support.obu.MogoObuManager import com.mogo.support.obu.OnMogoObuListener @@ -48,9 +47,7 @@ class MogoPrivateObuNewManager private constructor() { } } - private var mContext: Context? = null - private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo() - + private var mObuStatusInfo = CallerObuConnectListenerManager.getObuStatusInfo() fun connectObu(context: Context, obuIpAddress: String, padIpAddress: String) { MogoObuManager.getInstance().registerMogoObuListener(mogoObuListener) @@ -100,16 +97,10 @@ class MogoPrivateObuNewManager private constructor() { override fun onConnectStatus(connectStatus: Int) { if (connectStatus == 0) { //断开连接 mObuStatusInfo.obuStatus = false - mObuStatusInfo.obuHvStatus = false - mObuStatusInfo.obuRvStatus = false - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) } + CallerObuConnectListenerManager.invokeObuConnectListener(mObuStatusInfo) } else if (connectStatus == 1) { //连接成功 mObuStatusInfo.obuStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } + CallerObuConnectListenerManager.invokeObuConnectListener(mObuStatusInfo) } } @@ -117,9 +108,6 @@ class MogoPrivateObuNewManager private constructor() { * HV车辆基础信息 CvxHvCarIndInfo CvxHvInfoIndInfo */ override fun onMogoObuHvBasics(p0: MogoObuHvBasicsData?) { - mObuStatusInfo.obuHvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - if (p0 != null && p0.vehBasicsMsg != null) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", @@ -168,8 +156,6 @@ class MogoPrivateObuNewManager private constructor() { override fun onMogoObuRvWarning(data: MogoObuRvWarningData) { super.onMogoObuRvWarning(data) // if (HmiBuildConfig.isShowObuV2vView) { //TODO 临时需要关闭v2v开关 - mObuStatusInfo.obuRvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) if (!data.warningMsg.warningData.isNullOrEmpty()) { // 更新数据,远车数据,之前要匹配uuid TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let { @@ -192,9 +178,7 @@ class MogoPrivateObuNewManager private constructor() { appId = data.warningMsg.warningData[0].warningType.toString() status = data.warningMsg.warningData[0].status //拼凑数据 - if (appId != null) { - handleSdkObu(appId, direction, status, level, data) - } + handleSdkObu(appId, direction, status, level, data) } } @@ -215,15 +199,11 @@ class MogoPrivateObuNewManager private constructor() { */ override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) { super.onMogoObuSpatWarning(data) - if (data != null) { -// if (HmiBuildConfig.isShowObuV2iView) { - handlerTrafficLight( - data.warningType, - data.status, - data.lights - ) -// } - } + handlerTrafficLight( + data.warningType, + data.status, + data.lights + ) } /** @@ -232,7 +212,7 @@ class MogoPrivateObuNewManager private constructor() { override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) { super.onMogoObuRsiWarning(data) // if (HmiBuildConfig.isShowObuV2iView) { - if (data != null && data.warningMsg != null && data.warningMsg.size > 0) { + if (data.warningMsg != null && data.warningMsg.size > 0) { var alertContent = "" var ttsContent = "" var appId = data.warningMsg[0].sceneType.toString() @@ -411,7 +391,7 @@ class MogoPrivateObuNewManager private constructor() { //显示警告红边 // CallerHmiManager.showWarning(direction) //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { + if (alertContent.isEmpty() || ttsContent.isEmpty()) { return } CallerMsgBoxManager.saveMsgBox( @@ -571,7 +551,7 @@ class MogoPrivateObuNewManager private constructor() { ?.updateITrafficThreatLevelInfo(it) } - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { + if (alertContent.isEmpty() || ttsContent.isEmpty()) { return } //显示警告红边 @@ -650,7 +630,10 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.DELETE -> { // 删除 UiThreadHandler.post { - CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1,DataSourceType.OBU) + CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange( + -1, + DataSourceType.OBU + ) } } } @@ -926,7 +909,7 @@ private fun handlerTrafficLight(appId: Int, status: Int, lights: List // 删除 MogoObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 - CallerHmiManager.disableWarningTrafficLight() + CallerTrafficLightListenerManager.disableTrafficLight() CallerHmiManager.disableWarningV2X(appId.toString()) isShowGreenWave = false isShowRunRedLight = false @@ -1069,7 +1052,7 @@ private fun changeTrafficLightStatus( when (currentLight.light) { // 灯光不可用 0 -> { - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0) + CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.BLACK) } // 红灯 2, 3 -> { @@ -1079,9 +1062,8 @@ private fun changeTrafficLightStatus( } isGreenLight = false isYellowLight = false - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1) + CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.RED) val red = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownRed(red) } // 绿灯 @@ -1092,9 +1074,8 @@ private fun changeTrafficLightStatus( } isRedLight = false isYellowLight = false - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3) + CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.GREEN) val green = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownGreen(green) } // 黄灯 @@ -1105,9 +1086,8 @@ private fun changeTrafficLightStatus( isRedLight = false isGreenLight = false CallerHmiManager.disableWarningV2X(appId.toString()) - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2) + CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.YELLOW) val yellow = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownYellow(yellow) } } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/adapter/MoGoObuListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/adapter/MoGoObuListenerImpl.kt new file mode 100644 index 0000000000..2ca1b43239 --- /dev/null +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/adapter/MoGoObuListenerImpl.kt @@ -0,0 +1,90 @@ +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) { + + } + + /** + * RSI预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) { + + } + + /** + * RSM预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData) { + } + + /** + * 地图匹配结果 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuMapMath(data: MogoObuMapMathData) { + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt index a37d4520a6..8a66b2e9c2 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt @@ -353,9 +353,9 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener fun closeWindow() } - override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) { - latitude = gnssInfo?.latitude - longitude = gnssInfo?.longitude + override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) { + latitude = gnssInfo.latitude + longitude = gnssInfo.longitude } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt index ed8dc2da88..35581f2fee 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt @@ -394,9 +394,9 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList fun closeWindow() } - override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) { - latitude = gnssInfo?.latitude - longitude = gnssInfo?.longitude + override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) { + latitude = gnssInfo.latitude + longitude = gnssInfo.longitude } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt index f2f2355594..9f35b20204 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt @@ -380,7 +380,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene fun closeWindow() } - override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) { + override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) { latitude = gnssInfo?.latitude longitude = gnssInfo?.longitude } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt index 825574fb98..656730b240 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt @@ -85,7 +85,7 @@ internal class RTKImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotStatu } } - override fun onChassisLocationWGS84(gnssInfo: GnssInfo?) { + override fun onChassisLocationWGS84(gnssInfo: GnssInfo) { if (isOldVersion.get()) { if (isRTKEnabled()) { send(RTKStatus("RTK", 0)) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt index b6599e45b2..30a8a7fc2a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt @@ -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() } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 64fc8b9c27..b63e9828b0 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -29,8 +29,6 @@ import com.mogo.eagle.core.data.map.Infrastructure 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.hmi.IMoGoHmiViewProxy -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 @@ -78,17 +76,12 @@ import java.util.concurrent.atomic.AtomicReference @Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI) class MoGoHmiFragment : MvpFragment(), IMoGoHmiProvider, - IMoGoHmiViewProxy, MoGoHmiContract.View { companion object { private const val TAG = "MoGoHmiFragment" } - // HMI 视图控件代理 - // todo 需要统一数据源 红绿灯 View代理 - private var mViewTrafficLight: IViewTrafficLight? = null - private val lastSpeakJob by lazy { AtomicReference() } private var lastShowV2XJob: Job? = null @@ -98,24 +91,6 @@ class MoGoHmiFragment : MvpFragment(), } - // todo 新超 - override fun updateDriverMsgBoxTipView(show: Boolean) { - - } - - // todo 新超 - override fun updatePassengerMsgBoxTipView(show: Boolean) { - - } - - /** todo ----------------------------------------------**/ - /** - * 设置 红绿灯 代理View - */ - override fun setProxyTrafficLightView(view: IViewTrafficLight) { - mViewTrafficLight = view - } - /** * ok * 工控机重启返回结果 @@ -319,55 +294,6 @@ class MoGoHmiFragment : MvpFragment(), } } - /** - * 展示红绿灯预警 - * - * @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) - } - /** * 展示指定方位上的红框预警 * @param direction @@ -519,7 +445,6 @@ class MoGoHmiFragment : MvpFragment(), "${SceneConstant.M_DEVA}${"TurnLight"}", "---showTurnLight = $light ---isLeftLight = $isLeftLight ---isRightLight = $isRightLight" ) - if (HmiBuildConfig.isShowTurnLightView) { ThreadUtils.runOnUiThread { if (light == 1 || light == 2) { if (!isVisualAngleChanged) { @@ -567,7 +492,6 @@ class MoGoHmiFragment : MvpFragment(), } } } - } } private var isBrake: Boolean = false @@ -576,7 +500,6 @@ class MoGoHmiFragment : MvpFragment(), * 显示刹车效果 */ override fun showBrakeLight(light: Int) { - if (HmiBuildConfig.isShowBrakeLightView) { ThreadUtils.runOnUiThread { if (light == 1) { //刹车灯亮 if (!isBrake) { @@ -597,8 +520,8 @@ class MoGoHmiFragment : MvpFragment(), CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500) } } + //brakeView.setBrakeLight(light) } - } } /** todo----------------------------------------------- **/ @@ -668,14 +591,6 @@ class MoGoHmiFragment : MvpFragment(), } } - override fun setTurnLightFunction(isOpen: Boolean) { - HmiBuildConfig.isShowTurnLightView = isOpen - } - - override fun setBrakeLightFunction(isOpen: Boolean) { - HmiBuildConfig.isShowBrakeLightView = isOpen - } - override fun setSnBinding(isOpen: Boolean) { HmiBuildConfig.isShowSnBindingView = isOpen } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt index fb8fabb4a4..d36deb67f5 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt @@ -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) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt index 0156087370..5fe939bf50 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt @@ -3,8 +3,13 @@ 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 @@ -15,19 +20,71 @@ class DriverMsgBoxButtonView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -):ConstraintLayout(context, attrs, defStyleAttr) { +):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) + } + + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt index 547b6c8719..c06b07f82b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt @@ -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 ?= null private var badCaseList: ArrayList ?= 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? @@ -193,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) @@ -214,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) + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt index edd8a0688b..7625fbec80 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt @@ -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) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt index 9cc340ca74..3080907378 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt @@ -3,8 +3,13 @@ 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 @@ -15,19 +20,70 @@ class PassengerMsgBoxButtonView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -): ConstraintLayout(context, attrs, defStyleAttr) { +): 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) + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt index f0720f387c..8abbc15a48 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt @@ -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) { + + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt index 59bf3c18f6..61488d4325 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt @@ -14,12 +14,14 @@ 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 @@ -76,14 +78,19 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A when (holder) { is BubbleOperationHolder -> { data?.let { - val operationMsg = it[position].bean as OperationMsg + 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) + } } } is BubbleReportHolder -> { data?.let { - val reportEntity = it[position].bean as ReportEntity + 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 = "类型:" @@ -91,6 +98,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}" } holder.tvBubbleReportType.text = resultStr + holder.clReportLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleReportListener(msgBoxBean) + } } } is BubbleNoticeHolder -> { @@ -140,6 +150,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A holder.tvV2XContent.text = v2XMsg.content holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable( EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + holder.clV2XLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean) + } } } is BubbleSummaryHolder -> { @@ -191,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 @@ -213,6 +228,7 @@ 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) } //汇总消息 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt index 110a8bcb9f..01c8b24ae1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt @@ -19,6 +19,7 @@ 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 @@ -105,6 +106,9 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView holder.tvPassengerV2XContent.text = v2XMsg.content holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable( EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + holder.clPassengerVeXLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean) + } } } is BubbleSummaryHolder -> { @@ -115,7 +119,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView holder.tvPassengerSummaryCheck.setOnClickListener { //跳转全览模式 // CallerHmiManager.showSmallFragment() - CallerMsgBoxEventListenerManager.invokeListener() + CallerMsgBoxEventListenerManager.invokeSummaryListener() } } } @@ -164,6 +168,7 @@ 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) } //汇总消息 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt index de61704d89..3db034d364 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt @@ -107,7 +107,7 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A holder.tvPassengerSummaryCheck.setOnClickListener { //跳转全览模式 // CallerHmiManager.showSmallFragment() - CallerMsgBoxEventListenerManager.invokeListener() + CallerMsgBoxEventListenerManager.invokeSummaryListener() } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt index 2a50d8f222..e221ee5fa1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt @@ -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() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 90865d1bdf..d7bedf1d78 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -38,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 @@ -55,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 @@ -106,22 +104,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" @@ -195,7 +192,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车辆状态&定位 监听 @@ -236,7 +233,7 @@ internal class DebugSettingView @JvmOverloads constructor( override fun onDetachedFromWindow() { super.onDetachedFromWindow() // 移除 OBU状态 监听 - CallerObuListenerManager.removeListener(TAG) + CallerObuConnectListenerManager.removeListener(TAG) // 移除 ADAS状态 监听 CallerAutoPilotStatusListenerManager.removeListener(TAG) // 移除 ADAS车辆状态&定位 监听 @@ -260,7 +257,10 @@ internal class DebugSettingView @JvmOverloads constructor( CallerChassisLamplightListenerManager.removeListener(TAG) // 移除 业务配置监听 - CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG) + CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( + FuncBizConfig.FOUNDATION, + TAG + ) if (logInfoView != null) { logInfoView!!.onEnterBackground() @@ -558,7 +558,7 @@ internal class DebugSettingView @JvmOverloads constructor( setLogCheckedChangeListener() //OBU配置信息 - tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString() + tvObuInfo.text = CallerObuConnectListenerManager.getObuStatusInfoJsonString() //工控机配置信息 tvAutopilotInfo.text = @@ -578,14 +578,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 } @@ -595,7 +595,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) { //关闭美化模式时,通知工控机 @@ -1050,29 +1054,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绑定控制 */ @@ -1697,9 +1678,9 @@ internal class DebugSettingView @JvmOverloads constructor( mTrajectoryInfoSize = 0 mRouteInfoSize = 0 - if(FunctionBuildConfig.isDemoMode){ + if (FunctionBuildConfig.isDemoMode) { tbIsDemoMode.text = "关闭美化模式" - }else{ + } else { tbIsDemoMode.text = "开启美化模式" } @@ -1708,7 +1689,7 @@ internal class DebugSettingView @JvmOverloads constructor( /** * OBU状态回调 */ - override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) { + override fun onConnectStatus(obuStatusInfo: ObuStatusInfo) { lifecycleOwner.lifecycleScope.launch { tvObuInfo.text = GsonUtils.toJson(obuStatusInfo) @@ -1788,7 +1769,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) @@ -1796,11 +1777,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) @@ -1808,21 +1789,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 = @@ -1832,10 +1813,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 = @@ -1845,12 +1826,12 @@ internal class DebugSettingView @JvmOverloads constructor( tbLogCatch.requestFocus() tbLogCatch.background = null } - tbLogCatch.setPadding(left,top,right,bottom) + tbLogCatch.setPadding(left, top, right, bottom) } } } - override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) { + override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) { mGnssInfo = gnssInfo //实时加速度列表 ThreadUtils.runOnUiThread { @@ -1960,31 +1941,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) { - - } /** * 车辆方向盘转向角回调 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index 0ae1263047..baa3b07802 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -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 @@ -14,16 +13,16 @@ 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.* @@ -141,7 +140,7 @@ internal class SOPSettingView @JvmOverloads constructor( HmiBuildConfig.isShowTrafficLightView = false } else { HmiBuildConfig.isShowTrafficLightView = true - CallerHmiManager.disableWarningTrafficLight() + CallerTrafficLightListenerManager.disableTrafficLight() } } @@ -187,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() } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt index 36af0aad3d..33169d3fed 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt @@ -5,13 +5,17 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.View import android.widget.ImageView +import android.widget.LinearLayout import android.widget.TextView import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig +import com.mogo.eagle.core.data.enums.DataSourceType +import com.mogo.eagle.core.data.enums.TrafficLightEnum import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.TrafficLightView_TAG -import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight +import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener 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.R import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler @@ -23,13 +27,18 @@ class SingleTrafficLightView @JvmOverloads constructor( context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : IViewTrafficLight(context, attrs, defStyleAttr), IViewControlListener { +) : LinearLayout(context, attrs, defStyleAttr), IViewControlListener, IMoGoTrafficLightListener { + + companion object { + private const val TAG = "SingleTrafficLightView" + } + private var mLightIconIV: ImageView? = null private var mLightIconBG: ImageView? = null private var mLightTimeTV: GradientTextView? = null private var mLightSourceTV: TextView? = null private var mLightSourceDivider: View? = null - private var mCurrentLightId = 0 + private var mCurrentLightId = TrafficLightEnum.BLACK override fun onAttachedToWindow() { super.onAttachedToWindow() @@ -40,6 +49,7 @@ class SingleTrafficLightView @JvmOverloads constructor( mLightSourceTV = findViewById(R.id.hmi_traffic_light_source) mLightSourceDivider = findViewById(R.id.hmi_traffic_light_divider) + CallerTrafficLightListenerManager.addListener(TAG, this) CallerHmiViewControlListenerManager.addListener(TrafficLightView_TAG, this) } @@ -50,6 +60,7 @@ class SingleTrafficLightView @JvmOverloads constructor( override fun onDetachedFromWindow() { super.onDetachedFromWindow() + CallerTrafficLightListenerManager.removeListener(TAG) CallerHmiViewControlListenerManager.removeListener(TrafficLightView_TAG) } @@ -57,10 +68,10 @@ class SingleTrafficLightView @JvmOverloads constructor( * 展示红绿灯预警 * * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 + * @param lightSource 1:云端下发;2:自车感知 3:OBU */ - override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) { - super.showWarningTrafficLight(checkLightId, lightSource) + override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) { + super.showTrafficLight(checkLightId, lightSource) mCurrentLightId = checkLightId if (!HmiBuildConfig.isShowTrafficLightView) { updateTrafficLightIcon(checkLightId, lightSource) @@ -70,16 +81,16 @@ class SingleTrafficLightView @JvmOverloads constructor( /** * 关闭红绿灯预警展示,并重制灯态 */ - override fun disableWarningTrafficLight() { - super.disableWarningTrafficLight() + override fun disableTrafficLight() { + super.disableTrafficLight() UiThreadHandler.post { - mCurrentLightId = 0 + mCurrentLightId = TrafficLightEnum.BLACK this@SingleTrafficLightView.visibility = GONE } } - override fun disableCountdown() { - super.disableCountdown() + override fun disableTrafficLightCountDown() { + super.disableTrafficLightCountDown() UiThreadHandler.post { // 小巴车的司机端需要展示红绿灯信号来源 if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) @@ -118,9 +129,9 @@ class SingleTrafficLightView @JvmOverloads constructor( UiThreadHandler.post { resetView() when (mCurrentLightId) { - 1 -> changeCountdownRed(redNum) - 2 -> changeCountdownYellow(yellowNum) - 3 -> changeCountdownGreen(greenNum) + TrafficLightEnum.RED -> changeCountdownRed(redNum) + TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum) + TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum) else -> UiThreadHandler.post { mLightTimeTV!!.text = "" } } } @@ -140,7 +151,7 @@ class SingleTrafficLightView @JvmOverloads constructor( ) mLightTimeTV!!.text = redNum.toString() } else { - disableCountdown() + disableTrafficLightCountDown() mLightTimeTV!!.text = "" } } @@ -160,7 +171,7 @@ class SingleTrafficLightView @JvmOverloads constructor( ) mLightTimeTV!!.text = greenNum.toString() } else { - disableCountdown() + disableTrafficLightCountDown() mLightTimeTV!!.text = "" } } @@ -180,7 +191,7 @@ class SingleTrafficLightView @JvmOverloads constructor( ) mLightTimeTV!!.text = yellowNum.toString() } else { - disableCountdown() + disableTrafficLightCountDown() mLightTimeTV!!.text = "" } } @@ -192,30 +203,33 @@ class SingleTrafficLightView @JvmOverloads constructor( * @param lightId 0-都是默认,1-红,2-黄,3-绿 * @param lightSource 1:云端下发;2:自车感知 */ - private fun updateTrafficLightIcon(lightId: Int, lightSource: Int) { + private fun updateTrafficLightIcon(lightId: TrafficLightEnum, lightSource: DataSourceType) { UiThreadHandler.post { when (lightId) { - 1 -> { + TrafficLightEnum.RED -> { mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_red_nor) this@SingleTrafficLightView.visibility = VISIBLE } - 2 -> { + TrafficLightEnum.YELLOW -> { mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_nor) this@SingleTrafficLightView.visibility = VISIBLE } - 3 -> { + TrafficLightEnum.GREEN -> { mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_nor) this@SingleTrafficLightView.visibility = VISIBLE } else -> this@SingleTrafficLightView.visibility = GONE } when (lightSource) { - 1 -> { + DataSourceType.AICLOUD -> { mLightSourceTV!!.text = "云端下发" } - 2 -> { + DataSourceType.TELEMATIC -> { mLightSourceTV!!.text = "自车感知" } + DataSourceType.OBU -> { + mLightSourceTV!!.text = "OBU" + } else -> { mLightSourceTV!!.visibility = GONE } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficLightView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficLightView.kt deleted file mode 100644 index c8406f16bd..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficLightView.kt +++ /dev/null @@ -1,122 +0,0 @@ -package com.mogo.eagle.core.function.hmi.ui.widget - -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.function.api.hmi.view.IViewTrafficLight -import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import kotlinx.android.synthetic.main.view_traffic_light_vr.view.* - -/** - * @author xiaoyuzhou - * @date 2021/8/4 3:16 下午 - * 红绿灯控件 - */ -class TrafficLightView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : IViewTrafficLight(context, attrs, defStyleAttr) { - - - init { - LayoutInflater.from(context).inflate(R.layout.view_traffic_light_vr, this, true) - } - - /** - * 展示红绿灯预警 - * - * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 - */ - override fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) { - UiThreadHandler.post { - visibility = View.VISIBLE - when (checkLightId) { - 0 -> { - ctvRedTrafficLight.isChecked = false - ctvYellowTrafficLight.isChecked = false - ctvGreenTrafficLight.isChecked = false - } - 1 -> { - ctvRedTrafficLight.isChecked = true - ctvYellowTrafficLight.isChecked = false - ctvGreenTrafficLight.isChecked = false - } - 2 -> { - ctvRedTrafficLight.isChecked = false - ctvYellowTrafficLight.isChecked = true - ctvGreenTrafficLight.isChecked = false - } - 3 -> { - ctvRedTrafficLight.isChecked = false - ctvYellowTrafficLight.isChecked = false - ctvGreenTrafficLight.isChecked = true - } - } - } - } - - /** - * 关闭红绿灯预警展示,并重制灯态 - */ - override fun disableWarningTrafficLight() { - UiThreadHandler.post { - visibility = View.GONE - ctvRedTrafficLight.isChecked = false - ctvYellowTrafficLight.isChecked = false - ctvGreenTrafficLight.isChecked = false - ctvRedTrafficLight.text = "" - ctvYellowTrafficLight.text = "" - ctvGreenTrafficLight.text = "" - } - } - - - /** - * @param readNum 红灯倒计时 - * @param yellowNum 黄灯倒计时 - * @param greenNum 绿灯倒计时 - */ - override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) { - UiThreadHandler.post { - changeCountdownGreen(readNum) - changeCountdownYellow(yellowNum) - changeCountdownRed(greenNum) - } - } - - override fun changeCountdownGreen(greenNum: Int) { - UiThreadHandler.post { - if (greenNum > 0) { - ctvGreenTrafficLight.text = "$greenNum" - } else { - ctvGreenTrafficLight.text = "" - } - } - } - - override fun changeCountdownYellow(yellowNum: Int) { - UiThreadHandler.post { - if (yellowNum > 0) { - ctvYellowTrafficLight.text = "$yellowNum" - } else { - ctvYellowTrafficLight.text = "" - } - } - } - - override fun changeCountdownRed(redNum: Int) { - UiThreadHandler.post { - if (redNum > 0) { - ctvRedTrafficLight.text = "$redNum" - } else { - ctvRedTrafficLight.text = "" - } - } - } - -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index 18977a81a3..ff7e1605b8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -242,34 +242,35 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis */ @Override public boolean dispatchKeyEvent(KeyEvent event) { - CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event); + CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event); String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString(MfConstants.BLUETOOTH_NAME); if (!isPressEnd) { - CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName); + CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName); } if (bluetoothName.equals("MINI_KEYBOARD")) { if (!isPressEnd) { isPressEnd = true; startPressTime = System.currentTimeMillis(); } - CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction()); + CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction()); if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2 if (event.getAction() == KeyEvent.ACTION_DOWN) { pressADownTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime); if ((pressADownTime - startPressTime) > 360 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) { if (isShowToast) { - ToastUtils.showShort("方块 A 按AB组合 -2 "); + ToastUtils.showShort("方块 A 按AB组合 +1 "); } - sendAcc(true, -2); + sendAcc(true, +1); isCombinationKey = 3; } if (isCombinationKey != 3 && isCombinationKey != 1) { if ((pressADownTime - startPressTime) > 1320) { if (isShowToast) { - ToastUtils.showShort("方块 长按A 无 操作 "); + ToastUtils.showShort("方块 长按A -2 "); } + sendAcc(true, -2); isCombinationKey = 2; } } @@ -299,17 +300,16 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime); if ((pressBDownTime - startPressTime) > 360 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) { if (isShowToast) { - ToastUtils.showShort("方块 B 按AB组合 "); + ToastUtils.showShort("方块 B 按AB组合 +1 "); } - sendAcc(true, -2); + sendAcc(true, +1); isCombinationKey = 3; } if (isCombinationKey != 3 && isCombinationKey != 1) { if ((pressBDownTime - startPressTime) > 1320) { if (isShowToast) { - ToastUtils.showShort("方块 长按B +1 "); + ToastUtils.showShort("方块 长按B 无操作 "); } - sendAcc(true, +1); isCombinationKey = 2; } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index d67b55b7c7..36e777c379 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -27,7 +27,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListene import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb; -import com.mogo.eagle.core.function.overview.OverviewDb; +import com.mogo.eagle.core.function.overview.db.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index 9cfb39d1e0..8e84662b5e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -21,99 +21,6 @@ android:layout_height="match_parent" android:paddingTop="72dp"> - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ipc_report.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ipc_report.xml index 2e26a4ebc0..5911e16c42 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ipc_report.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_ipc_report.xml @@ -1,27 +1,27 @@ @@ -56,11 +56,11 @@ app:layout_constraintLeft_toLeftOf="@id/tvReportTimeNormal" app:layout_constraintRight_toRightOf="@id/tvStatusSelect" app:layout_constraintBottom_toBottomOf="parent" - android:layout_marginTop="5px" - android:layout_marginBottom="25px" + android:layout_marginTop="5dp" + android:layout_marginBottom="25dp" android:textColor="#B3FFFFFF" android:gravity="start" - android:textSize="28px" + android:textSize="28dp" android:maxLines="1" android:ellipsize="end" android:lineSpacingMultiplier="1.2" @@ -72,18 +72,18 @@ android:layout_height="wrap_content" android:text="折叠" android:textColor="#FFFFFFFF" - android:textSize="24px" + android:textSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintRight_toRightOf="parent" - android:layout_marginTop="25px" - android:layout_marginEnd="25px" + android:layout_marginTop="25dp" + android:layout_marginEnd="25dp" android:background="@drawable/bg_msg_status_select" android:drawableStart="@drawable/icon_msg_open" - android:drawablePadding="10px" - android:paddingStart="15px" - android:paddingEnd="15px" - android:paddingTop="5px" - android:paddingBottom="5px" + android:drawablePadding="10dp" + android:paddingStart="15dp" + android:paddingEnd="15dp" + android:paddingTop="5dp" + android:paddingBottom="5dp" /> @@ -118,8 +118,8 @@ app:layout_constraintBottom_toBottomOf="@id/ivReportImageOpen" app:layout_constraintLeft_toRightOf="@id/ivReportImageOpen" android:textColor="#FFFFFFFF" - android:textSize="32px" - android:layout_marginStart="10px" + android:textSize="32dp" + android:layout_marginStart="10dp" android:visibility="gone" /> @@ -129,9 +129,9 @@ android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/ivReportImageOpen" app:layout_constraintLeft_toLeftOf="@id/ivReportImageOpen" - android:layout_marginTop="10px" + android:layout_marginTop="10dp" android:textColor="#B3FFFFFF" - android:textSize="28px" + android:textSize="28dp" android:lineSpacingMultiplier="1.2" android:visibility="gone" /> @@ -143,7 +143,7 @@ app:layout_constraintTop_toBottomOf="@id/tvReportTimeOpen" app:layout_constraintLeft_toLeftOf="@id/tvReportTimeOpen" android:textColor="#B3FFFFFF" - android:textSize="28px" + android:textSize="28dp" android:lineSpacingMultiplier="1.2" android:visibility="gone" /> @@ -157,7 +157,7 @@ app:layout_constraintRight_toRightOf="@id/tvStatusSelect" android:gravity="start" android:textColor="#B3FFFFFF" - android:textSize="28px" + android:textSize="28dp" android:lineSpacingMultiplier="1.2" android:visibility="gone" /> @@ -170,9 +170,9 @@ app:layout_constraintLeft_toLeftOf="@id/tvReportReasonOpen" app:layout_constraintRight_toRightOf="@id/tvStatusSelect" app:layout_constraintBottom_toBottomOf="parent" - android:layout_marginBottom="15px" + android:layout_marginBottom="15dp" android:textColor="#B3FFFFFF" - android:textSize="28px" + android:textSize="28dp" android:lineSpacingMultiplier="1.2" android:visibility="gone" /> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_notice.xml index 38b8988e07..9506d06130 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_notice.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_notice.xml @@ -1,25 +1,25 @@ @@ -29,10 +29,10 @@ android:layout_height="wrap_content" android:text="官方公告" android:textColor="#FFFFFFFF" - android:textSize="32px" + android:textSize="32dp" app:layout_constraintTop_toTopOf="@id/ivNoticeImage" app:layout_constraintLeft_toRightOf="@id/ivNoticeImage" - android:layout_marginStart="15px" + android:layout_marginStart="15dp" /> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_operation.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_operation.xml index 8537e5d213..375a39975f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_operation.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_operation.xml @@ -1,27 +1,27 @@ @@ -34,8 +34,8 @@ app:layout_constraintLeft_toRightOf="@id/ivOperationImageNormal" android:text="运营平台" android:textColor="#FFFFFFFF" - android:textSize="32px" - android:layout_marginStart="23px" + android:textSize="32dp" + android:layout_marginStart="23dp" /> @@ -61,18 +61,18 @@ android:layout_height="wrap_content" android:text="折叠" android:textColor="#FFFFFFFF" - android:textSize="24px" + android:textSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintRight_toRightOf="parent" - android:layout_marginTop="25px" - android:layout_marginEnd="25px" + android:layout_marginTop="25dp" + android:layout_marginEnd="25dp" android:background="@drawable/bg_msg_status_select" android:drawableStart="@drawable/icon_msg_open" - android:drawablePadding="10px" - android:paddingStart="15px" - android:paddingEnd="15px" - android:paddingTop="5px" - android:paddingBottom="5px" + android:drawablePadding="10dp" + android:paddingStart="15dp" + android:paddingEnd="15dp" + android:paddingTop="5dp" + android:paddingBottom="5dp" /> @@ -108,8 +108,8 @@ app:layout_constraintLeft_toRightOf="@id/ivOperationImageOpen" android:text="运营平台" android:textColor="#FFFFFFFF" - android:textSize="32px" - android:layout_marginStart="10px" + android:textSize="32dp" + android:layout_marginStart="10dp" android:visibility="gone" /> @@ -122,11 +122,11 @@ app:layout_constraintLeft_toLeftOf="@id/ivOperationImageOpen" app:layout_constraintRight_toRightOf="@id/tvOperationStatusSelect" android:gravity="start" - android:layout_marginTop="10px" - android:layout_marginBottom="15px" + android:layout_marginTop="10dp" + android:layout_marginBottom="15dp" android:lineSpacingMultiplier="1.2" android:textColor="#B3FFFFFF" - android:textSize="28px" + android:textSize="28dp" android:visibility="gone" /> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_v2x.xml index 808e8e2396..ef36f539a0 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_v2x.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_box_v2x.xml @@ -1,24 +1,24 @@ + android:layout_marginStart="30dp" + android:layout_marginEnd="30dp" + android:layout_marginTop="7dp" + android:layout_marginBottom="7dp"> + android:layout_margin="25dp"/> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_notice.xml index d88358219c..2496ec595f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_notice.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_notice.xml @@ -1,24 +1,23 @@ @@ -28,10 +27,10 @@ android:layout_height="wrap_content" android:text="官方公告" android:textColor="#FFFFFFFF" - android:textSize="32px" + android:textSize="32dp" app:layout_constraintTop_toTopOf="@id/ivNoticeImage" app:layout_constraintLeft_toRightOf="@id/ivNoticeImage" - android:layout_marginStart="15px" + android:layout_marginStart="15dp" /> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_operation.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_operation.xml index e7e45d6527..f488699d48 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_operation.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_operation.xml @@ -1,22 +1,24 @@ - + android:layout_marginTop="7dp" + android:layout_marginBottom="7dp" + > @@ -27,9 +29,9 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toTopOf="@id/tvBubbleOperationContent" app:layout_constraintLeft_toRightOf="@id/ivBubbleOperationImage" - android:layout_marginStart="25px" + android:layout_marginStart="25dp" android:textColor="#FFFFFFFF" - android:textSize="32px" + android:textSize="32dp" android:text="运营平台" /> @@ -40,9 +42,9 @@ app:layout_constraintTop_toTopOf="@id/tvBubbleOperationTitle" app:layout_constraintBottom_toBottomOf="@id/tvBubbleOperationTitle" app:layout_constraintRight_toRightOf="parent" - android:layout_marginEnd="25px" + android:layout_marginEnd="25dp" android:textColor="#80FFFFFF" - android:textSize="24px" + android:textSize="24dp" /> - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml index ed451de81e..7bc6c8e3a8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml @@ -1,23 +1,24 @@ - @@ -27,10 +28,10 @@ android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent" app:layout_constraintLeft_toRightOf="@id/ivBubbleReportImage" - android:layout_marginTop="15px" - android:layout_marginStart="25px" + android:layout_marginTop="15dp" + android:layout_marginStart="25dp" android:textColor="#FFFFFFFF" - android:textSize="32px" + android:textSize="32dp" android:text="Error" /> @@ -40,9 +41,9 @@ android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/tvBubbleReportTitle" app:layout_constraintLeft_toLeftOf="@id/tvBubbleReportTitle" - android:layout_marginTop="5px" + android:layout_marginTop="5dp" android:textColor="#B3FFFFFF" - android:textSize="28px" + android:textSize="28dp" /> - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml index a3ba2a9c73..9888e42f87 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml @@ -1,22 +1,23 @@ - + android:layout_marginTop="7dp" + android:layout_marginBottom="7dp"> + android:layout_margin="25dp"/> - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_notice.xml index 8a26d7a513..30d71f2364 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_notice.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_notice.xml @@ -1,18 +1,18 @@ @@ -47,7 +47,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:textColor="#FFFFFFFF" - android:textSize="28px" + android:textSize="28dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="@id/tvPassengerNoticeTitle" app:layout_constraintTop_toBottomOf="@id/tvPassengerNoticeTitle" @@ -59,11 +59,11 @@ \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml index fd7c05db5a..fbe95e1a36 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml @@ -1,21 +1,22 @@ - + app:roundLayoutRadius="24dp" + android:layout_marginTop="16dp" + android:layout_marginBottom="16dp"> - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_notice.xml index b56115e291..d65de843e3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_notice.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_notice.xml @@ -1,13 +1,13 @@ \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_v2x.xml index 0e8088cae4..a323fe7515 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_v2x.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_list_v2x.xml @@ -1,13 +1,13 @@ \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_driver_msg_box_bubble.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_driver_msg_box_bubble.xml index ed5d0dab45..db4163466c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_driver_msg_box_bubble.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_driver_msg_box_bubble.xml @@ -1,6 +1,6 @@ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_bubble.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_bubble.xml index ac09584e77..542619f7ea 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_bubble.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_bubble.xml @@ -1,7 +1,7 @@ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_list.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_list.xml index 74431ca542..053b089c8c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_list.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_passenger_msg_box_list.xml @@ -1,12 +1,12 @@ + android:layout_marginBottom="16dp"> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 639cc50149..68ffc3415d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -1286,30 +1286,6 @@ android:textOn="显示「小地图」" android:textSize="@dimen/dp_24" /> - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 151a0660e6..1b1996082c 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -81,6 +81,7 @@ dependencies { implementation project(':core:mogo-core-res') implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') + implementation project(':core:function-impl:mogo-core-function-datacenter') implementation project(':core:mogo-core-function-call') implementation project(":libraries:mogo-map") } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/collect/MoGoMapDataCollectProvider.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/collect/MoGoMapDataCollectProvider.kt index 83e51481df..c4e6e8a277 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/collect/MoGoMapDataCollectProvider.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/collect/MoGoMapDataCollectProvider.kt @@ -9,12 +9,9 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP -import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.call.autopilot.* -import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager import com.zhidaoauto.map.operational.open.GatherApi diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt index 78e56df4f0..9eee2c09c1 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt @@ -5,7 +5,7 @@ import android.os.Message import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener -import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler import mogo.telematics.pad.MessagePad import mogo.telematics.pad.MessagePad.TrackedObject @@ -30,7 +30,7 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener { } else { DriverIdentify.originDataDrawer } - CallerObuListenerManager.addListener(TAG, this) + CallerObuWarningListenerManager.addListener(TAG, this) } private const val MSG_DATA_TRACK = 0 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt index 0591bc9c92..403a8d640c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt @@ -8,8 +8,8 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.commons.mvp.MvpFragment import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.constants.MoGoFragmentPaths +import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.map.CenterLine -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider @@ -18,15 +18,14 @@ import com.mogo.eagle.core.function.business.MapPointCloudSubscriber import com.mogo.eagle.core.function.business.SpeedLimitDataManager import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight import com.mogo.eagle.core.function.call.map.CallerHDMapManager -import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager +import com.mogo.eagle.core.function.datacenter.location.IMoGoLocationListener +import com.mogo.eagle.core.function.datacenter.location.MoGoLocationManager import com.mogo.eagle.core.function.overview.InfStructureManager import com.mogo.eagle.core.function.overview.InfStructureManager.savePlanningData import com.mogo.eagle.core.function.overview.obtainViewModel @@ -55,7 +54,7 @@ class MapFragment : MvpFragment(), MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener, - IMoGoChassisLocationWGS84Listener, + IMoGoLocationListener, IMoGoPlanningRottingListener, IMoGoChassisLamplightListener { @@ -115,7 +114,7 @@ class MapFragment : MvpFragment(), // 添加换肤监听 CallerSkinModeListenerManager.addListener(Companion.functionName, this) CallerPlanningRottingListenerManager.addListener(Companion.functionName, this) - CallerChassisLocationWGS84ListenerManager.addListener(Companion.functionName, this) + MoGoLocationManager.addListener(Companion.functionName, this) CallerChassisLamplightListenerManager.addListener(Companion.functionName, this) } @@ -219,7 +218,7 @@ class MapFragment : MvpFragment(), override fun onDestroyView() { CallerSkinModeListenerManager.removeListener(Companion.functionName) CallerPlanningRottingListenerManager.removeListener(Companion.functionName) - CallerChassisLocationWGS84ListenerManager.removeListener(Companion.functionName) + MoGoLocationManager.removeListener(Companion.functionName) CallerChassisLamplightListenerManager.removeListener(Companion.functionName) if (mMogoMapView != null) { @@ -347,19 +346,19 @@ class MapFragment : MvpFragment(), private var isShowTurnLight = false private var brakeLight = -1 - override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) { + override fun onLocationChanged(gnssInfo: MessagePad.GnssInfo,sourceType: DataSourceType) { // 跟新地图控件 mMogoMapView?.setExtraGPSData(gnssInfo) if (gnssInfo != null) { - //设置刹车信息 - if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f)) { - brakeLight = 1 + //设置刹车信息,小于默认认为是刹车 + brakeLight = if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f)) { + 1 } else { - brakeLight = 0 + 0 } d(SceneConstant.M_DEVA + "BrakeLight", "---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight) - if (!isShowTurnLight) { + if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效 showBrakeLight(brakeLight) } } @@ -368,7 +367,7 @@ class MapFragment : MvpFragment(), override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { //can数据转发 转向灯状态 0是正常 1是左转 2是右转 if (lightSwitch != null) { - val state: Int = setTurnLightState(lightSwitch.number) + val state: Int = setTurnLightState(lightSwitch.number) //对转向灯进行转换 d(SceneConstant.M_DEVA + "TurnLight", "---onAutopilotLightSwitchData ---state = " + state + "---lightSwitch.getNumber() = " + lightSwitch.number) if (state == 1 || state == 2) { isShowTurnLight = true diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverViewDataManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverViewDataManager.kt new file mode 100644 index 0000000000..1bd7910759 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverViewDataManager.kt @@ -0,0 +1,143 @@ +package com.mogo.eagle.core.function.overview + +import androidx.lifecycle.* +import com.mogo.commons.AbsMogoApplication +import com.mogo.commons.constants.HostConst +import com.mogo.eagle.core.data.map.Infrastructure +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.overview.db.OverviewDb +import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi +import com.mogo.eagle.core.function.overview.remote.V2XEvent +import com.mogo.eagle.core.network.MoGoRetrofitFactory +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant +import io.reactivex.Observable +import io.reactivex.android.schedulers.AndroidSchedulers +import io.reactivex.disposables.Disposable +import io.reactivex.schedulers.Schedulers +import kotlinx.coroutines.launch +import java.util.concurrent.TimeUnit + +object OverViewDataManager { + + const val TAG = "OverViewDataManager" + + private val overviewDao by lazy { + OverviewDb.getDb(AbsMogoApplication.getApp()).overviewDao() + } + + private val _infStructures = MutableLiveData>() + private val _V2XEvents = MutableLiveData>() + private var disposable: Disposable? = null + + val infStructures + get() = _infStructures + + private val _infStructuresMap = _infStructures + .switchMap { infStructures -> + liveData { + val map = HashMap>() + infStructures.forEach { + val geoHash = it.geoHash + if (geoHash == null) { + return@forEach + } else { + if (!map.containsKey(geoHash)) { + val list = ArrayList() + list.add(it) + map[geoHash] = list + } else { + map[geoHash]?.add(it) + } + } + } + emit(map) + } + } + val infStructuresMap + get() = _infStructuresMap + + fun fetchInfStructures() { + ProcessLifecycleOwner.get().lifecycleScope.launch { + val data = try { + // 只查找摄像头 + overviewDao.listInfStructures(0) +// overviewDao.listAllInfStructures() + } catch (e: Exception) { + e.printStackTrace() + null + } + data?.let { + _infStructures.value = it + } + } + } + + fun updateGeoHash(id: Int, geoHash: String) { + ProcessLifecycleOwner.get().lifecycleScope.launch { + try { + overviewDao.updateGeoHash(id, geoHash) + } catch (e: Exception) { + e.printStackTrace() + } + } + } + + fun getAllV2XEventsByLineId(sn: String) { + if (disposable != null && !disposable!!.isDisposed) { + disposable!!.dispose() + } + + // 1分钟查询一次 + disposable = Observable.interval(2000, 60000, TimeUnit.MILLISECONDS) + .flatMap { + val lineId = getLineId() + if (lineId > 0) { + MoGoRetrofitFactory.getInstance(HostConst.getHost()) + .create(OverViewServiceApi::class.java) + .queryAllV2XEventsByLineId(lineId.toString(), sn) + .map { + if (it.code == 200 || it.code == 0) { + CallerLogger.d(SceneConstant.M_MAP + TAG, "请求成功,size为:${it.result?.v2XEventList?.size}") + return@map it.result?.v2XEventList + } else { + CallerLogger.d(SceneConstant.M_MAP + TAG, "请求失败,code为:${it.code}") + return@map ArrayList() + } + } + } else { + Observable.just(ArrayList()) + } + } + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + it?.apply { + _V2XEvents.value = this + } + } + } + + fun getV2XEventLiveData() = _V2XEvents + + fun stopQueryV2XEvents() { + disposable?.dispose() + } + + private fun getLineId(): Long { + var lineId: Long = -1 + val parameter = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo() + .autopilotControlParameters + if (parameter != null) { + if (parameter.autoPilotLine != null) { + lineId = parameter.autoPilotLine!!.lineId + CallerLogger.d(SceneConstant.M_MAP + TAG, "lineId为:$lineId") + } else { + CallerLogger.d(SceneConstant.M_MAP + TAG, "parameter.autoPilotLine为null") + } + } else { + CallerLogger.d(SceneConstant.M_MAP + TAG, "parameter为null") + } + return lineId + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt index d6dd931290..0418a667e6 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt @@ -5,6 +5,8 @@ import android.app.Application import androidx.annotation.VisibleForTesting import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider +import com.mogo.eagle.core.function.overview.db.OverviewDao +import com.mogo.eagle.core.function.overview.db.OverviewDb import com.mogo.eagle.core.function.overview.vm.OverViewModel class ViewModelFactory private constructor( diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDao.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDao.kt similarity index 91% rename from core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDao.kt rename to core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDao.kt index 3bc147766c..4398041c9e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDao.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDao.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.function.overview +package com.mogo.eagle.core.function.overview.db import androidx.room.Dao import androidx.room.Query diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDb.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDb.kt similarity index 96% rename from core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDb.kt rename to core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDb.kt index 555fd59913..596c282697 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDb.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDb.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.function.overview +package com.mogo.eagle.core.function.overview.db import android.content.Context import androidx.room.Database diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt new file mode 100644 index 0000000000..ddc6423415 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt @@ -0,0 +1,580 @@ +package com.mogo.eagle.core.function.overview.view + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas +import android.os.Bundle +import android.util.AttributeSet +import android.util.Log +import android.view.LayoutInflater +import android.view.MotionEvent +import android.widget.RelativeLayout +import android.widget.TextView +import ch.hsr.geohash.GeoHash +import com.amap.api.maps.AMap +import com.amap.api.maps.CameraUpdate +import com.amap.api.maps.CameraUpdateFactory +import com.amap.api.maps.TextureMapView +import com.amap.api.maps.model.* +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.map.Infrastructure +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.getGlobalPath +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.hmi.CallerHmiManager.showVideoDialog +import com.mogo.eagle.core.function.map.R +import com.mogo.eagle.core.function.overview.InfStructureManager +import com.mogo.eagle.core.function.overview.InfStructureManager.getData +import com.mogo.eagle.core.function.overview.OverViewDataManager +import com.mogo.eagle.core.function.overview.remote.V2XEvent +import com.mogo.eagle.core.function.smp.MakerWithCount +import com.mogo.eagle.core.function.smp.MarkerDrawerManager +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.callback +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.coordinateConverterWgsToGcj +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.lonLat +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.planningPoints +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.startLoopCalCarLocation +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.updateRoutePoints +import com.mogo.eagle.core.function.smp.V2XMarkerView +import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isTaxi +import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import me.jessyan.autosize.utils.AutoSizeUtils +import mogo.telematics.pad.MessagePad + +/** + * 全览地图View + * + * @author chenfufeng + */ +class OverMapView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener { + private var mMapView: TextureMapView? = null + private var mAMap: AMap? = null + private val zoomLevel = 15 + private var mCameraUpdate: CameraUpdate? = null + private var mContext: Context? = null + private val mTilt = 60f + private var overLayerView: TextView? = null + + // 全局路径规划中的GeoHash网格 + private val pathMap: MutableMap?> = HashMap() + private val posInfMap: MutableMap?> = HashMap() + + // =============绘制轨迹线相关============= + private var mCarMarker: Marker? = null + private var mCompassMarker: Marker? = null + private var mStartMarker: Marker? = null + private var mEndMarker: Marker? = null + private var mBottomPolyline: Polyline? = null + private var mCoveredPolyline: Polyline? = null + + // 计算索引并设置对应的Bitmap + var arrivedBitmap: BitmapDescriptor? = null + var unArrivedBitmap: BitmapDescriptor? = null + + // 绘制轨迹线的集合 + private val textureList: MutableList = ArrayList() + private val texIndexList: MutableList = ArrayList() + private var mLocation: MessagePad.GnssInfo? = null + private var isFirstLocation = true + var mCustomMapStyleOptions: CustomMapStyleOptions? = null + var currMarkerList: ArrayList? = null + + companion object { + const val TAG = "OverMapView" + } + + init { + try { + initView(context) + } catch (e: Exception) { + e.printStackTrace() + } + } + + // =================必须通知高德地图生命周期的变化================= + fun onCreateView(savedInstanceState: Bundle?) { + if (mMapView != null) { + mMapView!!.onCreate(savedInstanceState) + } + } + + fun onResume() { + if (mMapView != null) { + mMapView!!.onResume() + } + } + + fun onPause() { + if (mMapView != null) { + mMapView!!.onPause() + } + } + + fun onDestroy() { + if (mMapView != null) { + mMapView!!.onDestroy() + } + if (mMapView != null) { + mMapView!!.onDestroy() + } + } + // =================必须通知高德地图生命周期的变化================= + + private fun initView(context: Context) { + mContext = context + val smpView = LayoutInflater.from(context).inflate(R.layout.module_overview_map_view, this) + mMapView = smpView.findViewById(R.id.aMapView) + overLayerView = findViewById(R.id.overLayer) + if (isTaxi(FunctionBuildConfig.appIdentityMode)) { + overLayerView?.background = resources.getDrawable(R.drawable.amap_reset) + arrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_arrived) + unArrivedBitmap = + BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_un_arrive) + } else { + overLayerView?.background = resources.getDrawable(R.drawable.amap_reset_bus) + arrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.arrow_arrived_img) + unArrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_smooth_route) + } + CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener) + initAMapView(context) + // 注册定位监听 + CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this) + //设置全览模式 + overLayerView?.setOnClickListener { displayCustomOverView() } + } + + private fun initAMapView(context: Context) { + Log.d(TAG, "initAMapView") + mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel.toFloat()) + mAMap = mMapView!!.map + mCustomMapStyleOptions = CustomMapStyleOptions() + if (isTaxi(FunctionBuildConfig.appIdentityMode)) { + mCustomMapStyleOptions!!.styleData = + MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data") + mCustomMapStyleOptions!!.styleExtraData = + MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data") + } else { + mCustomMapStyleOptions!!.styleData = + MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style_bus.data") + mCustomMapStyleOptions!!.styleExtraData = + MapAssetStyleUtils.getAssetsExtraStyle( + getContext(), + "over_view_style_extra_bus.data" + ) + } + mAMap?.setOnMapLoadedListener { + Log.d(TAG, "---onMapLoaded---") + if (mCustomMapStyleOptions != null) { + // 加载自定义样式 + mCustomMapStyleOptions!!.isEnable = true + // 设置自定义样式 + mAMap?.setCustomMapStyle(mCustomMapStyleOptions) + } + // 实时路况图层关闭,必须添加在loaded结束之后,其他位置不生效 + mAMap?.isTrafficEnabled = false + } + setUpMap() + customOptions() + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + OverViewDataManager.infStructuresMap.observe(lifecycleOwner) { list -> + InfStructureManager.saveData(list) + } + // 查询本地数据库中的摄像头数据 + OverViewDataManager.fetchInfStructures() + // 主动查一次全局路径规划的数据 + getGlobalPath() + // 定时查询V2X事件 + OverViewDataManager.getV2XEventLiveData().observe(lifecycleOwner) { + showV2XEventMarkers(it) + } + OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn) + } + + private fun setUpMap() { + // 地图文字标注 + mAMap!!.showMapText(true) + //设置希望展示的地图缩放级别 + mAMap!!.moveCamera(mCameraUpdate) + //设置地图的样式 + val uiSettings = mAMap!!.uiSettings + //地图缩放级别的交换按钮 + uiSettings.isZoomControlsEnabled = false + //所有手势 + uiSettings.setAllGesturesEnabled(true) + //隐藏指南针 + uiSettings.isCompassEnabled = false + //设置倾斜手势是否可用。 + uiSettings.isTiltGesturesEnabled = true + //隐藏默认的定位按钮 + uiSettings.isMyLocationButtonEnabled = false + //设置Logo下边界距离屏幕底部的边距,设置为负值即可 + uiSettings.setLogoBottomMargin(-150) + Log.d(TAG, "before onMapLoaded") + } + + /** + * 自定义导航View和路况状态 + */ + private fun customOptions() { + if (isTaxi(FunctionBuildConfig.appIdentityMode)) { + mCarMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_car_icon)) + .anchor(0.5f, 0.5f) + ) + mCompassMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.amap_custom_corner)) + .anchor(0.5f, 0.5f) + ) + } else { + mCarMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_bus_icon)) + .anchor(0.5f, 0.5f) + ) + mCompassMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_corner)) + .anchor(0.5f, 0.5f) + ) + } + mStartMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)) + ) + mEndMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)) + ) + } + + private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener = + object : IMoGoPlanningRottingListener { + /** + * 根据全路径获取起始点和经停点进行导航路线绘制 + * 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测 + * 室内某个bag包自动驾驶启动8s后返回 + */ + override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { + Log.d(TAG, "onAutopilotRotting") + handlePlanningData(globalPathResp!!.wayPointsList) + } + } + + fun handlePlanningData(locationList: List) { + val list: List = locationList + // 转成高德坐标系并存储 + updateRoutePoints(list, mContext!!) + val planningPointList: List = planningPoints + UiThreadHandler.post { + displayCustomOverView() + drawStartAndEndMarker(planningPointList) + } + callback = object : MarkerDrawerManager.Callback { + override fun onLocationChanged(planningPoints: List, locIndex: Int) { + // 每1s刷新一下轨迹线 + UiThreadHandler.post { + if (planningPoints.isNotEmpty()) { + drawPolyline(planningPoints, locIndex) + } + } + } + } + startLoopCalCarLocation() + UiThreadHandler.post { drawInfrastructureMarkers(locationList) } + } + + /** + * 显示V2X事件的Marker + */ + fun showV2XEventMarkers(v2XEvents: List?) { + if (v2XEvents == null || v2XEvents.isEmpty()) return + clearV2XMarkers() + val markerOptionsList = ArrayList() + for ((_, _, _, center, _, _, poiType, coordinateType) in v2XEvents) { + if (center != null) { + center.lon + val markerOption = MarkerOptions() + var latLng: LatLng = if (coordinateType == null || coordinateType == 0) { + LatLng(center.lat, center.lon) + } else { + // wgs84坐标系需转成高德坐标系 + coordinateConverterWgsToGcj(mContext!!, center.lat, center.lon) + } + markerOption.position(latLng) + markerOption.anchor(0.13f, 1f) + markerOption.icon( + BitmapDescriptorFactory.fromBitmap( + getV2XBitmap( + poiType + ) + ) + ) + markerOptionsList.add(markerOption) + } + } + if (markerOptionsList.size > 0) { + drawV2XMarkers(markerOptionsList) + } + } + + fun drawV2XMarkers(markerOptionsList: ArrayList?) { + currMarkerList = mAMap!!.addMarkers(markerOptionsList, false) + } + + private fun getV2XBitmap(poiType: String?): Bitmap { + val marker = V2XMarkerView(context, null, 0, poiType) + marker.measure( + MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 229f), MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 96f), MeasureSpec.EXACTLY) + ) + marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight) + val bitmap = Bitmap.createBitmap(marker.width, marker.height, Bitmap.Config.ARGB_8888) + marker.draw(Canvas(bitmap)) + return bitmap + } + + fun clearV2XMarkers() { + if (currMarkerList != null) { + for (marker in currMarkerList!!) { + marker.destroy() + } + currMarkerList = null + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + // 注册定位监听 + CallerChassisLocationGCJ20ListenerManager.removeListener(TAG) + CallerPlanningRottingListenerManager.removeListener(TAG) + OverViewDataManager.stopQueryV2XEvents() + } + + override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { + return false + } + + fun clearCustomPolyline() { + if (mBottomPolyline != null) { + mBottomPolyline!!.remove() + } + if (mCoveredPolyline != null) { + mCoveredPolyline!!.remove() + } + } + + /** + * 绘制新基建Markers(比如:摄像头) + * + * @param locationList + */ + private fun drawInfrastructureMarkers(locationList: List?) { + if (locationList == null) return + if (pathMap.isNotEmpty()) { + pathMap.clear() + } + var geoHash: String? + var infList: ArrayList? + for (i in locationList.indices) { + val latLng = coordinateConverterWgsToGcj(mContext!!, locationList[i]) + geoHash = + GeoHash.withCharacterPrecision(latLng.latitude, latLng.longitude, 7).toBase32() + // 网格内的轨迹点只取一次s + if (!pathMap.containsKey(geoHash)) { + // 从缓存的新基建数据中去取对应geoHash的新基建数据集合 + infList = getData()[geoHash] + if (infList != null) { + pathMap[geoHash] = infList + } + } + } + drawInfMarkers(pathMap) + } + + private fun drawInfMarkers(infStruMap: Map?>) { + // 绘制新基建数据 + if (posInfMap.isNotEmpty()) { + posInfMap.clear() + } + val markerOptionsList: ArrayList = ArrayList() + for (structureList in infStruMap.values) { + // 每个GeoHash内根据坐标系象限分散开摄像头icon显示 + val markerOption = MarkerOptions() + val latLng = LatLng( + java.lang.Double.valueOf(structureList!![0].lat!!), + java.lang.Double.valueOf(structureList[0].lon!!) + ) + markerOption.position(latLng) + val bitmap = getBitmap(structureList.size) + markerOption.icon( + BitmapDescriptorFactory.fromBitmap( + bitmap + ) + ) + markerOption.zIndex(2f) + posInfMap[latLng] = structureList + markerOptionsList.add(markerOption) + } + mAMap!!.addMarkers(markerOptionsList, false) + mAMap!!.setOnMarkerClickListener { marker: Marker -> + val infList: List? = posInfMap[marker.position] + // 如果是摄像头 + if (infList != null) { + showVideoDialog(infList) + return@setOnMarkerClickListener true + } + false + } + } + + private fun getBitmap(count: Int): Bitmap { + val marker = MakerWithCount(context) + marker.setCount(count) + marker.measure( + MeasureSpec.makeMeasureSpec(116, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(116, MeasureSpec.EXACTLY) + ) + marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight) + val bitmap = Bitmap.createBitmap(marker.width, marker.height, Bitmap.Config.ARGB_8888) + marker.draw(Canvas(bitmap)) + return bitmap + } + + /** + * 进入自定义全览模式 + */ + private fun displayCustomOverView() { + val linePointsLatLng = planningPoints + if (linePointsLatLng.size > 1) { + //圈定地图显示范围 + //存放经纬度 + val boundsBuilder = LatLngBounds.Builder() + for (i in linePointsLatLng.indices) { + boundsBuilder.include(linePointsLatLng[i]) + } + val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude) + boundsBuilder.include(currentLatLng) + val cameraPosition = CameraPosition.Builder().tilt(mTilt).build() + //第二个参数为四周留空宽度 + mAMap!!.moveCamera( + CameraUpdateFactory.newLatLngBoundsRect( + boundsBuilder.build(), + 100, + 100, + 100, + 100 + ) + ) + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } else { + //设置希望展示的地图缩放级别 + val cameraPosition = CameraPosition.Builder() + .target(mCarMarker!!.position).tilt(0f).zoom(zoomLevel.toFloat()).build() + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } + } + + /** + * 绘制自车 + * + * @param location + */ + private fun drawCarMarker(location: MessagePad.GnssInfo?) { + if (location == null) return + if (mCarMarker != null) { + val currentLatLng = LatLng(location.latitude, location.longitude) + mCarMarker!!.rotateAngle = (360 - location.heading).toFloat() + mCarMarker!!.position = currentLatLng + mCarMarker!!.setToTop() + if (mCompassMarker != null) { + mCompassMarker!!.rotateAngle = (360 - location.heading).toFloat() + mCompassMarker!!.position = currentLatLng + } + } + } + + /** + * 绘制起始点、终点 + */ + private fun drawStartAndEndMarker(coordinates: List) { + if (mStartMarker != null) { + mStartMarker!!.isVisible = false + } + if (mEndMarker != null) { + mEndMarker!!.isVisible = false + } + if (coordinates.size > 2) { + // 设置开始结束Marker位置 + val startLatLng = coordinates[0] + val endLatLng = coordinates[coordinates.size - 1] + mStartMarker!!.position = startLatLng + mEndMarker!!.position = endLatLng + mStartMarker!!.isVisible = true + mEndMarker!!.isVisible = true + } + } + + /** + * 绘制轨迹线 + * + * @param coordinates + * @param locIndex + */ + private fun drawPolyline(coordinates: List, locIndex: Int) { + if (textureList.size > 0) { + textureList.clear() + } + if (texIndexList.size > 0) { + texIndexList.clear() + } + for (i in coordinates.indices) { + if (i <= locIndex) { + // 已走过的置灰 + textureList.add(arrivedBitmap) + } else { + // 未走过的纹理 + textureList.add(unArrivedBitmap) + } + texIndexList.add(i) + } + if (mAMap != null && coordinates.size > 2) { + //设置线段纹理 + val polylineOptions = PolylineOptions() + polylineOptions.addAll(coordinates) + polylineOptions.width(14f) //线段宽度 + polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound) + polylineOptions.customTextureList = textureList + polylineOptions.customTextureIndex = texIndexList + // 绘制线 + mBottomPolyline = mCoveredPolyline + mCoveredPolyline = mAMap!!.addPolyline(polylineOptions) + if (mBottomPolyline != null) { + mBottomPolyline!!.remove() + } + } + } + + override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) { + mLocation = gnssInfo + lonLat = Pair(gnssInfo!!.longitude, gnssInfo.latitude) + drawCarMarker(gnssInfo) + if (isFirstLocation) { + displayCustomOverView() + isFirstLocation = false + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt index 9250e8fd6e..8b1237a6c6 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.* import com.mogo.commons.constants.HostConst import com.mogo.eagle.core.data.map.Infrastructure import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo -import com.mogo.eagle.core.function.overview.OverviewDao +import com.mogo.eagle.core.function.overview.db.OverviewDao import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi import com.mogo.eagle.core.function.overview.remote.V2XEvent import com.mogo.eagle.core.network.MoGoRetrofitFactory diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png index e69de29bb2..7a03a5972c 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png index e69de29bb2..cd1e0c45a7 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png index e69de29bb2..7a376915ce 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png index e69de29bb2..c98ac95838 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png index e69de29bb2..ec40533fa8 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png index e69de29bb2..ae901b2df2 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png index e69de29bb2..eef4b4e0ea 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png index e69de29bb2..5bcd897394 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png index e69de29bb2..15db7cf734 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png index e69de29bb2..b20d6046d7 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png index e69de29bb2..608e8f2be1 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png index e69de29bb2..8d4bf7cbc2 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png index e69de29bb2..ed13d90608 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png index e69de29bb2..3a06bcb678 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png index e69de29bb2..6c5451ca49 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png index e69de29bb2..09b2e8480f 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png index e69de29bb2..2841ed3770 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png index e69de29bb2..18a981fdd2 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png index e69de29bb2..cbca5fd792 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png index e69de29bb2..6febc135b1 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png index e69de29bb2..a4561c8e5e 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png index e69de29bb2..7a94145199 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png index e69de29bb2..d69704044c 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png index e69de29bb2..971078720b 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png index e69de29bb2..f5c9b2c48a 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png index e69de29bb2..a65cf8591b 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png index e69de29bb2..22d424dcf0 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png index e69de29bb2..56c66de923 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png index e69de29bb2..862fbc25f6 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png index e69de29bb2..0d8e1f1b63 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png index e69de29bb2..50a65c8571 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png index e69de29bb2..3cbad345ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png index e69de29bb2..ca3d131845 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png index e69de29bb2..07a4f2e837 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png index e69de29bb2..e477715df4 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png index e69de29bb2..eadea4fcc2 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png index e69de29bb2..062e7f2ab6 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png index e69de29bb2..9dde80c060 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png index e69de29bb2..69de6b84ec 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png index e69de29bb2..6b473ad63f 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png index e69de29bb2..bbddd52ad0 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png index e69de29bb2..4d4764b480 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png index e69de29bb2..9f3b4d984e 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png index e69de29bb2..82562e17b5 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png index e69de29bb2..5d1d66203a 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png index e69de29bb2..50abe7d551 100644 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png differ diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/HmiBuildConfig.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/HmiBuildConfig.kt index 24fd2fe73e..318111a8de 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/HmiBuildConfig.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/HmiBuildConfig.kt @@ -7,18 +7,6 @@ package com.mogo.eagle.core.data.config */ object HmiBuildConfig { - /** - * 是否展示 转向灯ui - */ - @JvmField - var isShowTurnLightView = true - - /** - * 是否展示 刹车ui - */ - @JvmField - var isShowBrakeLightView = true - /** * 是否显示 限速UI */ diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficLightEnum.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficLightEnum.kt new file mode 100644 index 0000000000..bd1c9869cf --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficLightEnum.kt @@ -0,0 +1,5 @@ +package com.mogo.eagle.core.data.enums + +enum class TrafficLightEnum { + RED,GREEN,YELLOW,BLACK +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt index b0206c4d42..1331f1a366 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt @@ -1,14 +1,19 @@ package com.mogo.eagle.core.data.obu /** + * OBU 相关的状态信息数据 * @author xiaoyuzhou * @date 2021/9/30 5:38 下午 - * OBU 相关的状态信息数据 */ class ObuStatusInfo { - // 当前链接的IP地址, 默认地址 192.168.1.199 + /** + * 当前链接的IP地址, 默认地址 192.168.1.199 + */ var connectIP: String = "192.168.1.199" + /** + * OBU SDK 版本 + */ var obuSdkVersion = "" /** @@ -16,16 +21,6 @@ class ObuStatusInfo { */ var obuStatus = false - /** - * false--没有链接,true--链接成功 - */ - var obuHvStatus = false - - /** - * false--没有链接,true--链接成功 - */ - var obuRvStatus = false - /** * Stack information */ diff --git a/core/mogo-core-function-api/build.gradle b/core/mogo-core-function-api/build.gradle index e9b128373c..d1e326c4c5 100644 --- a/core/mogo-core-function-api/build.gradle +++ b/core/mogo-core-function-api/build.gradle @@ -47,6 +47,8 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.coroutinescore implementation rootProject.ext.dependencies.coroutinesandroid + implementation rootProject.ext.dependencies.mogoobu + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data implementation project(path: ':libraries:mogo-adas') diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt index 40441a3fe9..8e9ec25a58 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt @@ -11,7 +11,7 @@ interface IMoGoChassisLamplightListener { * 车辆转向灯 数据 * @param lightSwitch */ - fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) + fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?){} /** * 车辆刹车灯 数据 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLocationWGS84Listener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLocationWGS84Listener.kt index 6786ce6430..c6c1a7e9ce 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLocationWGS84Listener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLocationWGS84Listener.kt @@ -14,5 +14,5 @@ interface IMoGoChassisLocationWGS84Listener { * * @param gnssInfo */ - fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) + fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/IMoGoHmiViewProxy.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/IMoGoHmiViewProxy.kt deleted file mode 100644 index 7b760ac015..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/IMoGoHmiViewProxy.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.eagle.core.function.api.hmi - -import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight - -/** - * 设置HMI中控件代理接口 - */ -interface IMoGoHmiViewProxy { - - /** - * 设置 红绿灯 代理View - * @param view - */ - fun setProxyTrafficLightView(view: IViewTrafficLight) - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt deleted file mode 100644 index 42bebf7c4c..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.mogo.eagle.core.function.api.hmi.view - -import android.content.Context -import android.util.AttributeSet -import android.widget.LinearLayout - -/** - * 定义红绿灯View具备的功能接口 - */ -abstract class IViewTrafficLight(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : - LinearLayout(context, attrs, defStyleAttr) { - - /** - * 展示红绿灯预警 - * - * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 - */ - open fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) {} - - /** - * 关闭红绿灯预警展示,并重制灯态 - */ - open fun disableWarningTrafficLight() {} - - /** - * @param readNum 红灯倒计时 - * @param yellowNum 黄灯倒计时 - * @param greenNum 绿灯倒计时 - */ - open fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {} - - open fun changeCountdownGreen(greenNum: Int) {} - - open fun changeCountdownYellow(yellowNum: Int) {} - - open fun changeCountdownRed(redNum: Int) {} - - /** - * 隐藏倒计时 - */ - open fun disableCountdown(){} -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt index 928554ef5b..45581ca528 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt @@ -8,29 +8,18 @@ import com.mogo.eagle.core.data.map.Infrastructure 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.hmi.IMoGoHmiViewProxy /** * @author xiaoyuzhou * @date 2021/8/2 7:36 下午 */ -interface IMoGoHmiProvider : IMoGoHmiViewProxy { +interface IMoGoHmiProvider { /** * 浓雾预警 */ fun displayEffects() - /** - * 控制转向灯 - */ - fun setTurnLightFunction(isOpen: Boolean) - - /** - * 控制刹车功能 - */ - fun setBrakeLightFunction(isOpen: Boolean) - /** * 控制sn绑定功能 */ @@ -57,51 +46,6 @@ interface IMoGoHmiProvider : IMoGoHmiViewProxy { */ fun disableWarningV2X(tag: String?) - /** - * 展示红绿灯预警 - * - * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 - */ - fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) - - /** - * 红绿灯是否展示 - */ - fun isWarningTrafficLightShow(): Boolean - - /** - * 关闭红绿灯预警 - */ - fun disableWarningTrafficLight() - - /** - * 关闭红绿灯倒计时 - */ - fun disableWarningTrafficLightCountDown() - - /** - * 修改红灯倒计时 - */ - fun changeCountdownRed(redNum: Int) - - /** - * 修改黄灯倒计时 - */ - fun changeCountdownYellow(yellowNum: Int) - - /** - * 修改绿灯倒计时 - */ - fun changeCountdownGreen(greenNum: Int) - - /** - * @param readNum 红灯倒计时 - * @param yellowNum 黄灯倒计时 - * @param greenNum 绿灯倒计时 - */ - fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) - /** * 展示指定方位上的红框预警 * @param direction @@ -229,16 +173,6 @@ interface IMoGoHmiProvider : IMoGoHmiViewProxy { */ fun updateMfStatus(tag: String, status: Boolean) - /** - * 设置司机端消息盒子是否展示 - */ - fun updateDriverMsgBoxTipView(show: Boolean) - - /** - * 设置乘客端消息盒子是否展示 - */ - fun updatePassengerMsgBoxTipView(show: Boolean) - /** * 调度弹窗展示 */ diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt new file mode 100644 index 0000000000..872df234ce --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.api.map.listener + +import com.mogo.eagle.core.data.map.MogoLocation + +/** + * 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20 + * 这里的数据仅用于非高精度业务 + * @author xiaoyuzhou + * @date 2021/11/1 7:17 下午 + */ +interface IGaoDeMapLocationListener { + /** + * 定位发生改变 + * + * @param location 新定位点 + */ + fun onLocationChanged(location: MogoLocation, from: Int, isGps: Boolean) +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IMoGoMapLocationListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IMoGoMapLocationListener.kt deleted file mode 100644 index 368f4191af..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IMoGoMapLocationListener.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.eagle.core.function.api.map.listener - -import com.mogo.eagle.core.data.map.MogoLocation - -/** - * @author xiaoyuzhou - * @date 2021/11/1 7:17 下午 - * 地图定位回调 - */ -interface IMoGoMapLocationListener { - /** - * 定位发生改变 - * - * @param location 新定位点 - */ - fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt index cebfca9d9b..8cd6469ae6 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt @@ -1,9 +1,25 @@ package com.mogo.eagle.core.function.api.msgbox + +import com.mogo.eagle.core.data.msgbox.MsgBoxBean + /** * @author XuXinChao * @date 2023/1/16 * 消息盒子事件监听回调 */ interface IMsgBoxEventListener { + //汇总事件点击监听 fun onSummaryClickEvent() + + //更新提示红点视图 + fun onUpdateTipEvent(isShow: Boolean) + + //气泡态运营平台事件点击监听 + fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) + + //气泡态V2X消息事件点击监听 + fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) + + //气泡态上报消息事件点击监听 + fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuConnectListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuConnectListener.kt new file mode 100644 index 0000000000..a1cd814bda --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuConnectListener.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.eagle.core.data.obu.ObuStatusInfo + +/** + * OBU 连接状态监听回调 + * @author xiaoyuzhou + * @date 2021/9/30 5:53 下午 + */ +interface IMoGoObuConnectListener { + + /** + * 检查OBU连链接信息 + * @param obuStatusInfo OBU 状态信息 + */ + fun onConnectStatus(obuStatusInfo: ObuStatusInfo) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt new file mode 100644 index 0000000000..c98d8f8982 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuHvBasicsData + +/** + * OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系 + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuLocationWGS84Listener { + + /** + * HV车辆基础信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onObuLocationWGS84(data: MogoObuHvBasicsData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt index 7e39f9e31c..27446d7979 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt @@ -9,13 +9,6 @@ import com.mogo.eagle.core.data.traffic.TrafficData * OBU 状态监听回调 */ interface IMoGoObuStatusListener { - /** - * 检查OBU连链接信息 - * @param obuStatusInfo OBU 状态信息 - */ - fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo){ - - } /** * v2i时延 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt deleted file mode 100644 index 1b4be4e95c..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.eagle.core.function.api.obu - - -/** - * @author lixiaopeng - * @date 2022/1/30 10:28 下午 - * OBU 灯态信息 - */ -interface IMoGoObuTrafficLightListener { - /** - * @param light 灯的信息 - */ - fun onObuTrafficLight(light: Int){} - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningMapListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningMapListener.kt new file mode 100644 index 0000000000..0c38d2a3bd --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningMapListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.ObuScene + +/** + * OBU 地图匹配结果, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningMapListener { + + /** + * 地图匹配结果 + * + * @param mapMatchData 数据 + * @since 1.0.0 + */ + fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsiListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsiListener.kt new file mode 100644 index 0000000000..cfe22d4657 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsiListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.ObuScene + +/** + * OBU RSI预警信息, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningRsiListener { + + /** + * RSI预警信息 + * + * @param rsiWarningData 数据 + * @since 1.0.0 + */ + fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsmListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsmListener.kt new file mode 100644 index 0000000000..0f09c305c1 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsmListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.ObuScene + +/** + * OBU RSM预警信息,弱势交通参与者预警信息 + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningRsmListener { + + /** + * RSM预警信息,弱势交通参与者预警信息 + * + * @param rsmWarningData 数据 + * @since 1.0.0 + */ + fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRvListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRvListener.kt new file mode 100644 index 0000000000..59dd274b8d --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRvListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuRvWarningData + +/** + * OBU V2V预警信息, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningRvListener { + + /** + * OBU V2V预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onMoGoObuRvWarning(data: MogoObuRvWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningSpatListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningSpatListener.kt new file mode 100644 index 0000000000..afa693147b --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningSpatListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.ObuScene + +/** + * OBU 红绿灯预警信息, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningSpatListener { + + /** + * OBU 红绿灯预警信息 + * + * @param spatWarningData 数据 + * @since 1.0.0 + */ + fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt index b0f9026b07..d57b566cad 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt @@ -1,13 +1,15 @@ package com.mogo.eagle.core.function.api.trafficlight +import com.mogo.eagle.core.data.enums.DataSourceType +import com.mogo.eagle.core.data.enums.TrafficLightEnum import com.mogo.eagle.core.data.trafficlight.TrafficLightResult interface IMoGoTrafficLightListener { /** - * 当前红绿灯状态,包含红绿灯灯态,倒计时秒数,灯态经纬度,时间戳,剩余时间 + * 当前云端红绿灯状态,包含红绿灯灯态,倒计时秒数,灯态经纬度,时间戳,剩余时间 */ - fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) + fun onTrafficLightStatus(trafficLightResult: TrafficLightResult){} /** * 车辆进入路口回调 @@ -17,10 +19,46 @@ interface IMoGoTrafficLightListener { } /** - * 红绿灯接口请求失败 + * 云端红绿灯接口请求失败 */ fun onTrafficRequestError(){ } + /** + * obu红绿灯状态 + */ + fun onObuTrafficLightStatus(light: TrafficLightEnum){} + + /** + * 展示红绿灯预警 + * + * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 + * @param lightSource 1:云端下发 2:自车感知 3:OBU + */ + fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {} + + /** + * @param readNum 红灯倒计时 + * @param yellowNum 黄灯倒计时 + * @param greenNum 绿灯倒计时 + */ + fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {} + + fun changeCountdownGreen(greenNum: Int) {} + + fun changeCountdownYellow(yellowNum: Int) {} + + fun changeCountdownRed(redNum: Int) {} + + /** + * 关闭红绿灯预警展示,并重制灯态 + */ + fun disableTrafficLight() {} + + /** + * 关闭红绿灯计数 + */ + fun disableTrafficLightCountDown() {} + } \ No newline at end of file diff --git a/core/mogo-core-function-call/build.gradle b/core/mogo-core-function-call/build.gradle index 22a7f5270f..51aef62a5c 100644 --- a/core/mogo-core-function-call/build.gradle +++ b/core/mogo-core-function-call/build.gradle @@ -49,9 +49,11 @@ dependencies { // MoGo 数据埋点工具 implementation rootProject.ext.dependencies.analytics - compileOnly rootProject.ext.dependencies.mogocustommap + 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 diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt index 577718120d..20801f9171 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationWGS84ListenerManager.kt @@ -23,7 +23,7 @@ object CallerChassisLocationWGS84ListenerManager : CallerBase { - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() + /** + * 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 + */ + protected val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() + + /** + * 存储所有注册了监听的对象,并设定监听频率,invokeXXXX进行遍历回调,将信息同步, + */ + protected val M_LISTENERS_HZ: ConcurrentHashMap = ConcurrentHashMap() + + /** + * HZ发送,记录最后一次发送时间 + */ + protected val M_LISTENERS_HZ_LAST_SEND_TIME: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 设置对应监听,指定Hz频率 + */ + fun setListenerHz(tag: String, hz: Int) { + if (M_LISTENERS_HZ.containsKey(tag)) { + return + } + M_LISTENERS_HZ[tag] = hz + } /** * 添加 监听 @@ -21,8 +44,8 @@ open class CallerBase { * @param listener 监听回调 */ fun addListener( - tag: String, - listener: T + tag: String, + listener: T ) { if (M_LISTENERS.containsKey(tag)) { return diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index b89e16b16d..f995fc302d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -10,7 +10,6 @@ import com.mogo.eagle.core.data.map.Infrastructure 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.hmi.view.IViewTrafficLight import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener @@ -32,20 +31,6 @@ object CallerHmiManager { waringProviderApi?.displayEffects() } - /** - * 控制转向灯功能 - */ - fun setTurnLightFunction(isOpen: Boolean) { - waringProviderApi?.setTurnLightFunction(isOpen) - } - - /** - * 控制刹车功能 - */ - fun setBrakeLightFunction(isOpen: Boolean) { - waringProviderApi?.setBrakeLightFunction(isOpen) - } - /** * 控制显示sn绑定弹框 */ @@ -98,67 +83,6 @@ object CallerHmiManager { waringProviderApi?.disableWarningV2X(tag) } - /** - * 展示红绿灯预警 - * - * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知;3:OBU - */ - fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) { - waringProviderApi?.showWarningTrafficLight(checkLightId, lightSource) - } - - /** - * 关闭红绿灯预警 - */ - fun disableWarningTrafficLight() { - waringProviderApi?.disableWarningTrafficLight() - } - - /** - * 红绿灯是否展示 - */ - fun isWarningTrafficLightShow(): Boolean { - return waringProviderApi?.isWarningTrafficLightShow() ?: false - } - - /** - * 关闭红绿灯倒计时 - */ - fun disableWarningTrafficLightCountDown() { - waringProviderApi?.disableWarningTrafficLightCountDown() - } - - /** - * 修改红灯倒计时 - */ - fun changeCountdownRed(redNum: Int) { - waringProviderApi?.changeCountdownRed(redNum) - } - - /** - * 修改黄灯倒计时 - */ - fun changeCountdownYellow(yellowNum: Int) { - waringProviderApi?.changeCountdownYellow(yellowNum) - } - - /** - * 修改绿灯倒计时 - */ - fun changeCountdownGreen(greenNum: Int) { - waringProviderApi?.changeCountdownGreen(greenNum) - } - - /** - * @param readNum 红灯倒计时 - * @param yellowNum 黄灯倒计时 - * @param greenNum 绿灯倒计时 - */ - fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) { - waringProviderApi?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum) - } - /** * 展示指定方位上的红框预警 * @param direction @@ -279,14 +203,6 @@ object CallerHmiManager { waringProviderApi?.hideSmallFragment() } - /** - * 设置 红绿灯 代理View - * @param view - */ - fun setProxyTrafficLightView(view: IViewTrafficLight) { - waringProviderApi?.setProxyTrafficLightView(view) - } - /** * 展示工控机监控上报数据 * @param errorReportList 错误级别上报数据列表 @@ -327,20 +243,6 @@ object CallerHmiManager { waringProviderApi?.updateStatusBarLeftView(insert, tag, viewGroup) } - /** - * 设置司机端消息盒子是否展示 - */ - fun updateDriverMsgBoxTipView(show: Boolean = false) { - waringProviderApi?.updateDriverMsgBoxTipView(show) - } - - /** - * 设置乘客端消息盒子是否展示 - */ - fun updatePassengerMsgBoxTipView(show: Boolean = false) { - waringProviderApi?.updatePassengerMsgBoxTipView(show) - } - /** * 更新(添加/删除)状态栏右侧元素 */ diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt index 08ab9ff67f..1b6cad9637 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt @@ -1,14 +1,12 @@ package com.mogo.eagle.core.function.call.map import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** - * @author xiaoyuzhou + * 高德地图 位置改变 监听管理 + * @author dongghongyu * @date 2021/9/30 5:48 下午 - * 地图 位置改变 监听管理 */ object CallerMapLocationListenerManager : CallerBase() { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt index 9b61eec3f2..35470b458f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.call.msgbox import androidx.annotation.Nullable +import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener import com.mogo.eagle.core.function.call.base.CallerBase import java.util.concurrent.ConcurrentHashMap @@ -12,19 +13,60 @@ import java.util.concurrent.ConcurrentHashMap */ object CallerMsgBoxEventListenerManager: CallerBase() { - private val statusListeners: ConcurrentHashMap = - ConcurrentHashMap() - /** - * 触发监听 + * 触发汇总报告点击事件监听 */ - fun invokeListener(){ - statusListeners.forEach { + fun invokeSummaryListener(){ + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onSummaryClickEvent() } } + /** + * 更新消息提示View展示状态 + */ + fun invokeUpdateTipListener(isShow: Boolean){ + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onUpdateTipEvent(isShow) + } + } + + /** + * 气泡态运营平台事件点击监听 + **/ + fun invokeBubbleOperationListener(msgBoxBean: MsgBoxBean){ + M_LISTENERS.forEach{ + val tag = it.key + val listener = it.value + listener.onBubbleOperationClickEvent(msgBoxBean) + } + } + + /** + * 气泡态V2X消息事件点击监听 + */ + fun invokeBubbleV2XListener(msgBoxBean: MsgBoxBean){ + M_LISTENERS.forEach{ + val tag = it.key + val listener = it.value + listener.onBubbleV2XClickEvent(msgBoxBean) + } + } + + /** + * 气泡态上报消息事件点击监听 + */ + fun invokeBubbleReportListener(msgBoxBean: MsgBoxBean){ + M_LISTENERS.forEach{ + val tag = it.key + val listener = it.value + listener.onBubbleReportClickEvent(msgBoxBean) + } + } + } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt similarity index 84% rename from core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt rename to core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt index 3dd265e6c8..0bc8fae569 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt @@ -5,18 +5,17 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider import com.mogo.eagle.core.function.call.base.CallerBase /** - *@author xiaoyuzhou - *@date 2021/10/11 8:30 下午 * 自研OBU管理 + * @author xiaoyuzhou + * @date 2021/10/11 8:30 下午 */ -object CallerOBUManager { +object CallerObuApiManager { private val providerApi: IMoGoObuProvider get() = CallerBase.getApiInstance( IMoGoObuProvider::class.java, MogoServicePaths.PATH_V2X_OBU_MOGO ) - /** * 重新设置OBU链接IP * @@ -29,7 +28,7 @@ object CallerOBUManager { /** * 断开OBU连接 */ - fun disConnectObu(){ + fun disConnectObu() { providerApi.disConnect() } @@ -37,7 +36,7 @@ object CallerOBUManager { * 获取OBU连接状态 * @return boolean 连接状态 */ - fun isConnected(): Boolean{ + fun isConnected(): Boolean { return providerApi.isConnected() } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuConnectListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuConnectListenerManager.kt new file mode 100644 index 0000000000..ab739efdf1 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuConnectListenerManager.kt @@ -0,0 +1,59 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.data.obu.ObuStatusInfo +import com.mogo.eagle.core.function.api.obu.IMoGoObuConnectListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.utilcode.util.GsonUtils + +/** + * OBU 监听管理 + * @author xiaoyuzhou + * @date 2021/9/30 5:48 下午 + */ +object CallerObuConnectListenerManager : CallerBase() { + + /** + * 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 + */ + private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() + + /** + * 查询 OBU状态 + */ + fun getObuStatusInfo(): ObuStatusInfo { + return mObuStatusInfo + } + + /** + * 查询 OBU状态 + */ + fun getObuStatusInfoJsonString(): String { + return GsonUtils.toJson(mObuStatusInfo) + } + + override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuConnectListener) { + listener.onConnectStatus(mObuStatusInfo) + } + + /** + * 触发 OBU状态 监听 + */ + fun invokeObuConnectListener() { + invokeObuConnectListener(mObuStatusInfo) + } + + /** + * 触发 OBU状态 监听 + * @param obuStatusInfo 当前OBU连接状态信息 + */ + fun invokeObuConnectListener(obuStatusInfo: ObuStatusInfo) { + mObuStatusInfo = obuStatusInfo + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onConnectStatus(mObuStatusInfo) + } + } + + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt deleted file mode 100644 index c13c01f3cd..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt +++ /dev/null @@ -1,80 +0,0 @@ -package com.mogo.eagle.core.function.call.obu - -import com.mogo.eagle.core.data.obu.ObuStatusInfo -import com.mogo.eagle.core.data.traffic.TrafficData -import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener -import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.GsonUtils - -/** - * @author xiaoyuzhou - * @date 2021/9/30 5:48 下午 - * OBU 监听管理 - */ -object CallerObuListenerManager : CallerBase() { - - // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 - private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() - - /** - * 查询 OBU状态 - */ - fun getObuStatusInfo(): ObuStatusInfo { - return mObuStatusInfo - } - - /** - * 查询 OBU状态 - */ - fun getObuStatusInfoJsonString(): String { - return GsonUtils.toJson(mObuStatusInfo) - } - - override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuStatusListener) { - listener.onObuStatusResponse(mObuStatusInfo) - } - - - /** - * 触发 OBU状态 监听 - */ - fun invokeListener() { - invokeListener(mObuStatusInfo) - } - - /** - * 触发 OBU状态 监听 - * @param obuStatusInfo 选中状态 - */ - fun invokeListener(obuStatusInfo: ObuStatusInfo) { - mObuStatusInfo = obuStatusInfo - M_LISTENERS.forEach { - val tag = it.key - val listener = it.value - listener.onObuStatusResponse(mObuStatusInfo) - } - } - - fun invokeDelayTime(delayTime: Long) { - M_LISTENERS.forEach { - val tag = it.key - val listener = it.value - listener.onObuV2iDelayTime(delayTime) - } - } - - fun invokeTrackerWarningInfo(trafficData: TrafficData){ - M_LISTENERS.forEach { - val listener = it.value - listener.updateTrackerWarningInfo(trafficData) - } - } - - fun removeTrackerWarningInfo(trafficData: TrafficData){ - M_LISTENERS.forEach { - val listener = it.value - listener.removeTrackerWarningInfo(trafficData) - } - } - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuLocationWGS84ListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuLocationWGS84ListenerManager.kt new file mode 100644 index 0000000000..8b1370b34b --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuLocationWGS84ListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuHvBasicsData + +/** + * OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系 + */ +object CallerObuLocationWGS84ListenerManager : CallerBase() { + + fun invokeObuLocationWGS84(data: MogoObuHvBasicsData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onObuLocationWGS84(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuMapMathListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuMapMathListenerManager.kt new file mode 100644 index 0000000000..e80b1231ca --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuMapMathListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.ObuScene + +/** + * OBU 地图匹配结果,车道线、红绿灯、建议最大车速、建议最小车速 + */ +object CallerObuMapMathListenerManager : CallerBase() { + + fun invokeObuMapMath(data: ObuScene.MapMatchData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuMapMath(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt deleted file mode 100644 index e881947ad9..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.mogo.eagle.core.function.call.obu - -import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener -import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap - - -object CallerObuTrafficLightListenerManager : CallerBase() { - - private val M_OBU_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - var mLight: Int = 0 - - - fun invokeObuTrafficLight(light: Int) { - this.mLight = light - M_OBU_TRAFFIC_LIGHT_LISTENER.forEach { - val tag = it.key - val listener = it.value - listener.onObuTrafficLight(light) - } - } - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningListenerManager.kt new file mode 100644 index 0000000000..228bb7fb73 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningListenerManager.kt @@ -0,0 +1,36 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.data.traffic.TrafficData +import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener +import com.mogo.eagle.core.function.call.base.CallerBase + +/** + * OBU 监听管理 + * @author xiaoyuzhou + * @date 2021/9/30 5:48 下午 + */ +object CallerObuWarningListenerManager : CallerBase() { + + fun invokeDelayTime(delayTime: Long) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onObuV2iDelayTime(delayTime) + } + } + + fun invokeTrackerWarningInfo(trafficData: TrafficData) { + M_LISTENERS.forEach { + val listener = it.value + listener.updateTrackerWarningInfo(trafficData) + } + } + + fun removeTrackerWarningInfo(trafficData: TrafficData) { + M_LISTENERS.forEach { + val listener = it.value + listener.removeTrackerWarningInfo(trafficData) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsiListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsiListenerManager.kt new file mode 100644 index 0000000000..e453790642 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsiListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.ObuScene + +/** + * OBU 交通事件预警 + */ +object CallerObuWarningRsiListenerManager : CallerBase() { + + fun invokeObuRsiWarning(data: ObuScene.RsiWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuRsiWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsmListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsmListenerManager.kt new file mode 100644 index 0000000000..80e79ec2bb --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsmListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.ObuScene + +/** + * OBU RSM预警信息,弱势交通参与者预警信息 + */ +object CallerObuWarningRsmListenerManager : CallerBase() { + + fun invokeObuRsmWarning(data: ObuScene.RsmWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuRsmWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRvListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRvListenerManager.kt new file mode 100644 index 0000000000..659d11a338 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRvListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRvListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuRvWarningData + +/** + * OBU V2V预警信息,车与车间的预警,左右超车、前方车刹车、车辆事故 + */ +object CallerObuWarningRvListenerManager : CallerBase() { + + fun invokeObuRvWarning(data: MogoObuRvWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuRvWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningSpatListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningSpatListenerManager.kt new file mode 100644 index 0000000000..0718dec326 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningSpatListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.ObuScene + +/** + * OBU 红绿灯信息 + */ +object CallerObuWarningSpatListenerManager : CallerBase() { + + fun invokeObuSpatWarning(data: ObuScene.SpatWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuSpatWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt index 24da759ef4..b2659b4ec6 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt @@ -1,10 +1,12 @@ package com.mogo.eagle.core.function.call.trafficlight +import com.mogo.eagle.core.data.enums.DataSourceType +import com.mogo.eagle.core.data.enums.TrafficLightEnum import com.mogo.eagle.core.data.trafficlight.TrafficLightResult import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener import com.mogo.eagle.core.function.call.base.CallerBase -object CallerTrafficLightListenerManager : CallerBase() { +object CallerTrafficLightListenerManager : CallerBase() { private var trafficLightResult: TrafficLightResult? = null @@ -17,7 +19,6 @@ object CallerTrafficLightListenerManager : CallerBase 0f) { + canvas.clipPath(roundPath); + } + super.draw(canvas); + } + +} diff --git a/libraries/mogo-adas-data/README.md b/libraries/mogo-adas-data/README.md index dc6dc94f53..72fc06ed07 100644 --- a/libraries/mogo-adas-data/README.md +++ b/libraries/mogo-adas-data/README.md @@ -12,4 +12,98 @@ ~~~ 1. 选中mogo-adas-data 2. 点击Build> Make Moudle 'MoGoEagleEye.libraries.mogo-adas-data' +~~~ + +# 工控机透传OBU V2I PB转换 +***鹰眼自用PB文件放在单独文件夹(personal)目的是为了区分工控机PB还是自用PB*** +|工控机原始PB文件|转换后鹰眼所用PB| +|:-|:-| +|obu_warning_event.proto|personal/obu_penetrate.proto、personal/obu_scene.proto| +|mogo_v2x.proto|personal/obu_base.proto| +## PB需要转换精度的字段 +**MapMatchData** +~~~ +obu_scene.proto/MapMatchData/speedMaxLimit int32 转 double (0.02m/s 转 m/s) +obu_scene.proto/MapMatchData/speedMinLimit int32 转 double (0.02m/s 转 m/s) +~~~ +**SpatLight** +~~~ +obu_base.proto/SpatLight/countDown int32 转 double (0.1s 转 s) +obu_base.proto/SpatLight/suggestMaxSpeed int32 转 double (0.02m/s 转 m/s) +obu_base.proto/SpatLight/suggestMinSpeed int32 转 double (0.02m/s 转 m/s) +~~~ +**Participant** +~~~ +obu_base.proto/Participant/latitude int64 转 double (1e-7° 转 °) +obu_base.proto/Participant/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/Participant/elevation int64 转 double (0.1m 转 m) +obu_base.proto/Participant/speed int64 转 double (0.02m/s 转 m/s) +obu_base.proto/Participant/heading int32 转 double (0.0125° 转 °) +~~~ +**AccFourAxes** +~~~ +obu_base.proto/AccFourAxes/accLng int32 转 double (0.01m/s2 转 m/s2) +obu_base.proto/AccFourAxes/accLat int32 转 double (0.01m/s2 转 m/s2) +obu_base.proto/AccFourAxes/accVert int32 转 double (0.02G 转 G) +obu_base.proto/AccFourAxes/accYaw int32 转 double (0.01°/s 转 °/s) +~~~ +**VehicleSize** +~~~ +obu_base.proto/VehicleSize/height int32 转 int32 (5cm 转 cm) +~~~ +**V2xWarning** +~~~ +obu_base.proto/V2xWarning/distance int32 转 double (0.01m 转 m) +~~~ +**RsiWarning** +~~~ +obu_base.proto/RsiWarning/speedMaxLimit int32 转 double (0.02m/s 转 m/s) +obu_base.proto/RsiWarning/speedMinLimit int32 转 double (0.02m/s 转 m/s) +obu_base.proto/RsiWarning/eventRadius int32 转 double (0.1m 转 m) +obu_base.proto/RsiWarning/distance int32 转 double (0.01m 转 m) +~~~ +**VerticalLLV** +~~~ +obu_base.proto/VerticalLLV/present/offset1 int32 转 double (0.1m 转 m) +obu_base.proto/VerticalLLV/present/offset2 int32 转 double (0.1m 转 m) +obu_base.proto/VerticalLLV/present/offset3 int32 转 double (0.1m 转 m) +obu_base.proto/VerticalLLV/present/offset4 int32 转 double (0.1m 转 m) +obu_base.proto/VerticalLLV/present/offset5 int32 转 double (0.1m 转 m) +obu_base.proto/VerticalLLV/present/offset6 int32 转 double (0.1m 转 m) +obu_base.proto/VerticalLLV/present/elevation int32 转 double (0.1m 转 m) +~~~ +**PositionLL1** +~~~ +obu_base.proto/PositionLL1/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLL1/latitude int64 转 double (1e-7° 转 °) +~~~ +**PositionLL2** +~~~ +obu_base.proto/PositionLL2/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLL2/latitude int64 转 double (1e-7° 转 °) +~~~ +**PositionLL3** +~~~ +obu_base.proto/PositionLL3/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLL3/latitude int64 转 double (1e-7° 转 °) +~~~ +**PositionLL4** +~~~ +obu_base.proto/PositionLL4/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLL4/latitude int64 转 double (1e-7° 转 °) +~~~ +**PositionLL5** +~~~ +obu_base.proto/PositionLL5/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLL5/latitude int64 转 double (1e-7° 转 °) +~~~ +**PositionLL6** +~~~ +obu_base.proto/PositionLL6/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLL6/latitude int64 转 double (1e-7° 转 °) +~~~ +**PositionLatLon** +~~~ +obu_base.proto/PositionLatLon/longitude int64 转 double (1e-7° 转 °) +obu_base.proto/PositionLatLon/latitude int64 转 double (1e-7° 转 °) ~~~ \ No newline at end of file diff --git a/libraries/mogo-adas-data/src/main/proto/personal/obu_base.proto b/libraries/mogo-adas-data/src/main/proto/personal/obu_base.proto new file mode 100644 index 0000000000..52174fb80e --- /dev/null +++ b/libraries/mogo-adas-data/src/main/proto/personal/obu_base.proto @@ -0,0 +1,167 @@ +syntax = "proto3"; +package com.mogo.support.obu; +//场景基础数据PB + +//垂直方向偏差 目前OBU发送的数据未偏移,使用的是elevation +message VerticalLLV{ + oneof present{ + double offset1 = 1;//海拔,单位(m) + double offset2 = 2;//海拔,单位(m) + double offset3 = 3;//海拔,单位(m) + double offset4 = 4;//海拔,单位(m) + double offset5 = 5;//海拔,单位(m) + double offset6 = 6;//海拔,单位(m) + double elevation = 7;//海拔,单位(m) + } +} + + + +////////////////////////////////////////////////////////////////// +//经纬度偏差,来描述一个坐标点的相对位置。约定偏差值等于真实值减去参考值。 +//提供了 7 种尺度的描述方式 目前OBU发送的数据未偏移,使用的是position_LatLon +message PositionOffset{ + oneof present{ + PositionLL1 positionLL1 = 1; + PositionLL2 positionLL2 = 2; + PositionLL3 positionLL3 = 3; + PositionLL4 positionLL4 = 4; + PositionLL5 positionLL5 = 5; + PositionLL6 positionLL6 = 6; + PositionLatLon positionLatLon = 7; + } +} +message PositionLL1{ + // (-2048..2047) + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +message PositionLL2{ + // (-8192..8191) + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +message PositionLL3{ + // (-32768..32767) + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +message PositionLL4{ + // (-131072..131071) + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +message PositionLL5{ + // (-2097152..2097151) + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +message PositionLL6{ + // (-8388608..8388607) + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +message PositionLatLon{ + // 定义经度数值。东经为正,西经为负。 + //分辨率为1e-7°。 + double longitude = 1;//经度,单位(°) + double latitude = 2;//维度,单位(°) +} +////////////////////////////////////////////////////////////////// + +//交通标志/事件位置信息 +message PositionLLV{ + PositionOffset position = 1;//经纬度 + VerticalLLV vertical = 2;//垂直方向偏差 +} + +//交通参与者尺寸信息 +message VehicleSize { + int32 width = 1;//宽度,单位(cm) + int32 length = 2;//长度,单位(cm) + int32 height = 3;//高度,单位(cm) +} + +//四轴加速度 +message AccFourAxes { + double accLng = 1;//纵向加速度,单位(m/s2) + double accLat = 2;//横向加速度,单位(m/s2) + double accVert = 3;//垂直加速度,单位(G) + double accYaw = 4;//横摆角加速度,单位(°/s) +} + +//节点信息 +message NodeId{ + int32 region = 1;/* 定义地图中划分区域的ID号 */ + int32 id = 2; /* 定义地图节点ID */ +} + +//灯色信息 +message SpatLight{ + int32 phaseID = 1; /* 信号灯相位ID */ + int32 maneuvers = 2; /* 允许转向关系,bit0:直行,bit1:左转,bit2:右转,bit3:掉头 */ + int32 light = 3; /* 灯色,0:不可用,1:黑色,2:红闪,3:红色,4:绿闪,5:permissive_green,6:protected_green,7:黄色,8:黄闪 */ + double countDown = 4; /* 灯色倒计时,单位(s) */ + double suggestMaxSpeed = 5; /* 建议最大车速,单位(m/s) */ + double suggestMinSpeed = 6; /* 建议最小车速,单位(m/s) */ +} + +//时间 +message DateTime{ + int32 year = 1; /* 年份 */ + int32 month = 2; /* 月份 */ + int32 day = 3; /* 日期 */ + int32 hour = 4; /* 小时 */ + int32 minute = 5; /* 分钟 */ + int32 millisecond = 6; /* 毫秒 */ + int32 offset = 7; /* 定义与UTC时间的分钟差 */ +} + +//预警数据 +message WarningData{ + int32 unitMask = 1; /* 描述所属字段有效性 */ + int32 status = 2; /* 状态信息,0:更新,1:添加,2:删除 */ + int32 warningType = 3; /* 预警类型,0:前向碰撞预警,1:交叉路口碰撞预警,2:左转辅助预警,3:盲区预警,4:变道预警, + 5:逆向超车预警,6:紧急制动预警,7:异常车辆提醒,8:失控车辆预警,9:紧急车辆预警,10:弱势交通参与者碰撞预警 */ + int32 warningLevel = 4; /* 预警等级,0:无效,1:DETECTED,2:INFORM,3:WARNING */ + int32 warningPriority = 5; /* 预警优先级,默认为0,预留 */ +} + +//弱势交通参与者预警信息 +message V2xWarning{ + int32 unitMask = 1; /* 描述所属字段有效性 */ + repeated WarningData warningData = 2; + DateTime warningTime = 3; /* 预警触发时间 */ + double distance = 4; /* 预警触发时与自车之间的距离,单位(m) */ +} + +//弱势交通参与者信息 +message Participant{ + int32 ptcType = 1; /* 交通参与者类型,0:未知,1:机动车,2:非机动车,3:行人,4:OBU自身 */ + int32 ptcId = 2; /* 临时ID,取值范围(1..255) */ + int32 source = 3; /* 监测信息来源,0:未知,1:RSU自身,2:V2X广播,3:视频传感器,4:微波雷达,5:地磁线圈传感器,6:激光雷达传感器,7:两类或以上感知数据融合 */ + int64 secMark = 4; /* UTC时间,单位(ms) */ + double latitude = 5; /* 维度,单位(°) */ + double longitude = 6; /* 经度,单位(°) */ + double elevation = 7; /* 海拔,单位(m) */ + double speed = 8; /* 速度,单位(m/s) */ + double heading = 9; /* 航向角,单位(°) */ + AccFourAxes accFourAxes = 10; /* 四轴加速度 */ + VehicleSize ptcSize = 11; /* 交通参与者尺寸信息 */ + int32 vehicleClass = 12; /* 车辆类型,参考《OBU软件SDK使用文档》附录A中的表1 */ + int32 targetPosition = 13; /* 目标方位,参考mg_veh_target_position_t */ +} + +message RsiWarning { + int32 unitMask = 1; /* 描述所属字段有效性 */ + int32 sceneType = 2; /* 预警类型,0:无效,1:限速信息,2:道路危险,3:车内标牌,4:前方拥堵 */ + PositionLLV position = 3; /* 交通标志/事件位置信息 */ + int32 signSerialNum = 4; /* 交通标志类型序号,根据预警类型匹配,0:无效,参照国标《GB 5768.2-2009中“交通标志中文名称索引》表序号 */ + int32 eventSerialNum = 5; /* 交通事件类型序号,根据预警类型匹配,0:无效,参考国标《GB/T 29100-2012》中定义的事件分类代码 */ + double speedMaxLimit = 6; /* 建议最大车速,单位(0.02m/s) */ + double speedMinLimit = 7; /* 建议最小车速,单位(0.02m/s) */ + double eventRadius = 8; /* 交通事件触发半径,根据预警类型匹配,0:无效,单位(0.1m) */ + int32 warningLevel = 9; /* 预警等级,0:无效,1:DETECTED,2:INFORM,3:WARNING */ + int32 targetPosition = 10; /* 目标方位,参考mg_rti_target_position_t */ + double distance = 11; /* 预警触发时与自车之间的距离,单位(0.01m) */ +} \ No newline at end of file diff --git a/libraries/mogo-adas-data/src/main/proto/personal/obu_penetrate.proto b/libraries/mogo-adas-data/src/main/proto/personal/obu_penetrate.proto new file mode 100644 index 0000000000..1745f69063 --- /dev/null +++ b/libraries/mogo-adas-data/src/main/proto/personal/obu_penetrate.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package com.mogo.support.obu; + +import "header.proto"; +import "personal/obu_scene.proto"; + +//工控机透传PB +message PenetrateWarningData{ + common.Header header = 1; + int32 msgDataType = 2; /*1:rsiEvent; 2:rsmEvent; 3:spatEvent; 4:mapMatchData*/ + RsiWarningData rsiEvent = 3; + RsmWarningData rsmEvent = 4; + SpatWarningData spatEvent = 5; + MapMatchData mapMatchData = 6; +} diff --git a/libraries/mogo-adas-data/src/main/proto/personal/obu_scene.proto b/libraries/mogo-adas-data/src/main/proto/personal/obu_scene.proto new file mode 100644 index 0000000000..feb76afbc0 --- /dev/null +++ b/libraries/mogo-adas-data/src/main/proto/personal/obu_scene.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package com.mogo.support.obu; + +import "personal/obu_base.proto"; +//场景PB 目前只有V2I(Rsi、Rsm、Spat、Map)相关场景,后期会添加V2V相关场景 + +//预警事件 RSI Warning event +message RsiWarningData { + int32 status = 1; /* 状态信息,0:更新,1:添加,2:删除 */ + //int32 warning_num = 2; /* 预警信息数量 */ + repeated RsiWarning warningMsg = 2; /* 预警信息集合 */ +} + +//RSM Warning Msg +message RsmWarningData{ + int32 status = 1; /* 状态信息,0:更新,1:添加,2:删除 */ + Participant participant = 2; /* 弱势交通参与者信息 */ + V2xWarning warningMsg = 3; /* 弱势交通参与者预警信息 */ +} + +//SPAT Msg +message SpatWarningData{ + int32 status = 1; /* 状态信息,0:更新,1:添加,2:删除 */ + int32 warningType = 2; /* 预警类型信息 */ + repeated SpatLight lights = 3; /* 灯色信息集合 */ +} + +message MapMatchData{ + int32 status = 1;/* 状态信息,0:更新,1:添加,2:删除 */ + int32 unitMask = 2;/* 描述所属字段有效性 */ + NodeId currentNodeID = 3;/* 前方节点信息 */ + NodeId upstreamNodeID = 4;/* 上游节点信息 */ + int32 matchingLaneID = 5;/* 匹配车道ID,0:无效 */ + double speedMaxLimit = 6;/* 建议最大车速,单位(m/s) */ + double speedMinLimit = 7;/* 建议最小车速,单位(m/s) */ +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java index cc41289c5a..c53588b041 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java @@ -205,6 +205,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec // dispatchHandlers.put(MessagePad.MessageType.MsgTypeTrajectory, new DispatchHandler(MessagePad.MessageType.MsgTypeTrajectory, this)); //障碍物信息 dispatchHandlers.put(MessagePad.MessageType.MsgTypeTrackedObjects, new DispatchHandler(MessagePad.MessageType.MsgTypeTrackedObjects, this)); + //透传OBU V2I事件(OBU通过UDP发送数据如果多场景同时出发,接收频率太高。工控机只是透传未做任何频率限制) + dispatchHandlers.put(MessagePad.MessageType.MsgTypeObuWarningData, new DispatchHandler(MessagePad.MessageType.MsgTypeObuWarningData, this)); + //惯导信息 // dispatchHandlers.put(MessagePad.MessageType.MsgTypeGnssInfo, new DispatchHandler(MessagePad.MessageType.MsgTypeGnssInfo, this)); //底盘信息 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index e309aab7f8..2613f4e95e 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -1,5 +1,6 @@ package com.zhidao.support.adas.high; +import com.mogo.support.obu.ObuScene; import com.zhidao.support.adas.high.bean.AutopilotAbility; import com.zhidao.support.adas.high.bean.AutopilotStatistics; import com.zhidao.support.adas.high.common.ProtocolStatus; @@ -203,6 +204,38 @@ public interface OnAdasListener { */ void onObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData obuWarningData); + /** + * OBU 红绿灯预警信息 + * + * @param header 头 + * @param spatWarningData 数据 + */ + void onoObuSpatWarning(MessagePad.Header header, ObuScene.SpatWarningData spatWarningData); + + /** + * OBU RSI预警信息 + * + * @param header 头 + * @param rsiWarningData 数据 + */ + void onoObuRsiWarning(MessagePad.Header header, ObuScene.RsiWarningData rsiWarningData); + + /** + * OBU RSM预警信息 + * + * @param header 头 + * @param rsmWarningData 数据 + */ + void onoObuRsmWarning(MessagePad.Header header, ObuScene.RsmWarningData rsmWarningData); + + /** + * OBU 地图匹配结果 + * + * @param header 头 + * @param mapMatchData 数据 + */ + void onoObuObuMapMath(MessagePad.Header header, ObuScene.MapMatchData mapMatchData); + /** * 重构后的功能状态 * diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java index 98075ce004..e07f3d0f2e 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java @@ -1,8 +1,10 @@ package com.zhidao.support.adas.high.msg; import android.os.SystemClock; +import android.util.Log; import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.UnknownFieldSet; import com.zhidao.support.adas.high.AdasChannel; import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.common.CupidLogUtils; @@ -27,5 +29,30 @@ public class ObuWarningDataMessage extends MyAbstractMessageHandler { adasListener.onObuWarningData(raw.getHeader(), obuWarningData); } AdasChannel.calculateTimeConsumingBusiness("OBU预警事件", nowTime); + + + +// ObuPenetrate.WarningData warningData = ObuPenetrate.WarningData.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); +// UnknownFieldSet set = warningData.getMapMatchData().getUnknownFields(); +// +// Log.i("ddd", "set.getField(7).getVarintList()=" + set.getField(7).getVarintList()); +// Long a = set.getField(7).getVarintList().get(0); +// +// ObuScene.MapMatchData.Builder MapMatchDataBuilder = warningData.getMapMatchData().toBuilder().setSpeedMinLimit(a * 0.02D); +// MapMatchDataBuilder.setUnknownFields(UnknownFieldSet.getDefaultInstance()); +// ObuPenetrate.WarningData.Builder builder = warningData.toBuilder(); +// builder.setMapMatchData(MapMatchDataBuilder); +// warningData = builder.build(); +//// Log.i("ddd","a="+a); +// +// +// AdasChannel.calculateTimeConsumingOnDispatchRaw("OBU预警事件", raw.receiveTime); +// long nowTime = 0; +// if (CupidLogUtils.isEnableLog()) +// nowTime = SystemClock.elapsedRealtime(); +// if (adasListener != null) { +// adasListener.onObuWarningData(raw.getHeader(), warningData); +// } +// AdasChannel.calculateTimeConsumingBusiness("OBU预警事件", nowTime); } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java index d31f4e29ce..2dfa892d3d 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java @@ -10,6 +10,10 @@ import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; +/** + * 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20 + * 这里的数据仅用于非高精度业务 + */ public class GDLocationClient implements AMapLocationListener, IMogoGDLocationClient { private volatile static GDLocationClient gdLocationClient; diff --git a/libraries/mogo-obu/.gitignore b/libraries/mogo-obu/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/libraries/mogo-obu/.gitignore @@ -0,0 +1 @@ +/build diff --git a/libraries/mogo-obu/README.md b/libraries/mogo-obu/README.md new file mode 100644 index 0000000000..cef2260b99 --- /dev/null +++ b/libraries/mogo-obu/README.md @@ -0,0 +1,4 @@ +#### 说明 +# OBU LIB +## OBU SDK 数据融合 + diff --git a/libraries/mogo-obu/build.gradle b/libraries/mogo-obu/build.gradle new file mode 100644 index 0000000000..e3dc611b6f --- /dev/null +++ b/libraries/mogo-obu/build.gradle @@ -0,0 +1,61 @@ +plugins { + id 'com.android.library' + id 'com.google.protobuf' +} + +android { + compileSdkVersion rootProject.ext.android.compileSdkVersion + + defaultConfig { + minSdkVersion rootProject.ext.android.minSdkVersion + targetSdkVersion rootProject.ext.android.targetSdkVersion + versionCode rootProject.versionCode as int + versionName rootProject.versionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles 'consumer-rules.pro' + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + sourceSets { + main { + proto { + srcDir 'src/main/proto' + include '**/*.proto' + } + } + } + + protobuf { + protoc { + artifact = rootProject.ext.dependencies.protoc + } + + generateProtoTasks { + all().each { task -> + task.builtins { + remove java + } + task.builtins { + java {} + } + } + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + api project(':libraries:mogo-adas-data') + api rootProject.ext.dependencies.protobuf_java + api rootProject.ext.dependencies.protobuf_java_util + api rootProject.ext.dependencies.mogoobu +} diff --git a/libraries/mogo-obu/consumer-rules.pro b/libraries/mogo-obu/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libraries/mogo-obu/gradle.properties b/libraries/mogo-obu/gradle.properties new file mode 100644 index 0000000000..ed0606233d --- /dev/null +++ b/libraries/mogo-obu/gradle.properties @@ -0,0 +1,3 @@ +GROUP=com.mogo.obu +POM_ARTIFACT_ID=mogo-obu +VERSION_CODE=1 \ No newline at end of file diff --git a/libraries/mogo-obu/proguard-rules.pro b/libraries/mogo-obu/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/libraries/mogo-obu/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/libraries/mogo-obu/src/main/AndroidManifest.xml b/libraries/mogo-obu/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..6da0edce23 --- /dev/null +++ b/libraries/mogo-obu/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + diff --git a/libraries/mogo-obu/src/main/res/values/strings.xml b/libraries/mogo-obu/src/main/res/values/strings.xml new file mode 100644 index 0000000000..1be2af6934 --- /dev/null +++ b/libraries/mogo-obu/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + mogo-obu + diff --git a/settings.gradle b/settings.gradle index 99625fde8b..ca6928c12d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -47,6 +47,7 @@ include ':libraries:mogo-map-api' include ':libraries:mogo-map' include ':libraries:mogo-adas' include ':libraries:mogo-adas-data' +include ':libraries:mogo-obu' // 语音 include ':tts:tts-base'